kopia lustrzana https://github.com/ryukoposting/Signal-Android
				
				
				
			Fix review identity activity UI.
							rodzic
							
								
									a1b077c349
								
							
						
					
					
						commit
						a66cc636c6
					
				| 
						 | 
				
			
			@ -73,12 +73,15 @@
 | 
			
		|||
              android:windowSoftInputMode="stateVisible"
 | 
			
		||||
              android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
 | 
			
		||||
 | 
			
		||||
    <activity android:name=".ReviewIdentitiesActivity"
 | 
			
		||||
              android:label="Manage Identity Keys"
 | 
			
		||||
              android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
 | 
			
		||||
 | 
			
		||||
    <activity android:name=".ApplicationPreferencesActivity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
    <activity android:name=".PassphraseCreateActivity" android:theme="@android:style/Theme.Dialog" android:label="Create Passphrase" android:launchMode="singleInstance" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
    <activity android:name=".SendKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Initiate Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
    <activity android:name=".ReceiveKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Complete Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
    <activity android:name=".VerifyImportedIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Verify Imported Identity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
    <activity android:name=".ReviewIdentitiesActivity" android:theme="@android:style/Theme.Dialog" android:label="Manage Identity Keys (Long click)" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
 | 
			
		||||
 | 
			
		||||
    <service android:enabled="true" android:name=".service.KeyCachingService"></service>
 | 
			
		||||
    <service android:enabled="true" android:name=".service.SendReceiveService"></service>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,35 +3,18 @@
 | 
			
		|||
    android:layout_width="fill_parent"
 | 
			
		||||
    android:layout_height="?android:attr/listPreferredItemHeight"
 | 
			
		||||
    android:orientation="horizontal"
 | 
			
		||||
    android:paddingRight="10dip">
 | 
			
		||||
    android:padding="15dip">
 | 
			
		||||
 | 
			
		||||
	<TextView android:id="@+id/identity_name"
 | 
			
		||||
			  android:layout_width="wrap_content"
 | 
			
		||||
			  android:layout_height="wrap_content"
 | 
			
		||||
	          android:textAppearance="?android:attr/textAppearanceMedium"
 | 
			
		||||
	          android:singleLine="true"
 | 
			
		||||
	          android:layout_marginTop="6dip"
 | 
			
		||||
	          android:layout_marginRight="5dip"
 | 
			
		||||
	          android:layout_marginLeft="5dip"
 | 
			
		||||
	          android:ellipsize="marquee"  
 | 
			
		||||
	          android:layout_alignParentLeft="true"
 | 
			
		||||
	          android:layout_centerVertical="true" />
 | 
			
		||||
        
 | 
			
		||||
	<ImageView android:id="@+id/valid_indicator"
 | 
			
		||||
			   android:layout_width="wrap_content"
 | 
			
		||||
			   android:layout_height="wrap_content"
 | 
			
		||||
			   android:src="@drawable/valid"
 | 
			
		||||
			   android:visibility="gone"
 | 
			
		||||
			   android:layout_alignParentRight="true"
 | 
			
		||||
			   android:layout_centerVertical="true" />
 | 
			
		||||
 | 
			
		||||
	<ImageView android:id="@+id/invalid_indicator"
 | 
			
		||||
			   android:layout_width="wrap_content"
 | 
			
		||||
			   android:layout_height="wrap_content"
 | 
			
		||||
			   android:src="@drawable/invalid"
 | 
			
		||||
			   android:visibility="gone" 
 | 
			
		||||
			   android:layout_alignParentRight="true"
 | 
			
		||||
			   android:layout_centerVertical="true" />
 | 
			
		||||
    <TextView android:id="@+id/identity_name"
 | 
			
		||||
              android:layout_width="wrap_content"
 | 
			
		||||
              android:layout_height="wrap_content"
 | 
			
		||||
              android:textAppearance="?android:attr/textAppearanceMedium"
 | 
			
		||||
              android:singleLine="true"
 | 
			
		||||
              android:layout_marginTop="6dip"
 | 
			
		||||
              android:layout_marginRight="5dip"
 | 
			
		||||
              android:layout_marginLeft="5dip"
 | 
			
		||||
              android:ellipsize="marquee"
 | 
			
		||||
              android:layout_alignParentLeft="true"
 | 
			
		||||
              android:layout_centerVertical="true" />
 | 
			
		||||
 | 
			
		||||
