add dark theme to PassphrasePromptActivity
Fixes #2296 Closes #2307 Closes #2627
@ -138,14 +138,14 @@
|
||||
<activity android:name=".PassphraseCreateActivity"
|
||||
android:label="@string/AndroidManifest__create_passphrase"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
android:theme="@style/TextSecure.IntroTheme"
|
||||
android:theme="@style/TextSecure.LightIntroTheme"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
<activity android:name=".PassphrasePromptActivity"
|
||||
android:label="@string/AndroidManifest__enter_passphrase"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/TextSecure.IntroTheme"
|
||||
android:theme="@style/TextSecure.LightIntroTheme"
|
||||
android:windowSoftInputMode="stateAlwaysVisible"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 157 B |
BIN
res/drawable-hdpi/ic_arrow_forward_dark.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
res/drawable-hdpi/ic_arrow_forward_light.png
Normal file
After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 6.4 KiB |
BIN
res/drawable-hdpi/lockscreen_watermark_dark.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
res/drawable-hdpi/lockscreen_watermark_light.png
Normal file
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 143 B |
BIN
res/drawable-mdpi/ic_arrow_forward_dark.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
res/drawable-mdpi/ic_arrow_forward_light.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
res/drawable-mdpi/lockscreen_watermark_dark.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
res/drawable-mdpi/lockscreen_watermark_light.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 206 B |
BIN
res/drawable-xhdpi/ic_arrow_forward_dark.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
res/drawable-xhdpi/ic_arrow_forward_light.png
Normal file
After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 9.1 KiB |
BIN
res/drawable-xhdpi/lockscreen_watermark_dark.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
res/drawable-xhdpi/lockscreen_watermark_light.png
Normal file
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 223 B |
BIN
res/drawable-xxhdpi/ic_arrow_forward_dark.png
Normal file
After Width: | Height: | Size: 261 B |
BIN
res/drawable-xxhdpi/ic_arrow_forward_light.png
Normal file
After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 16 KiB |
BIN
res/drawable-xxhdpi/lockscreen_watermark_dark.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
res/drawable-xxhdpi/lockscreen_watermark_light.png
Normal file
After Width: | Height: | Size: 32 KiB |
@ -10,7 +10,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#55000000"
|
||||
android:textColor="?attr/centered_app_title_color"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:id="@+id/title"
|
||||
android:textSize="23sp" />
|
@ -16,7 +16,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:src="@drawable/lockscreen_watermark"
|
||||
android:src="@drawable/lockscreen_watermark_light"
|
||||
android:contentDescription="@string/PassphrasePromptActivity_watermark_content_description"
|
||||
android:layout_marginTop="100dp"/>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:src="@drawable/lockscreen_watermark"
|
||||
android:src="?lockscreen_watermark"
|
||||
android:contentDescription="@string/PassphrasePromptActivity_watermark_content_description"
|
||||
android:layout_marginTop="30dp"/>
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
android:paddingRight="10dp"/>
|
||||
|
||||
<ImageButton android:id="@+id/ok_button"
|
||||
android:src="@drawable/ic_action_forward"
|
||||
android:src="?ic_arrow_forward"
|
||||
android:contentDescription="@string/PassphrasePromptActivity_ok_button_content_description"
|
||||
android:background="@null"
|
||||
android:text="@string/prompt_passphrase_activity__unlock"
|
||||
|
@ -23,6 +23,9 @@
|
||||
<attr name="fab_color" format="reference|color" />
|
||||
<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="conversation_background" format="reference|color"/>
|
||||
<attr name="conversation_editor_background" format="reference"/>
|
||||
<attr name="conversation_editor_text_color" format="reference|color"/>
|
||||
@ -113,4 +116,5 @@
|
||||
</declare-styleable>
|
||||
|
||||
<attr name="group_members_dialog_icon" format="reference"/>
|
||||
<attr name="lockscreen_watermark" format="reference" />
|
||||
</resources>
|
||||
|
@ -1,9 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="TextSecure.IntroTheme" parent="@style/Theme.AppCompat.Light">
|
||||
<style name="TextSecure.LightIntroTheme" parent="@style/Theme.AppCompat.Light">
|
||||
<!--<item name="colorPrimary">@android:color/transparent</item>-->
|
||||
<item name="actionBarStyle">@style/TextSecure.IntroActionBar</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<item name="android:textColorHint">#cc000000</item>
|
||||
<item name="centered_app_title_color">#55000000</item>
|
||||
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_light</item>
|
||||
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.DarkIntroTheme" parent="@style/Theme.AppCompat">
|
||||
<item name="actionBarStyle">@style/TextSecure.IntroActionBar</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<item name="android:textColorHint">@color/white</item>
|
||||
<item name="centered_app_title_color">@color/gray27</item>
|
||||
<item name="ic_arrow_forward">@drawable/ic_arrow_forward_dark</item>
|
||||
<item name="lockscreen_watermark">@drawable/lockscreen_watermark_dark</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.LightTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
|
||||
|
@ -47,7 +47,7 @@ public class PassphraseCreateActivity extends PassphraseActivity {
|
||||
|
||||
private void initializeResources() {
|
||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
getSupportActionBar().setCustomView(R.layout.light_centered_app_title);
|
||||
getSupportActionBar().setCustomView(R.layout.centered_app_title);
|
||||
|
||||
new SecretGenerator().execute(MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
|
||||
}
|
||||
|
@ -16,16 +16,12 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.text.style.TypefaceSpan;
|
||||
import android.view.KeyEvent;
|
||||
@ -42,9 +38,9 @@ import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
/**
|
||||
* Activity that prompts for a user's passphrase.
|
||||
@ -53,12 +49,14 @@ import org.thoughtcrime.securesms.util.Util;
|
||||
*/
|
||||
public class PassphrasePromptActivity extends PassphraseActivity {
|
||||
|
||||
private DynamicIntroTheme dynamicTheme = new DynamicIntroTheme();
|
||||
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
|
||||
private EditText passphraseText;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
dynamicTheme.onCreate(this);
|
||||
dynamicLanguage.onCreate(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@ -69,6 +67,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
dynamicTheme.onResume(this);
|
||||
dynamicLanguage.onResume(this);
|
||||
}
|
||||
|
||||
@ -119,14 +118,13 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||
|
||||
private void initializeResources() {
|
||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
getSupportActionBar().setCustomView(R.layout.light_centered_app_title);
|
||||
getSupportActionBar().setCustomView(R.layout.centered_app_title);
|
||||
|
||||
ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
|
||||
passphraseText = (EditText) findViewById(R.id.passphrase_edit);
|
||||
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 TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
hint.setSpan(new ForegroundColorSpan(0xcc000000), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
|
||||
passphraseText.setHint(hint);
|
||||
okButton.setOnClickListener(new OkButtonClickListener());
|
||||
|
16
src/org/thoughtcrime/securesms/util/DynamicIntroTheme.java
Normal file
@ -0,0 +1,16 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class DynamicIntroTheme extends DynamicTheme {
|
||||
@Override
|
||||
protected int getSelectedTheme(Activity activity) {
|
||||
String theme = TextSecurePreferences.getTheme(activity);
|
||||
|
||||
if (theme.equals("dark")) return R.style.TextSecure_DarkIntroTheme;
|
||||
|
||||
return R.style.TextSecure_LightIntroTheme;
|
||||
}
|
||||
}
|
@ -2,11 +2,7 @@ package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.ConversationListActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class DynamicTheme {
|
||||
@ -28,7 +24,7 @@ public class DynamicTheme {
|
||||
}
|
||||
}
|
||||
|
||||
private static int getSelectedTheme(Activity activity) {
|
||||
protected int getSelectedTheme(Activity activity) {
|
||||
String theme = TextSecurePreferences.getTheme(activity);
|
||||
|
||||
if (theme.equals("dark")) return R.style.TextSecure_DarkTheme;
|
||||
|