new passphrase prompt activity
// FREEBIE
@ -133,8 +133,8 @@
|
||||
<activity android:name=".PassphrasePromptActivity"
|
||||
android:label="@string/AndroidManifest__enter_passphrase"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/NoAnimation.Theme.Sherlock.Light.DarkActionBar"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
android:theme="@style/TextSecure.IntroTheme"
|
||||
android:windowSoftInputMode="stateAlwaysVisible"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
<activity android:name=".ContactSelectionActivity"
|
||||
|
@ -1,7 +1,13 @@
|
||||
package org.whispersystems.textsecure.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -201,4 +207,17 @@ public class Util {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* source: http://stackoverflow.com/a/9500334
|
||||
*/
|
||||
public static void fixBackgroundRepeat(Drawable bg) {
|
||||
if (bg != null) {
|
||||
if (bg instanceof BitmapDrawable) {
|
||||
BitmapDrawable bmp = (BitmapDrawable) bg;
|
||||
bmp.mutate();
|
||||
bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
res/drawable-hdpi/ic_action_forward.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
res/drawable-hdpi/lockscreen_watermark.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
res/drawable-mdpi/ic_action_forward.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
res/drawable-xhdpi/ic_action_forward.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
res/drawable-xhdpi/lockscreen_watermark.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
res/drawable-xxhdpi/ic_action_forward.png
Normal file
After Width: | Height: | Size: 566 B |
BIN
res/drawable-xxhdpi/lockscreen_watermark.png
Normal file
After Width: | Height: | Size: 17 KiB |
18
res/drawable/passphrase_input_background.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/conversation_item_sent_shadow_light" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="@dimen/conversation_item_drop_shadow_dist">
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffffff" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
18
res/layout/light_centered_app_title.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#55000000"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:id="@+id/title"
|
||||
android:textSize="23sp" />
|
||||
|
||||
</LinearLayout>
|
@ -1,43 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/scroll_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:background="@drawable/background_pattern_repeat">
|
||||
|
||||
<LinearLayout android:id="@+id/prompt_layout"
|
||||
android:padding="16dp"
|
||||
android:layout_width="match_parent"
|
||||
<RelativeLayout android:id="@+id/prompt_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="vertical">
|
||||
>
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
<ImageView android:id="@+id/watermark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:src="@drawable/padlock_prompt"/>
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:src="@drawable/lockscreen_watermark"
|
||||
android:contentDescription="@string/PassphrasePromptActivity_watermark_content_description"
|
||||
android:layout_marginTop="30dp"/>
|
||||
|
||||
<TextView style="@style/Registration.Label"
|
||||
android:layout_width="match_parent"
|
||||
android:textAllCaps="true"
|
||||
android:text="@string/prompt_passphrase_activity__textsecure_passphrase" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/watermark">
|
||||
|
||||
<EditText android:id="@+id/passphrase_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:singleLine="true"/>
|
||||
<EditText android:id="@+id/passphrase_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:singleLine="true"
|
||||
android:background="@drawable/passphrase_input_background"
|
||||
android:padding="10dp"/>
|
||||
|
||||
<Button android:id="@+id/ok_button"
|
||||
android:text="@string/prompt_passphrase_activity__unlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
<ImageButton android:id="@+id/ok_button"
|
||||
android:src="@drawable/ic_action_forward"
|
||||
android:contentDescription="@string/PassphrasePromptActivity_ok_button_content_description"
|
||||
android:background="@null"
|
||||
android:text="@string/prompt_passphrase_activity__unlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="5dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
@ -212,7 +212,10 @@
|
||||
<string name="PassphraseCreateActivity_you_must_specify_a_password">You must specify a password</string>
|
||||
|
||||
<!-- PassphrasePromptActivity -->
|
||||
<string name="PassphrasePromptActivity_invalid_passphrase_exclamation">Invalid Passphrase!</string>
|
||||
<string name="PassphrasePromptActivity_enter_passphrase">Enter passphrase</string>
|
||||
<string name="PassphrasePromptActivity_watermark_content_description">TextSecure icon</string>
|
||||
<string name="PassphrasePromptActivity_ok_button_content_description">Submit passphrase</string>
|
||||
<string name="PassphrasePromptActivity_invalid_passphrase_exclamation">Invalid passphrase!</string>
|
||||
|
||||
<!-- PromptMmsActivity -->
|
||||
<string name="PromptMmsActivity_you_must_specify_an_mmsc_url_for_your_carrier">You must specify an MMSC URL for your carrier.</string>
|
||||
@ -645,7 +648,7 @@
|
||||
<!-- AndroidManifest.xml -->
|
||||
|
||||
<string name="AndroidManifest__create_passphrase">Create Passphrase</string>
|
||||
<string name="AndroidManifest__enter_passphrase">Enter Passphrase</string>
|
||||
<string name="AndroidManifest__enter_passphrase">Enter passphrase</string>
|
||||
<string name="AndroidManifest__select_contacts">Select Contacts</string>
|
||||
<string name="AndroidManifest__select_contact">Select Contact</string>
|
||||
<string name="AndroidManifest__textsecure_detected">TextSecure Detected</string>
|
||||
|
@ -25,6 +25,10 @@
|
||||
<item name="icon">@drawable/actionbar_icon_holo_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.ClearTitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">#ff555555</item>
|
||||
<item name="android:textSize">19sp</item>
|
||||
@ -43,6 +47,15 @@
|
||||
<item name="icon">@drawable/actionbar_icon_holo_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.IntroActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid">
|
||||
<item name="android:titleTextStyle">@style/TextSecure.ClearTitleTextStyle</item>
|
||||
<item name="titleTextStyle">@style/TextSecure.ClearTitleTextStyle</item>
|
||||
<item name="android:background">@drawable/background_pattern_repeat</item>
|
||||
<item name="background">@drawable/background_pattern_repeat</item>
|
||||
<item name="android:icon">@android:color/transparent</item>
|
||||
<item name="icon">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="transparent_progress">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
@ -1,5 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="TextSecure.IntroTheme" parent="@style/Theme.Sherlock.Light">
|
||||
<item name="android:actionBarStyle">@style/TextSecure.IntroActionBar</item>
|
||||
<item name="actionBarStyle">@style/TextSecure.IntroActionBar</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.LightTheme" parent="@style/Theme.Sherlock.Light">
|
||||
<item name="android:actionBarStyle">@style/TextSecure.LightActionBar</item>
|
||||
<item name="actionBarStyle">@style/TextSecure.LightActionBar</item>
|
||||
|
@ -17,27 +17,34 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
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.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
|
||||
/**
|
||||
* Activity that prompts for a users's passphrase.
|
||||
* Activity that prompts for a user's passphrase.
|
||||
*
|
||||
* @author Moxie Marlinspike
|
||||
*/
|
||||
@ -79,12 +86,29 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||
}
|
||||
|
||||
private void initializeResources() {
|
||||
Button okButton = (Button) findViewById(R.id.ok_button);
|
||||
passphraseText = (EditText)findViewById(R.id.passphrase_edit);
|
||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
getSupportActionBar().setCustomView(R.layout.light_centered_app_title);
|
||||
mitigateAndroidTilingBug();
|
||||
|
||||
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.8f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
hint.setSpan(new ForegroundColorSpan(0x66000000), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
passphraseText.setHint(hint);
|
||||
okButton.setOnClickListener(new OkButtonClickListener());
|
||||
}
|
||||
|
||||
private void mitigateAndroidTilingBug() {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
Drawable actionBarBackground = getResources().getDrawable(R.drawable.background_pattern_repeat);
|
||||
Util.fixBackgroundRepeat(actionBarBackground);
|
||||
getSupportActionBar().setBackgroundDrawable(actionBarBackground);
|
||||
Util.fixBackgroundRepeat(findViewById(R.id.scroll_parent).getBackground());
|
||||
}
|
||||
}
|
||||
|
||||
private class OkButtonClickListener implements OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|