</org.thoughtcrime.securesms.IdentityKeyView>
 | 
			
		||||
         
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +1,24 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
 | 
			
		||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
		android:layout_width="fill_parent"
 | 
			
		||||
		android:layout_height="fill_parent"
 | 
			
		||||
		android:orientation="vertical">
 | 
			
		||||
        android:layout_width="fill_parent"
 | 
			
		||||
        android:layout_height="fill_parent"
 | 
			
		||||
        android:orientation="vertical"
 | 
			
		||||
        android:paddingLeft="16dip"
 | 
			
		||||
        android:paddingRight="16dip">
 | 
			
		||||
 | 
			
		||||
		<ListView android:id="@android:id/list" 
 | 
			
		||||
    		android:layout_width="fill_parent"
 | 
			
		||||
    		android:layout_height="fill_parent"
 | 
			
		||||
    		android:drawSelectorOnTop="false"
 | 
			
		||||
    		android:scrollbarStyle="insideOverlay"
 | 
			
		||||
    		android:fadingEdgeLength="16dip" />
 | 
			
		||||
    		
 | 
			
		||||
		<TextView android:id="@id/android:empty"
 | 
			
		||||
				  android:layout_width="wrap_content"
 | 
			
		||||
				  android:layout_height="wrap_content" 
 | 
			
		||||
				  android:text="You don't currently have any identity keys in your trust database."
 | 
			
		||||
				  android:textAppearance="?android:attr/textAppearanceMedium"
 | 
			
		||||
				  android:padding="10dip" />
 | 
			
		||||
        <ListView android:id="@android:id/list"
 | 
			
		||||
            android:layout_width="fill_parent"
 | 
			
		||||
            android:layout_height="fill_parent"
 | 
			
		||||
            android:drawSelectorOnTop="false"
 | 
			
		||||
            android:scrollbarStyle="insideOverlay"
 | 
			
		||||
            android:fadingEdgeLength="16dip" />
 | 
			
		||||
 | 
			
		||||
        <TextView android:id="@id/android:empty"
 | 
			
		||||
                  android:layout_width="wrap_content"
 | 
			
		||||
                  android:layout_height="wrap_content"
 | 
			
		||||
                  android:text="You don't currently have any identity keys in your trust database."
 | 
			
		||||
                  android:textAppearance="?android:attr/textAppearanceMedium"
 | 
			
		||||
                  android:padding="20dip" />
 | 
			
		||||
 | 
			
		||||
 </LinearLayout>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +1,9 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
            android:layout_width="fill_parent"
 | 
			
		||||
            android:layout_height="fill_parent">
 | 
			
		||||
            android:layout_height="fill_parent"
 | 
			
		||||
            android:layout_marginLeft="16dip"
 | 
			
		||||
            android:layout_marginRight="16dip">
 | 
			
		||||
<TableLayout
 | 
			
		||||
    android:layout_width="fill_parent"
 | 
			
		||||
    android:layout_height="fill_parent"
 | 
			
		||||
| 
						 | 
				
			
			@ -9,12 +11,12 @@
 | 
			
		|||
 | 
			
		||||
    <TableRow>
 | 
			
		||||
        <TextView
 | 
			
		||||
            android:textSize="12sp"
 | 
			
		||||
            android:text="Your identity:"
 | 
			
		||||
            android:padding="3dip" />
 | 
			
		||||
            android:textAppearance="?android:attr/textAppearanceMedium"
 | 
			
		||||
            android:text="Identity:"
 | 
			
		||||
            android:layout_marginRight="7dip" />
 | 
			
		||||
        <TextView
 | 
			
		||||
               android:textSize="20sp"
 | 
			
		||||
               android:typeface="monospace"
 | 
			
		||||
            android:textAppearance="?android:attr/textAppearanceLarge"
 | 
			
		||||
            android:typeface="monospace"
 | 
			
		||||
            android:id="@+id/identity_fingerprint"
 | 
			
		||||
            android:text=""
 | 
			
		||||
            android:padding="3dip" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/** 
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (C) 2011 Whisper Systems
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
| 
						 | 
				
			
			@ -10,7 +10,7 @@
 | 
			
		|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -19,45 +19,43 @@ package org.thoughtcrime.securesms;
 | 
			
		|||
import android.content.Context;
 | 
			
		||||
import android.util.AttributeSet;
 | 
			
		||||
import android.view.LayoutInflater;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.ImageView;
 | 
			
		||||
import android.widget.RelativeLayout;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Activity for displaying user identity keys.
 | 
			
		||||
 * 
 | 
			
		||||
 * List item view for displaying user identity keys.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Moxie Marlinspike
 | 
			
		||||
 */
 | 
			
		||||
public class IdentityKeyView extends RelativeLayout {
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  private TextView identityName;
 | 
			
		||||
  private ImageView validImage;
 | 
			
		||||
  private ImageView invalidImage;
 | 
			
		||||
	
 | 
			
		||||
  private String   identityKeyString;
 | 
			
		||||
 | 
			
