BIN
res/drawable-hdpi/ic_visibility_grey600_24dp.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
res/drawable-hdpi/ic_visibility_off_grey600_24dp.png
Normal file
After Width: | Height: | Size: 560 B |
BIN
res/drawable-hdpi/ic_visibility_off_white_24dp.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
res/drawable-hdpi/ic_visibility_white_24dp.png
Normal file
After Width: | Height: | Size: 472 B |
BIN
res/drawable-mdpi/ic_visibility_grey600_24dp.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
res/drawable-mdpi/ic_visibility_off_grey600_24dp.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
res/drawable-mdpi/ic_visibility_off_white_24dp.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
res/drawable-mdpi/ic_visibility_white_24dp.png
Normal file
After Width: | Height: | Size: 310 B |
BIN
res/drawable-xhdpi/ic_visibility_grey600_24dp.png
Normal file
After Width: | Height: | Size: 458 B |
BIN
res/drawable-xhdpi/ic_visibility_off_grey600_24dp.png
Normal file
After Width: | Height: | Size: 706 B |
BIN
res/drawable-xhdpi/ic_visibility_off_white_24dp.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
res/drawable-xhdpi/ic_visibility_white_24dp.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
res/drawable-xxhdpi/ic_visibility_grey600_24dp.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
res/drawable-xxhdpi/ic_visibility_off_grey600_24dp.png
Normal file
After Width: | Height: | Size: 1019 B |
BIN
res/drawable-xxhdpi/ic_visibility_off_white_24dp.png
Normal file
After Width: | Height: | Size: 919 B |
BIN
res/drawable-xxhdpi/ic_visibility_white_24dp.png
Normal file
After Width: | Height: | Size: 846 B |
@ -32,7 +32,40 @@
|
|||||||
android:layout_marginRight="50dp"
|
android:layout_marginRight="50dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"/>
|
android:paddingRight="40dp"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.AnimatingToggle
|
||||||
|
android:id="@+id/button_toggle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignRight="@+id/passphrase_edit"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<ImageButton android:id="@+id/passphrase_visibility"
|
||||||
|
android:src="?ic_visibility"
|
||||||
|
android:background="@drawable/touch_highlight_background"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
<ImageButton android:id="@+id/passphrase_visibility_off"
|
||||||
|
android:src="?ic_visibility_off"
|
||||||
|
android:background="@drawable/touch_highlight_background"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
</org.thoughtcrime.securesms.components.AnimatingToggle>
|
||||||
|
|
||||||
<ImageButton android:id="@+id/ok_button"
|
<ImageButton android:id="@+id/ok_button"
|
||||||
android:src="?ic_arrow_forward"
|
android:src="?ic_arrow_forward"
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
<attr name="centered_app_title_color" format="reference|color" />
|
<attr name="centered_app_title_color" format="reference|color" />
|
||||||
<attr name="ic_arrow_forward" format="reference" />
|
<attr name="ic_arrow_forward" format="reference" />
|
||||||
|
<attr name="ic_visibility" format="reference" />
|
||||||
|
<attr name="ic_visibility_off" format="reference" />
|
||||||
|
|
||||||
<attr name="conversation_background" format="reference|color"/>
|
<attr name="conversation_background" format="reference|color"/>
|
||||||
<attr name="conversation_editor_background" format="reference|color"/>
|
<attr name="conversation_editor_background" format="reference|color"/>
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
<item name="centered_app_title_color">#55000000</item>
|
<item name="centered_app_title_color">#55000000</item>
|
||||||
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_light</item>
|
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_light</item>
|
||||||
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_light</item>
|
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_light</item>
|
||||||
|
<item name="ic_visibility">@drawable/ic_visibility_grey600_24dp</item>
|
||||||
|
<item name="ic_visibility_off">@drawable/ic_visibility_off_grey600_24dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextSecure.DarkIntroTheme" parent="@style/Theme.AppCompat">
|
<style name="TextSecure.DarkIntroTheme" parent="@style/Theme.AppCompat">
|
||||||
@ -57,6 +59,8 @@
|
|||||||
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_dark</item>
|
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_dark</item>
|
||||||
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_dark</item>
|
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_dark</item>
|
||||||
<item name="android:windowBackground">@color/black</item>
|
<item name="android:windowBackground">@color/black</item>
|
||||||
|
<item name="ic_visibility">@drawable/ic_visibility_white_24dp</item>
|
||||||
|
<item name="ic_visibility_off">@drawable/ic_visibility_off_white_24dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="PopupAnimation" parent="@android:style/Animation">
|
<style name="PopupAnimation" parent="@android:style/Animation">
|
||||||
|
@ -20,6 +20,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
@ -36,6 +37,7 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.components.AnimatingToggle;
|
||||||
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||||
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
|
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
|
||||||
@ -53,6 +55,9 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||||
|
|
||||||
private EditText passphraseText;
|
private EditText passphraseText;
|
||||||
|
private ImageButton showButton;
|
||||||
|
private ImageButton hideButton;
|
||||||
|
private AnimatingToggle visibilityToggle;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -116,11 +121,27 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPassphraseVisibility(boolean visibility) {
|
||||||
|
int cursorPosition = passphraseText.getSelectionStart();
|
||||||
|
if (visibility) {
|
||||||
|
passphraseText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||||
|
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||||
|
} else {
|
||||||
|
passphraseText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||||
|
InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
|
}
|
||||||
|
passphraseText.setSelection(cursorPosition);
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
getSupportActionBar().setCustomView(R.layout.centered_app_title);
|
getSupportActionBar().setCustomView(R.layout.centered_app_title);
|
||||||
|
|
||||||
ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
|
ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
|
||||||
|
|
||||||
|
showButton = (ImageButton) findViewById(R.id.passphrase_visibility);
|
||||||
|
hideButton = (ImageButton) findViewById(R.id.passphrase_visibility_off);
|
||||||
|
visibilityToggle = (AnimatingToggle) findViewById(R.id.button_toggle);
|
||||||
passphraseText = (EditText) findViewById(R.id.passphrase_edit);
|
passphraseText = (EditText) findViewById(R.id.passphrase_edit);
|
||||||
SpannableString hint = new SpannableString(" " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
|
SpannableString hint = new SpannableString(" " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
|
||||||
hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||||
@ -128,6 +149,8 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
|
|
||||||
passphraseText.setHint(hint);
|
passphraseText.setHint(hint);
|
||||||
okButton.setOnClickListener(new OkButtonClickListener());
|
okButton.setOnClickListener(new OkButtonClickListener());
|
||||||
|
showButton.setOnClickListener(new ShowButtonOnClickListener());
|
||||||
|
hideButton.setOnClickListener(new HideButtonOnClickListener());
|
||||||
passphraseText.setOnEditorActionListener(new PassphraseActionListener());
|
passphraseText.setOnEditorActionListener(new PassphraseActionListener());
|
||||||
passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
|
passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
|
||||||
EditorInfo.IME_ACTION_DONE);
|
EditorInfo.IME_ACTION_DONE);
|
||||||
@ -159,6 +182,22 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ShowButtonOnClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
visibilityToggle.display(hideButton);
|
||||||
|
setPassphraseVisibility(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class HideButtonOnClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
visibilityToggle.display(showButton);
|
||||||
|
setPassphraseVisibility(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void cleanup() {
|
protected void cleanup() {
|
||||||
this.passphraseText.setText("");
|
this.passphraseText.setText("");
|
||||||
|