mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Remove key exchange indicator from list view, spruce up create passphrase dialog.
This commit is contained in:
parent
bc8f26c591
commit
31d59dddef
@ -15,7 +15,7 @@
|
|||||||
<view xmlns:android="http://schemas.android.com/apk/res/android"
|
<view xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
class="org.thoughtcrime.securesms.components.ImageDivet"
|
class="org.thoughtcrime.securesms.components.ImageDivet"
|
||||||
position="right"
|
position="right"
|
||||||
android:id="@id/contact_photo"
|
android:id="@+id/contact_photo"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
|
@ -10,13 +10,6 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentLeft="true" />
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
<ImageView android:id="@+id/key_indicator"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:src="@drawable/key_exchange_indicator" />
|
|
||||||
|
|
||||||
<CheckBox android:id="@+id/checkbox"
|
<CheckBox android:id="@+id/checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
@ -5,58 +5,70 @@
|
|||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/LinearLayout"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:paddingLeft="16dip"
|
||||||
android:padding="8px"
|
android:paddingRight="16dip"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView android:text="Please enter a passphrase that will be used to locally encrypt your data. This should be a strong passphrase."
|
<TextView android:text="Please choose a passphrase that will be used to locally encrypt your data. This should be a strong passphrase."
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:id="@+id/create_pass_label"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="10dip"
|
||||||
android:layout_margin="10dip"/>
|
android:layout_marginBottom="10dip"/>
|
||||||
|
|
||||||
<EditText android:id="@+id/passphrase_edit"
|
<TextView android:text="Passphrase:"
|
||||||
android:layout_height="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:password="true"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dip"/>
|
android:layout_margin="5dip"/>
|
||||||
|
|
||||||
<TextView
|
<EditText android:id="@+id/passphrase_edit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:id="@+id/repeat_label"
|
android:password="true"/>
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_margin="10dip"
|
|
||||||
android:text="Repeat:"></TextView>
|
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:password="true"
|
android:id="@+id/repeat_label"
|
||||||
android:layout_margin="10dip"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:id="@+id/passphrase_edit_repeat"></EditText>
|
android:layout_marginBottom="5dip"
|
||||||
|
android:layout_marginTop="10dip"
|
||||||
|
android:text="Repeat:"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<EditText
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:id="@+id/RelativeLayout"
|
android:password="true"
|
||||||
>
|
android:id="@+id/passphrase_edit_repeat"/>
|
||||||
<Button android:layout_width="100dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/cancel_button" android:text="Cancel"
|
|
||||||
android:layout_below="@id/passphrase_edit_repeat"
|
|
||||||
android:layout_alignParentRight="true"></Button>
|
|
||||||
|
|
||||||
<Button android:layout_below="@id/passphrase_edit_repeat"
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
android:layout_width="100dip"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="horizontal"
|
||||||
android:text="Ok" android:id="@+id/ok_button"
|
android:layout_marginBottom="16dip"
|
||||||
android:layout_toLeftOf="@id/cancel_button"></Button>
|
android:gravity="right">
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<TableLayout android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:stretchColumns="*">
|
||||||
|
<TableRow>
|
||||||
|
<Button android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="Cancel"
|
||||||
|
android:id="@+id/cancel_button"
|
||||||
|
android:layout_marginRight="15dip"
|
||||||
|
android:layout_marginLeft="16dip"/>
|
||||||
|
|
||||||
|
<Button android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="OK"
|
||||||
|
android:id="@+id/ok_button"
|
||||||
|
android:layout_marginRight="16dip"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -54,7 +54,6 @@ public class ConversationListItem extends RelativeLayout {
|
|||||||
private TextView subjectView;
|
private TextView subjectView;
|
||||||
private TextView fromView;
|
private TextView fromView;
|
||||||
private TextView dateView;
|
private TextView dateView;
|
||||||
private View keyIndicator;
|
|
||||||
private CheckBox checkbox;
|
private CheckBox checkbox;
|
||||||
private QuickContactBadge contactPhoto;
|
private QuickContactBadge contactPhoto;
|
||||||
|
|
||||||
@ -69,13 +68,12 @@ public class ConversationListItem extends RelativeLayout {
|
|||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
LayoutInflater li = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater li = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
li.inflate(R.layout.conversation_header_view, this, true);
|
li.inflate(R.layout.conversation_list_item_view, this, true);
|
||||||
|
|
||||||
this.selectedThreads = selectedThreads;
|
this.selectedThreads = selectedThreads;
|
||||||
this.subjectView = (TextView)findViewById(R.id.subject);
|
this.subjectView = (TextView)findViewById(R.id.subject);
|
||||||
this.fromView = (TextView)findViewById(R.id.from);
|
this.fromView = (TextView)findViewById(R.id.from);
|
||||||
this.dateView = (TextView)findViewById(R.id.date);
|
this.dateView = (TextView)findViewById(R.id.date);
|
||||||
this.keyIndicator = findViewById(R.id.key_indicator);
|
|
||||||
this.contactPhoto = (QuickContactBadge)findViewById(R.id.contact_photo);
|
this.contactPhoto = (QuickContactBadge)findViewById(R.id.contact_photo);
|
||||||
this.checkbox = (CheckBox)findViewById(R.id.checkbox);
|
this.checkbox = (CheckBox)findViewById(R.id.checkbox);
|
||||||
|
|
||||||
@ -105,9 +103,6 @@ public class ConversationListItem extends RelativeLayout {
|
|||||||
if (selectedThreads != null)
|
if (selectedThreads != null)
|
||||||
this.checkbox.setChecked(selectedThreads.contains(threadId));
|
this.checkbox.setChecked(selectedThreads.contains(threadId));
|
||||||
|
|
||||||
clearIndicators();
|
|
||||||
setIndicators(message.isKeyExchange());
|
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
if (batchMode) checkbox.setVisibility(View.VISIBLE);
|
if (batchMode) checkbox.setVisibility(View.VISIBLE);
|
||||||
else checkbox.setVisibility(View.GONE);
|
else checkbox.setVisibility(View.GONE);
|
||||||
@ -122,14 +117,6 @@ public class ConversationListItem extends RelativeLayout {
|
|||||||
checkbox.setOnCheckedChangeListener(new CheckedChangedListener());
|
checkbox.setOnCheckedChangeListener(new CheckedChangedListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearIndicators() {
|
|
||||||
this.keyIndicator.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setIndicators(boolean key) {
|
|
||||||
if (key) this.keyIndicator.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CharSequence formatFrom(Recipients from, long count, boolean read) {
|
private CharSequence formatFrom(Recipients from, long count, boolean read) {
|
||||||
SpannableStringBuilder builder = new SpannableStringBuilder(from.toShortString());
|
SpannableStringBuilder builder = new SpannableStringBuilder(from.toShortString());
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2011 Whisper Systems
|
* Copyright (C) 2011 Whisper Systems
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -10,31 +10,30 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity for creating a user's local encryption passphrase.
|
* Activity for creating a user's local encryption passphrase.
|
||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
public class PassphraseCreateActivity extends PassphraseActivity {
|
public class PassphraseCreateActivity extends PassphraseActivity {
|
||||||
@ -43,32 +42,32 @@ public class PassphraseCreateActivity extends PassphraseActivity {
|
|||||||
private EditText passphraseRepeatEdit;
|
private EditText passphraseRepeatEdit;
|
||||||
private Button okButton;
|
private Button okButton;
|
||||||
private Button cancelButton;
|
private Button cancelButton;
|
||||||
|
|
||||||
public PassphraseCreateActivity() { }
|
public PassphraseCreateActivity() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
|
||||||
setContentView(R.layout.create_passphrase_activity);
|
setContentView(R.layout.create_passphrase_activity);
|
||||||
|
|
||||||
initializeResources();
|
initializeResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
this.passphraseEdit = (EditText) findViewById(R.id.passphrase_edit);
|
this.passphraseEdit = (EditText) findViewById(R.id.passphrase_edit);
|
||||||
this.passphraseRepeatEdit = (EditText) findViewById(R.id.passphrase_edit_repeat);
|
this.passphraseRepeatEdit = (EditText) findViewById(R.id.passphrase_edit_repeat);
|
||||||
this.okButton = (Button) findViewById(R.id.ok_button);
|
this.okButton = (Button) findViewById(R.id.ok_button);
|
||||||
this.cancelButton = (Button) findViewById(R.id.cancel_button);
|
this.cancelButton = (Button) findViewById(R.id.cancel_button);
|
||||||
|
|
||||||
this.okButton.setOnClickListener(new OkButtonClickListener());
|
this.okButton.setOnClickListener(new OkButtonClickListener());
|
||||||
this.cancelButton.setOnClickListener(new CancelButtonClickListener());
|
this.cancelButton.setOnClickListener(new CancelButtonClickListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyAndSavePassphrases() {
|
private void verifyAndSavePassphrases() {
|
||||||
String passphrase = this.passphraseEdit.getText().toString();
|
String passphrase = this.passphraseEdit.getText().toString();
|
||||||
String passphraseRepeat = this.passphraseRepeatEdit.getText().toString();
|
String passphraseRepeat = this.passphraseRepeatEdit.getText().toString();
|
||||||
|
|
||||||
if (!passphrase.equals(passphraseRepeat)) {
|
if (!passphrase.equals(passphraseRepeat)) {
|
||||||
Toast.makeText(getApplicationContext(), "Passphrases Don't Match!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "Passphrases Don't Match!", Toast.LENGTH_SHORT).show();
|
||||||
this.passphraseEdit.setText("");
|
this.passphraseEdit.setText("");
|
||||||
@ -80,21 +79,21 @@ public class PassphraseCreateActivity extends PassphraseActivity {
|
|||||||
new AsymmetricSecretGenerator(masterSecret).generate();
|
new AsymmetricSecretGenerator(masterSecret).generate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AsymmetricSecretGenerator extends Handler implements Runnable {
|
private class AsymmetricSecretGenerator extends Handler implements Runnable {
|
||||||
private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
|
||||||
public AsymmetricSecretGenerator(MasterSecret masterSecret) {
|
public AsymmetricSecretGenerator(MasterSecret masterSecret) {
|
||||||
this.masterSecret = masterSecret;
|
this.masterSecret = masterSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
MasterSecretUtil.generateAsymmetricMasterSecret(PassphraseCreateActivity.this, masterSecret);
|
MasterSecretUtil.generateAsymmetricMasterSecret(PassphraseCreateActivity.this, masterSecret);
|
||||||
IdentityKeyUtil.generateIdentityKeys(PassphraseCreateActivity.this, masterSecret);
|
IdentityKeyUtil.generateIdentityKeys(PassphraseCreateActivity.this, masterSecret);
|
||||||
this.obtainMessage().sendToTarget();
|
this.obtainMessage().sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate() {
|
public void generate() {
|
||||||
progressDialog = new ProgressDialog(PassphraseCreateActivity.this);
|
progressDialog = new ProgressDialog(PassphraseCreateActivity.this);
|
||||||
progressDialog.setTitle("Generating KeyPair");
|
progressDialog.setTitle("Generating KeyPair");
|
||||||
@ -103,22 +102,22 @@ public class PassphraseCreateActivity extends PassphraseActivity {
|
|||||||
progressDialog.setIndeterminate(true);
|
progressDialog.setIndeterminate(true);
|
||||||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
new Thread(this).start();
|
new Thread(this).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
setMasterSecret(masterSecret);
|
setMasterSecret(masterSecret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CancelButtonClickListener implements OnClickListener {
|
private class CancelButtonClickListener implements OnClickListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OkButtonClickListener implements OnClickListener {
|
private class OkButtonClickListener implements OnClickListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
verifyAndSavePassphrases();
|
verifyAndSavePassphrases();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user