		||||
  public IdentityKeyView(Context context) {
 | 
			
		||||
    super(context);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    LayoutInflater li = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 | 
			
		||||
    li.inflate(R.layout.identity_key_view, this, true);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    initializeResources();
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  public IdentityKeyView(Context context, AttributeSet attributeSet) {
 | 
			
		||||
    super(context, attributeSet);
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
  public void set(String name, boolean valid) {
 | 
			
		||||
 | 
			
		||||
  public void set(String name, String identityKeyString) {
 | 
			
		||||
    identityName.setText(name);
 | 
			
		||||
    validImage.setVisibility(valid ? View.VISIBLE : View.GONE);
 | 
			
		||||
    invalidImage.setVisibility(valid ? View.GONE : View.VISIBLE);
 | 
			
		||||
    this.identityKeyString = identityKeyString;
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  public String getIdentityKeyString() {
 | 
			
		||||
    return this.identityKeyString;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private void initializeResources() {
 | 
			
		||||
    this.identityName = (TextView)findViewById(R.id.identity_name);
 | 
			
		||||
    this.validImage   = (ImageView)findViewById(R.id.valid_indicator);
 | 
			
		||||
    this.invalidImage = (ImageView)findViewById(R.id.invalid_indicator);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/** 
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright (C) 2011 Whisper Systems
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
| 
						 | 
				
			
			@ -10,13 +10,30 @@
 | 
			
		|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
package org.thoughtcrime.securesms;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import android.app.AlertDialog;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.DialogInterface;
 | 
			
		||||
import android.content.DialogInterface.OnClickListener;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.database.Cursor;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.util.Log;
 | 
			
		||||
import android.view.ContextMenu;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import android.widget.CursorAdapter;
 | 
			
		||||
import android.widget.ListView;
 | 
			
		||||
import android.widget.Toast;
 | 
			
		||||
 | 
			
		||||
import com.actionbarsherlock.app.SherlockListActivity;
 | 
			
		||||
import com.actionbarsherlock.view.Menu;
 | 
			
		||||
import com.actionbarsherlock.view.MenuItem;
 | 
			
		||||
 | 
			
		||||
import org.thoughtcrime.securesms.crypto.IdentityKey;
 | 
			
		||||
import org.thoughtcrime.securesms.crypto.InvalidKeyException;
 | 
			
		||||
| 
						 | 
				
			
			@ -27,45 +44,30 @@ import org.thoughtcrime.securesms.database.IdentityDatabase;
 | 
			
		|||
import org.thoughtcrime.securesms.util.Base64;
 | 
			
		||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
 | 
			
		||||
 | 
			
		||||
import android.app.AlertDialog;
 | 
			
		||||
import android.app.ListActivity;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.DialogInterface;
 | 
			
		||||
import android.content.DialogInterface.OnClickListener;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.database.Cursor;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.util.Log;
 | 
			
		||||
import android.view.ContextMenu;
 | 
			
		||||
import android.view.Menu;
 | 
			
		||||
import android.view.MenuItem;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import android.widget.CursorAdapter;
 | 
			
		||||
import android.widget.Toast;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Activity for reviewing/managing saved identity keys.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author Moxie Marlinspike
 | 
			
		||||
 */
 | 
			
		||||
public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		||||
public class ReviewIdentitiesActivity extends SherlockListActivity {
 | 
			
		||||
 | 
			
		||||
  private static final int MENU_OPTION_VIEW = 1;
 | 
			
		||||
  private static final int MENU_OPTION_DELETE = 2;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  private MasterSecret masterSecret;
 | 
			
		||||
  private MasterCipher masterCipher;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
    super.onCreate(savedInstanceState);        
 | 
			
		||||
    super.onCreate(savedInstanceState);
 | 
			
		||||
    this.setContentView(R.layout.review_identities);
 | 
			
		||||
                
 | 
			
		||||
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 | 
			
		||||
 | 
			
		||||
    initializeResources();
 | 
			
		||||
    registerForContextMenu(this.getListView());
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  protected void onDestroy() {
 | 
			
		||||
    masterCipher = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,36 +75,46 @@ public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		|||
    MemoryCleaner.clean(masterSecret);
 | 
			
		||||
    super.onDestroy();
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onListItemClick(ListView listView, View view, int position, long id) {
 | 
			
		||||
    viewIdentity(((IdentityKeyView)view).getIdentityKeyString());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
 | 
			
		||||
    menu.add(0, MENU_OPTION_VIEW, Menu.NONE, "View Key");
 | 
			
		||||
    menu.add(0, MENU_OPTION_DELETE, Menu.NONE, "Delete");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public boolean onContextItemSelected(MenuItem item) {
 | 
			
		||||
  public boolean onContextItemSelected(android.view.MenuItem item) {
 | 
			
		||||
    Cursor cursor            = ((CursorAdapter)this.getListAdapter()).getCursor();
 | 
			
		||||
    String identityKeyString = cursor.getString(cursor.getColumnIndexOrThrow(IdentityDatabase.IDENTITY_KEY));
 | 
			
		||||
    String identityName      = cursor.getString(cursor.getColumnIndexOrThrow(IdentityDatabase.IDENTITY_NAME));
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    switch(item.getItemId()) {
 | 
			
		||||
    case MENU_OPTION_DELETE:
 | 
			
		||||
      deleteIdentity(identityName, identityKeyString);
 | 
			
		||||
      return true;
 | 
			
		||||
    case MENU_OPTION_VIEW:
 | 
			
		||||
      viewIdentity(identityKeyString);
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
  @Override
 | 
			
		||||
  public boolean onOptionsItemSelected(MenuItem item) {
 | 
			
		||||
    switch (item.getItemId()) {
 | 
			
		||||
    case android.R.id.home: finish(); return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  private void initializeResources() {
 | 
			
		||||
    this.masterSecret = (MasterSecret)getIntent().getParcelableExtra("master_secret");
 | 
			
		||||
    this.masterCipher = new MasterCipher(masterSecret);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    Cursor cursor = DatabaseFactory.getIdentityDatabase(this).getIdentities();
 | 
			
		||||
    this.startManagingCursor(cursor);
 | 
			
		||||
    this.setListAdapter(new IdentitiesListAdapter(this, cursor));
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +133,7 @@ public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		|||
      Toast.makeText(this, "Unable to view corrupted identity key!", Toast.LENGTH_LONG).show();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  private void deleteIdentity(String name, String keyString) {
 | 
			
		||||
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
 | 
			
		||||
    alertDialog.setTitle("Delete identity?");
 | 
			
		||||
| 
						 | 
				
			
			@ -131,23 +143,24 @@ public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		|||
    alertDialog.setPositiveButton(R.string.yes, new DeleteIdentityListener(name, keyString));
 | 
			
		||||
    alertDialog.show();
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  private class DeleteIdentityListener implements OnClickListener {
 | 
			
		||||
    private final String name;
 | 
			
		||||
    private final String keyString;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    public DeleteIdentityListener(String name, String keyString) {
 | 
			
		||||
      this.name      = name;
 | 
			
		||||
      this.keyString = keyString;
 | 
			
		||||
    }
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    public void onClick(DialogInterface arg0, int arg1) {
 | 
			
		||||
      DatabaseFactory.getIdentityDatabase(ReviewIdentitiesActivity.this).deleteIdentity(name, keyString);
 | 
			
		||||
      DatabaseFactory.getIdentityDatabase(ReviewIdentitiesActivity.this)
 | 
			
		||||
        .deleteIdentity(name, keyString);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
  private class IdentitiesListAdapter extends CursorAdapter {
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
    public IdentitiesListAdapter(Context context, Cursor cursor) {
 | 
			
		||||
      super(context, cursor);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -160,13 +173,13 @@ public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		|||
    public void bindView(View view, Context context, Cursor cursor) {
 | 
			
		||||
      IdentityKey identityKey;
 | 
			
		||||
      boolean valid;
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
      String identityKeyString = cursor.getString(cursor.getColumnIndexOrThrow(IdentityDatabase.IDENTITY_KEY));
 | 
			
		||||
      String identityName   	 = cursor.getString(cursor.getColumnIndexOrThrow(IdentityDatabase.IDENTITY_NAME));
 | 
			
		||||
 | 
			
		||||
      try {	
 | 
			
		||||
      try {
 | 
			
		||||
        String mac             = cursor.getString(cursor.getColumnIndexOrThrow(IdentityDatabase.MAC));
 | 
			
		||||
        valid              	   = masterCipher.verifyMacFor(identityName + identityKeyString, Base64.decode(mac));			
 | 
			
		||||
        valid              	   = masterCipher.verifyMacFor(identityName + identityKeyString, Base64.decode(mac));
 | 
			
		||||
        identityKey            = new IdentityKey(Base64.decode(identityKeyString), 0);
 | 
			
		||||
      } catch (InvalidKeyException ike) {
 | 
			
		||||
        Log.w("ReviewIdentitiesActivity",ike);
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +189,10 @@ public class ReviewIdentitiesActivity extends ListActivity {
 | 
			
		|||
        valid = false;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ((IdentityKeyView)view).set(identityName, valid);
 | 
			
		||||
      if (!valid)
 | 
			
		||||
        identityName = "Invalid Identity!";
 | 
			
		||||
 | 
			
		||||
      ((IdentityKeyView)view).set(identityName, identityKeyString);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue