Fixed passphrase prompt activity theming attributes.

This commit is contained in:
Anton Chekulaev 2020-09-08 12:04:51 +10:00
parent cc199b4022
commit 4ed7917625
32 changed files with 100 additions and 71 deletions

View File

@ -342,7 +342,8 @@
<activity <activity
android:name="org.thoughtcrime.securesms.PassphrasePromptActivity" android:name="org.thoughtcrime.securesms.PassphrasePromptActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask" /> android:launchMode="singleTask"
android:theme="@style/Theme.Session.DayNight.NoActionBar"/>
<activity <activity
android:name="org.thoughtcrime.securesms.NewConversationActivity" android:name="org.thoughtcrime.securesms.NewConversationActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
</vector>

View File

@ -6,7 +6,8 @@
android:id="@+id/prompt_layout" android:id="@+id/prompt_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical"
tools:context="org.thoughtcrime.securesms.PassphrasePromptActivity">
<View android:id="@+id/shim" <View android:id="@+id/shim"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -25,7 +26,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_marginTop="20dp"> android:layout_alignParentTop="true">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -78,7 +79,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="60dp" android:layout_marginBottom="60dp"
tools:visibility="gone"> tools:visibility="visible">
<EditText android:id="@+id/passphrase_edit" <EditText android:id="@+id/passphrase_edit"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -88,55 +89,56 @@
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
android:singleLine="true" android:singleLine="true"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="40dp"/> android:paddingEnd="40dp"
tools:text="password"/>
<!-- <org.thoughtcrime.securesms.components.AnimatingToggle--> <org.thoughtcrime.securesms.components.AnimatingToggle
<!-- android:id="@+id/button_toggle"--> android:id="@+id/button_toggle"
<!-- android:layout_width="wrap_content"--> android:layout_width="wrap_content"
<!-- android:layout_height="wrap_content"--> android:layout_height="wrap_content"
<!-- android:layout_alignRight="@+id/passphrase_edit"--> android:layout_alignRight="@+id/passphrase_edit"
<!-- android:layout_centerVertical="true"--> android:layout_centerVertical="true"
<!-- android:layout_gravity="center"--> android:layout_gravity="center"
<!-- android:gravity="center">--> android:gravity="center">
<!-- <ImageButton android:id="@+id/passphrase_visibility"--> <ImageButton android:id="@+id/passphrase_visibility"
<!-- android:src="?ic_visibility"--> android:src="?ic_visibility_on"
<!-- android:background="@drawable/touch_highlight_background"--> android:background="@drawable/touch_highlight_background"
<!-- android:layout_width="wrap_content"--> android:layout_width="wrap_content"
<!-- android:layout_height="wrap_content"--> android:layout_height="wrap_content"
<!-- android:paddingStart="8dp"--> android:paddingStart="8dp"
<!-- android:paddingEnd="8dp"--> android:paddingEnd="8dp"
<!-- android:paddingTop="3dp"--> android:paddingTop="3dp"
<!-- android:paddingBottom="3dp"--> android:paddingBottom="3dp"
<!-- android:layout_centerVertical="true" />--> android:layout_centerVertical="true" />
<!-- <ImageButton android:id="@+id/passphrase_visibility_off"--> <ImageButton android:id="@+id/passphrase_visibility_off"
<!-- android:src="?ic_visibility_off"--> android:src="?ic_visibility_off"
<!-- android:background="@drawable/touch_highlight_background"--> android:background="@drawable/touch_highlight_background"
<!-- android:layout_width="wrap_content"--> android:layout_width="wrap_content"
<!-- android:layout_height="wrap_content"--> android:layout_height="wrap_content"
<!-- android:paddingStart="8dp"--> android:paddingStart="8dp"
<!-- android:paddingEnd="8dp"--> android:paddingEnd="8dp"
<!-- android:paddingTop="3dp"--> android:paddingTop="3dp"
<!-- android:paddingBottom="3dp"--> android:paddingBottom="3dp"
<!-- android:layout_centerVertical="true" />--> android:layout_centerVertical="true" />
<!-- </org.thoughtcrime.securesms.components.AnimatingToggle>--> </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"
<!-- android:contentDescription="@string/PassphrasePromptActivity_ok_button_content_description"--> android:contentDescription="@string/PassphrasePromptActivity_ok_button_content_description"
<!-- android:background="@null"--> android:background="@null"
<!-- android:text="@string/prompt_passphrase_activity__unlock"--> android:text="@string/prompt_passphrase_activity__unlock"
<!-- android:layout_width="wrap_content"--> android:layout_width="wrap_content"
<!-- android:layout_height="wrap_content"--> android:layout_height="wrap_content"
<!-- android:layout_alignParentEnd="true"--> android:layout_alignParentEnd="true"
<!-- android:layout_centerVertical="true"--> android:layout_centerVertical="true"
<!-- android:textAppearance="?android:attr/textAppearanceMedium"--> android:textAppearance="?android:attr/textAppearanceMedium"
<!-- android:paddingStart="5dp"--> android:paddingStart="5dp"
<!-- android:paddingTop="5dp"--> android:paddingTop="5dp"
<!-- android:paddingEnd="10dp"--> android:paddingEnd="10dp"
<!-- android:paddingBottom="5dp"/>--> android:paddingBottom="5dp"/>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -26,9 +26,8 @@
<attr name="fab_color" format="reference|color" /> <attr name="fab_color" format="reference|color" />
<attr name="lower_right_divet" format="reference" /> <attr name="lower_right_divet" format="reference" />
<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_on" format="reference" />
<attr name="ic_visibility_off" format="reference" /> <attr name="ic_visibility_off" format="reference" />
<attr name="conversation_background" format="reference|color"/> <attr name="conversation_background" format="reference|color"/>

View File

@ -43,6 +43,10 @@
<item name="dividerHorizontal">?dividerVertical</item> <item name="dividerHorizontal">?dividerVertical</item>
<!-- App specific attributes --> <!-- App specific attributes -->
<item name="ic_visibility_on">@drawable/ic_baseline_visibility_24</item>
<item name="ic_visibility_off">@drawable/ic_baseline_visibility_off_24</item>
<item name="ic_arrow_forward">@drawable/ic_baseline_arrow_forward_24</item>
<item name="search_toolbar_background">@color/black</item> <item name="search_toolbar_background">@color/black</item>
<item name="search_background">@color/black</item> <item name="search_background">@color/black</item>

View File

@ -23,9 +23,6 @@ import android.content.Intent;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
import androidx.core.os.CancellationSignal;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.SpannableString; import android.text.SpannableString;
@ -49,6 +46,9 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
import androidx.core.os.CancellationSignal;
import org.thoughtcrime.securesms.animation.AnimationCompleteListener; import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
import org.thoughtcrime.securesms.components.AnimatingToggle; import org.thoughtcrime.securesms.components.AnimatingToggle;
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException; import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
@ -76,8 +76,8 @@ public class PassphrasePromptActivity extends PassphraseActivity {
private Button lockScreenButton; private Button lockScreenButton;
private EditText passphraseText; private EditText passphraseText;
// private ImageButton showButton; private ImageButton showButton;
// private ImageButton hideButton; private ImageButton hideButton;
private AnimatingToggle visibilityToggle; private AnimatingToggle visibilityToggle;
private FingerprintManagerCompat fingerprintManager; private FingerprintManagerCompat fingerprintManager;
@ -91,8 +91,6 @@ public class PassphrasePromptActivity extends PassphraseActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate()"); Log.i(TAG, "onCreate()");
dynamicLanguage.onCreate(this); dynamicLanguage.onCreate(this);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.prompt_passphrase_activity); setContentView(R.layout.prompt_passphrase_activity);
@ -203,11 +201,10 @@ public class PassphrasePromptActivity extends PassphraseActivity {
private void initializeResources() { private void initializeResources() {
// ImageButton okButton = findViewById(R.id.ok_button); ImageButton okButton = findViewById(R.id.ok_button);
Toolbar toolbar = findViewById(R.id.toolbar);
// showButton = findViewById(R.id.passphrase_visibility); showButton = findViewById(R.id.passphrase_visibility);
// hideButton = findViewById(R.id.passphrase_visibility_off); hideButton = findViewById(R.id.passphrase_visibility_off);
visibilityToggle = findViewById(R.id.button_toggle); visibilityToggle = findViewById(R.id.button_toggle);
passphraseText = findViewById(R.id.passphrase_edit); passphraseText = findViewById(R.id.passphrase_edit);
passphraseAuthContainer = findViewById(R.id.password_auth_container); passphraseAuthContainer = findViewById(R.id.password_auth_container);
@ -217,20 +214,16 @@ public class PassphrasePromptActivity extends PassphraseActivity {
fingerprintCancellationSignal = new CancellationSignal(); fingerprintCancellationSignal = new CancellationSignal();
fingerprintListener = new FingerprintListener(); fingerprintListener = new FingerprintListener();
// setSupportActionBar(toolbar);
// getSupportActionBar().setTitle("");
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);
hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
passphraseText.setHint(hint); passphraseText.setHint(hint);
// okButton.setOnClickListener(new OkButtonClickListener()); okButton.setOnClickListener(new OkButtonClickListener());
// showButton.setOnClickListener(new ShowButtonOnClickListener()); showButton.setOnClickListener(new ShowButtonOnClickListener());
// hideButton.setOnClickListener(new HideButtonOnClickListener()); 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);
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp); fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN); fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
@ -316,7 +309,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
private class ShowButtonOnClickListener implements OnClickListener { private class ShowButtonOnClickListener implements OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// visibilityToggle.display(hideButton); visibilityToggle.display(hideButton);
setPassphraseVisibility(true); setPassphraseVisibility(true);
} }
} }
@ -324,7 +317,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
private class HideButtonOnClickListener implements OnClickListener { private class HideButtonOnClickListener implements OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// visibilityToggle.display(showButton); visibilityToggle.display(showButton);
setPassphraseVisibility(false); setPassphraseVisibility(false);
} }
} }