Clean up identity key view activity

pull/1/head
Moxie Marlinspike 11 years ago
parent 95eb62190a
commit 8c1ca6c9e0

@ -118,7 +118,6 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".ViewIdentityActivity"
android:theme="@style/Theme.Sherlock.Light.Dialog"
android:label="@string/AndroidManifest__public_identity_key"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
@ -135,12 +134,6 @@
android:label="@string/AndroidManifest__verify_identity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".SaveIdentityActivity"
android:theme="@style/Theme.Sherlock.Light.Dialog"
android:label="@string/AndroidManifest__save_identity"
android:windowSoftInputMode="stateVisible"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".ReviewIdentitiesActivity"
android:label="@string/AndroidManifest__manage_identity_keys"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
@ -153,11 +146,6 @@
<activity android:name=".ApplicationPreferencesActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".VerifyImportedIdentityActivity"
android:theme="@style/Theme.Sherlock.Light.Dialog"
android:label="@string/AndroidManifest__verify_imported_identity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".RegistrationActivity"
android:windowSoftInputMode="stateUnchanged"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

@ -1,51 +1,23 @@
<?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_marginLeft="16dip"
android:layout_marginRight="16dip">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1">
android:layout_height="fill_parent">
<TableRow>
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/view_identity_activity__identity"
android:layout_marginRight="7dip" />
<TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:id="@+id/identity_fingerprint"
android:text=""
android:padding="3dip" />
</TableRow>
<TableRow>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="2">
<Button android:id="@+id/compare_button"
android:layout_margin="10dip"
android:padding="5dip"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:text="@string/view_identity_activity__qr_code" />
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:layout_gravity="center"
android:orientation="vertical">
<Button android:id="@+id/ok_button"
android:layout_margin="10dip"
android:padding="5dip"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:text="@android:string/ok"/>
</LinearLayout>
</TableRow>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:id="@+id/identity_fingerprint"
android:text=""
android:padding="7dip" />
</TableLayout>
</ScrollView>
</LinearLayout>
</ScrollView>

@ -35,7 +35,8 @@
<string name="ApplicationPreferencesActivity_delete_all_old_messages_now">Delete all old messages now?</string>
<string name="ApplicationPreferencesActivity_are_you_sure_you_would_like_to_immediately_trim_all_conversation_threads_to_the_s_most_recent_messages">Are you sure you would like to immediately trim all conversation threads to the %s most recent messages?</string>
<string name="ApplicationPreferencesActivity_delete">Delete</string>
<string name="ApplicationPreferencesActivity_my">My</string>
<!-- AttachmentTypeSelectorAdapter -->
<string name="AttachmentTypeSelectorAdapter_picture">Picture</string>
@ -213,7 +214,8 @@
<string name="ViewIdentityActivity_not_verified_exclamation">NOT Verified!</string>
<string name="ViewIdentityActivity_the_scanned_key_matches_exclamation">The scanned key matches!</string>
<string name="ViewIdentityActivity_verified_exclamation">Verified!</string>
<string name="ViewIdentityActivity_identity_fingerprint">Identity Fingerprint</string>
<!-- KeyExchangeInitiator -->
<string name="KeyExchangeInitiator_initiate_despite_existing_request_question">Initiate Despite Existing Request?</string>
<string name="KeyExchangeInitiator_youve_already_sent_a_session_initiation_request_to_this_recipient_are_you_sure">You\'ve already sent a session initiation request to this recipient, are you sure you\'d like to send another? This will invalidate the first request.</string>

@ -118,7 +118,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
@Override
public void onDestroy() {
MemoryCleaner.clean((MasterSecret)getIntent().getParcelableExtra("master_secret"));
MemoryCleaner.clean((MasterSecret) getIntent().getParcelableExtra("master_secret"));
super.onDestroy();
}
@ -157,7 +157,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference pref, Object newValue) {
preference.setSummary(newValue == null ? "Not set" : ((String)newValue));
preference.setSummary(newValue == null ? "Not set" : ((String) newValue));
return true;
}
});
@ -218,6 +218,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
public boolean onPreferenceClick(Preference preference) {
Intent viewIdentityIntent = new Intent(ApplicationPreferencesActivity.this, ViewIdentityActivity.class);
viewIdentityIntent.putExtra("identity_key", IdentityKeyUtil.getIdentityKey(ApplicationPreferencesActivity.this));
viewIdentityIntent.putExtra("title", getString(R.string.ApplicationPreferencesActivity_my) + " " +
getString(R.string.ViewIdentityActivity_identity_fingerprint));
startActivity(viewIdentityIntent);
return true;

@ -92,6 +92,10 @@ public class IdentityKeyView extends RelativeLayout
return this.identityKey;
}
public Recipient getRecipient() {
return this.recipients.getPrimaryRecipient();
}
private boolean isBadgeEnabled() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}

@ -41,6 +41,8 @@ public class ReviewIdentitiesFragment extends SherlockListFragment
public void onListItemClick(ListView listView, View view, int position, long id) {
Intent viewIntent = new Intent(getActivity(), ViewIdentityActivity.class);
viewIntent.putExtra("identity_key", ((IdentityKeyView)view).getIdentityKey());
viewIntent.putExtra("title", ((IdentityKeyView)view).getRecipient().toShortString() + " " +
getString(R.string.ViewIdentityActivity_identity_fingerprint));
startActivity(viewIntent);
}

@ -17,8 +17,6 @@
package org.thoughtcrime.securesms;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.thoughtcrime.securesms.crypto.IdentityKey;
@ -30,18 +28,16 @@ import org.thoughtcrime.securesms.crypto.IdentityKey;
*/
public class ViewIdentityActivity extends KeyScanningActivity {
private TextView identityFingerprint;
private Button compareButton;
private Button okButton;
private TextView identityFingerprint;
private IdentityKey identityKey;
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.view_identity_activity);
initializeResources();
initializeListeners();
initializeFingerprint();
}
@ -53,27 +49,13 @@ public class ViewIdentityActivity extends KeyScanningActivity {
}
}
private void initializeListeners() {
this.okButton.setOnClickListener(new OkButtonListener());
this.compareButton.setOnClickListener(new CompareListener());
}
private void initializeResources() {
this.identityKey = (IdentityKey)getIntent().getParcelableExtra("identity_key");
this.identityFingerprint = (TextView)findViewById(R.id.identity_fingerprint);
this.okButton = (Button)findViewById(R.id.ok_button);
this.compareButton = (Button)findViewById(R.id.compare_button);
}
private class CompareListener implements View.OnClickListener {
public void onClick(View v) {
initiateDisplay();
}
}
String title = getIntent().getStringExtra("title");
private class OkButtonListener implements View.OnClickListener {
public void onClick(View v) {
finish();
if (title != null) {
getSupportActionBar().setTitle(getIntent().getStringExtra("title"));
}
}

Loading…
Cancel
Save