2010-04-06 19:54:51 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package org.thialfihar.android.apg;
|
|
|
|
|
|
|
|
|
|
import org.thialfihar.android.apg.provider.Accounts;
|
|
|
|
|
|
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
|
import android.app.Dialog;
|
|
|
|
|
import android.content.ContentValues;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
import android.database.SQLException;
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.view.ContextMenu;
|
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
|
import android.view.Menu;
|
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
import android.view.ContextMenu.ContextMenuInfo;
|
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
|
import android.widget.Button;
|
|
|
|
|
import android.widget.CursorAdapter;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
import android.widget.ListView;
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
import android.widget.AdapterView.OnItemClickListener;
|
|
|
|
|
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
public class MainActivity extends BaseActivity {
|
2010-04-06 19:54:51 +00:00
|
|
|
private ListView mAccounts = null;
|
2010-05-28 07:04:01 +00:00
|
|
|
private AccountListAdapter mListAdapter = null;
|
|
|
|
|
private Cursor mAccountCursor;
|
2010-04-06 19:54:51 +00:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
setContentView(R.layout.main);
|
|
|
|
|
|
|
|
|
|
Button encryptMessageButton = (Button) findViewById(R.id.btn_encryptMessage);
|
|
|
|
|
Button decryptMessageButton = (Button) findViewById(R.id.btn_decryptMessage);
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
Button encryptFileButton = (Button) findViewById(R.id.btn_encryptFile);
|
|
|
|
|
Button decryptFileButton = (Button) findViewById(R.id.btn_decryptFile);
|
2010-05-13 20:41:32 +00:00
|
|
|
mAccounts = (ListView) findViewById(R.id.accounts);
|
2010-04-06 19:54:51 +00:00
|
|
|
|
|
|
|
|
encryptMessageButton.setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
2010-05-09 19:51:21 +00:00
|
|
|
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
|
|
|
|
intent.setAction(Apg.Intent.ENCRYPT);
|
|
|
|
|
startActivity(intent);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
decryptMessageButton.setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
2010-05-11 14:07:15 +00:00
|
|
|
Intent intent = new Intent(MainActivity.this, DecryptActivity.class);
|
|
|
|
|
intent.setAction(Apg.Intent.DECRYPT);
|
|
|
|
|
startActivity(intent);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
encryptFileButton.setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
2010-05-09 19:51:21 +00:00
|
|
|
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
|
|
|
|
intent.setAction(Apg.Intent.ENCRYPT_FILE);
|
|
|
|
|
startActivity(intent);
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
decryptFileButton.setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
2010-05-11 14:07:15 +00:00
|
|
|
Intent intent = new Intent(MainActivity.this, DecryptActivity.class);
|
|
|
|
|
intent.setAction(Apg.Intent.DECRYPT_FILE);
|
|
|
|
|
startActivity(intent);
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2010-05-28 07:04:01 +00:00
|
|
|
mAccountCursor =
|
|
|
|
|
Apg.getDatabase().db().query(Accounts.TABLE_NAME,
|
|
|
|
|
new String[] {
|
|
|
|
|
Accounts._ID,
|
|
|
|
|
Accounts.NAME,
|
|
|
|
|
}, null, null, null, null, Accounts.NAME + " ASC");
|
|
|
|
|
startManagingCursor(mAccountCursor);
|
2010-04-06 19:54:51 +00:00
|
|
|
|
2010-05-28 07:04:01 +00:00
|
|
|
mListAdapter = new AccountListAdapter(this, mAccountCursor);
|
|
|
|
|
mAccounts.setAdapter(mListAdapter);
|
2010-04-06 19:54:51 +00:00
|
|
|
mAccounts.setOnItemClickListener(new OnItemClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemClick(AdapterView<?> arg0, View view, int index, long id) {
|
2010-06-04 20:21:51 +00:00
|
|
|
String accountName = (String) mAccounts.getItemAtPosition(index);
|
2010-05-28 07:04:01 +00:00
|
|
|
startActivity(new Intent(MainActivity.this, MailListActivity.class)
|
2010-05-31 23:15:20 +00:00
|
|
|
.putExtra(Apg.EXTRA_ACCOUNT, accountName));
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
registerForContextMenu(mAccounts);
|
|
|
|
|
|
2010-04-28 23:35:11 +00:00
|
|
|
if (!hasSeenChangeLog()) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
showDialog(Id.dialog.change_log);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected Dialog onCreateDialog(int id) {
|
|
|
|
|
switch (id) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.dialog.new_account: {
|
2010-04-06 19:54:51 +00:00
|
|
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
|
|
|
|
|
2010-05-13 20:41:32 +00:00
|
|
|
alert.setTitle(R.string.title_addAccount);
|
|
|
|
|
alert.setMessage(R.string.specifyGoogleMailAccount);
|
2010-04-06 19:54:51 +00:00
|
|
|
|
|
|
|
|
final EditText input = new EditText(this);
|
|
|
|
|
alert.setView(input);
|
|
|
|
|
|
|
|
|
|
alert.setPositiveButton(android.R.string.ok,
|
2010-05-13 20:41:32 +00:00
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
|
public void onClick(DialogInterface dialog, int id) {
|
|
|
|
|
MainActivity.this.removeDialog(Id.dialog.new_account);
|
|
|
|
|
String accountName = "" + input.getText();
|
|
|
|
|
|
|
|
|
|
Cursor testCursor =
|
|
|
|
|
managedQuery(Uri.parse("content://gmail-ls/conversations/" +
|
|
|
|
|
accountName),
|
|
|
|
|
null, null, null, null);
|
|
|
|
|
if (testCursor == null) {
|
|
|
|
|
Toast.makeText(MainActivity.this,
|
|
|
|
|
getString(R.string.errorMessage,
|
|
|
|
|
getString(R.string.error_accountNotFound,
|
|
|
|
|
accountName)),
|
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
|
values.put(Accounts.NAME, accountName);
|
|
|
|
|
try {
|
2010-05-28 07:04:01 +00:00
|
|
|
Apg.getDatabase().db().insert(Accounts.TABLE_NAME,
|
|
|
|
|
Accounts.NAME, values);
|
|
|
|
|
mAccountCursor.requery();
|
|
|
|
|
mListAdapter.notifyDataSetChanged();
|
2010-05-13 20:41:32 +00:00
|
|
|
} catch (SQLException e) {
|
|
|
|
|
Toast.makeText(MainActivity.this,
|
|
|
|
|
getString(R.string.errorMessage,
|
|
|
|
|
getString(R.string.error_addingAccountFailed,
|
|
|
|
|
accountName)),
|
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2010-04-06 19:54:51 +00:00
|
|
|
|
|
|
|
|
alert.setNegativeButton(android.R.string.cancel,
|
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
|
public void onClick(DialogInterface dialog, int id) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
MainActivity.this.removeDialog(Id.dialog.new_account);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return alert.create();
|
|
|
|
|
}
|
|
|
|
|
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.dialog.change_log: {
|
2010-04-06 19:54:51 +00:00
|
|
|
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
|
|
|
|
|
|
|
|
|
alert.setTitle("Changes " + Apg.FULL_VERSION);
|
2010-05-09 13:29:30 +00:00
|
|
|
LayoutInflater inflater =
|
|
|
|
|
(LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
|
|
View layout = inflater.inflate(R.layout.info, null);
|
|
|
|
|
TextView message = (TextView) layout.findViewById(R.id.message);
|
|
|
|
|
|
|
|
|
|
message.setText("Read the warnings!\n\n" +
|
|
|
|
|
"Changes:\n" +
|
2010-06-03 15:08:06 +00:00
|
|
|
"* k9mail integration, k9mail beta build is available on the k9mail website\n" +
|
2010-06-02 19:49:46 +00:00
|
|
|
"* support of other file managers (e.g. ASTRO)\n" +
|
|
|
|
|
"* Slovenian translation (thanks, 359)\n" +
|
2010-06-02 19:46:01 +00:00
|
|
|
"* new database, much faster, less memory usage\n" +
|
|
|
|
|
"* defined Intents and content provider for other apps\n" +
|
|
|
|
|
"* bugfixes\n" +
|
2010-05-09 13:29:30 +00:00
|
|
|
"\n" +
|
|
|
|
|
"WARNING: be careful editing your existing keys, as they " +
|
|
|
|
|
"WILL be stripped of certificates right now.\n" +
|
|
|
|
|
"\n" +
|
|
|
|
|
"WARNING: key creation/editing doesn't support all " +
|
|
|
|
|
"GPG features yet. In particular: " +
|
|
|
|
|
"key cross-certification is NOT supported, so signing " +
|
|
|
|
|
"with those keys will get a warning when the signature is " +
|
|
|
|
|
"checked.\n" +
|
|
|
|
|
"\n" +
|
|
|
|
|
"I hope APG continues to be useful to you, please send " +
|
|
|
|
|
"bug reports, feature wishes, feedback.");
|
|
|
|
|
alert.setView(layout);
|
2010-04-06 19:54:51 +00:00
|
|
|
|
|
|
|
|
alert.setCancelable(false);
|
|
|
|
|
alert.setPositiveButton(android.R.string.ok,
|
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
|
public void onClick(DialogInterface dialog, int id) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
MainActivity.this.removeDialog(Id.dialog.change_log);
|
2010-04-28 23:35:11 +00:00
|
|
|
setHasSeenChangeLog(true);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return alert.create();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default: {
|
2010-05-15 16:09:49 +00:00
|
|
|
return super.onCreateDialog(id);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
2010-04-29 10:55:50 +00:00
|
|
|
menu.add(0, Id.menu.option.create, 0, R.string.menu_addAccount)
|
|
|
|
|
.setIcon(android.R.drawable.ic_menu_add);
|
2010-04-28 23:35:11 +00:00
|
|
|
menu.add(1, Id.menu.option.manage_public_keys, 1, R.string.menu_managePublicKeys)
|
2010-04-06 19:54:51 +00:00
|
|
|
.setIcon(android.R.drawable.ic_menu_manage);
|
2010-04-28 23:35:11 +00:00
|
|
|
menu.add(1, Id.menu.option.manage_secret_keys, 2, R.string.menu_manageSecretKeys)
|
2010-04-06 19:54:51 +00:00
|
|
|
.setIcon(android.R.drawable.ic_menu_manage);
|
2010-04-29 10:55:50 +00:00
|
|
|
menu.add(2, Id.menu.option.preferences, 3, R.string.menu_preferences)
|
|
|
|
|
.setIcon(android.R.drawable.ic_menu_preferences);
|
2010-04-28 23:35:11 +00:00
|
|
|
menu.add(2, Id.menu.option.about, 4, R.string.menu_about)
|
2010-04-06 19:54:51 +00:00
|
|
|
.setIcon(android.R.drawable.ic_menu_info_details);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.menu.option.create: {
|
|
|
|
|
showDialog(Id.dialog.new_account);
|
2010-04-06 19:54:51 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.menu.option.manage_public_keys: {
|
2010-04-28 23:35:11 +00:00
|
|
|
startActivity(new Intent(this, PublicKeyListActivity.class));
|
2010-04-06 19:54:51 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.menu.option.manage_secret_keys: {
|
2010-04-28 23:35:11 +00:00
|
|
|
startActivity(new Intent(this, SecretKeyListActivity.class));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-06 19:54:51 +00:00
|
|
|
default: {
|
2010-05-15 16:09:49 +00:00
|
|
|
return super.onOptionsItemSelected(item);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
|
|
|
|
super.onCreateContextMenu(menu, v, menuInfo);
|
|
|
|
|
|
2010-05-13 20:41:32 +00:00
|
|
|
TextView nameTextView = (TextView) v.findViewById(R.id.accountName);
|
2010-04-06 19:54:51 +00:00
|
|
|
if (nameTextView != null) {
|
|
|
|
|
menu.setHeaderTitle(nameTextView.getText());
|
2010-05-13 20:41:32 +00:00
|
|
|
menu.add(0, Id.menu.delete, 0, R.string.menu_deleteAccount);
|
2010-04-06 19:54:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onContextItemSelected(MenuItem menuItem) {
|
|
|
|
|
AdapterView.AdapterContextMenuInfo info =
|
|
|
|
|
(AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
|
|
|
|
|
|
|
|
|
|
switch (menuItem.getItemId()) {
|
major restructuring, moving dialog, message, menu, option menu, task, type IDs into Id in a similar structure as the generated R, also introducing a BaseActivity class that almost all activities derive from, which generates some common dialogs, handles the progress update, thread management, and thread communication
also adding first draft of encrypt file activity, not very functional yet
2010-04-19 02:12:13 +00:00
|
|
|
case Id.menu.delete: {
|
2010-05-28 07:04:01 +00:00
|
|
|
Apg.getDatabase().db().delete(Accounts.TABLE_NAME,
|
|
|
|
|
Accounts._ID + " = ?",
|
|
|
|
|
new String[] { "" + info.id });
|
|
|
|
|
mAccountCursor.requery();
|
|
|
|
|
mListAdapter.notifyDataSetChanged();
|
2010-04-06 19:54:51 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default: {
|
|
|
|
|
return super.onContextItemSelected(menuItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-04-14 14:08:24 +00:00
|
|
|
private static class AccountListAdapter extends CursorAdapter {
|
2010-04-06 19:54:51 +00:00
|
|
|
private LayoutInflater minflater;
|
|
|
|
|
|
|
|
|
|
public AccountListAdapter(Context context, Cursor cursor) {
|
|
|
|
|
super(context, cursor);
|
|
|
|
|
minflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-28 07:04:01 +00:00
|
|
|
@Override
|
|
|
|
|
public Object getItem(int position) {
|
|
|
|
|
Cursor c = getCursor();
|
|
|
|
|
c.moveToPosition(position);
|
|
|
|
|
return c.getString(c.getColumnIndex(Accounts.NAME));
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-06 19:54:51 +00:00
|
|
|
@Override
|
|
|
|
|
public int getCount() {
|
|
|
|
|
return super.getCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
|
|
|
|
return minflater.inflate(R.layout.account_item, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void bindView(View view, Context context, Cursor cursor) {
|
2010-05-13 20:41:32 +00:00
|
|
|
TextView nameTextView = (TextView) view.findViewById(R.id.accountName);
|
2010-04-06 19:54:51 +00:00
|
|
|
int nameIndex = cursor.getColumnIndex(Accounts.NAME);
|
|
|
|
|
final String account = cursor.getString(nameIndex);
|
|
|
|
|
nameTextView.setText(account);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isEnabled(int position) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|