Merge "More UI tweaks." into honeycomb

This commit is contained in:
Jason parks
2011-01-25 06:39:06 -08:00
committed by Android (Google) Code Review
7 changed files with 154 additions and 100 deletions

View File

@@ -1079,7 +1079,7 @@
<activity android:name=".CryptKeeper"
android:immersive="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.NoActionBar"
android:theme="@style/CryptKeeperTheme"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter android:priority="10">
<action android:name="android.intent.action.MAIN" />
@@ -1088,6 +1088,12 @@
</intent-filter>
</activity>
<activity android:name=".CryptKeeper$Blank"
android:immersive="true"
android:launchMode="singleTop"
android:theme="@style/CryptKeeperBlankTheme"
/>
<!-- Pseudo-activity used to provide an intent-filter entry point to encryption settings -->
<activity android:name="Settings$CryptKeeperSettingsActivity"
android:theme="@android:style/Theme.Holo"

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
>
<scale
android:fromXScale="1.0"
android:toXScale="0.0"
android:fromYScale="1.0"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="500"
/>
</set>

View File

@@ -20,30 +20,32 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:orientation="vertical"
>
<LinearLayout
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_width="0dip"
android:orientation="vertical"
android:gravity="center_vertical"
>
<include layout="@layout/crypt_keeper_status" />
</LinearLayout>
<!-- right side: password -->
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:orientation="vertical"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center">
>
<!-- left side: status -->
<include layout="@layout/crypt_keeper_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="102dip"
android:layout_marginTop="20dip"
android:gravity="left"
android:paddingTop="50dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
android:layout_width="450dip"
android:layout_marginRight="155dip"
android:layout_alignParentRight="true"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
@@ -57,14 +59,14 @@
android:editable="false"
/>
</RelativeLayout>
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="450dip"
android:layout_height="230dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
android:visibility="visible"
/>
</LinearLayout>
</LinearLayout>

View File

@@ -17,36 +17,34 @@
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
>
<include layout="@layout/crypt_keeper_status" />
</LinearLayout>
<!-- right side: password -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<!-- left side: status -->
<include layout="@layout/crypt_keeper_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="134dip"
android:paddingTop="50dip"
android:layout_alignParentTop="true"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_above="@id/keyboard"
android:layout_height="wrap_content"
android:layout_width="450dip"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:layout_gravity="center"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:textSize="24sp"
android:layout_marginTop="120dip"
android:layout_marginBottom="5dip"
@@ -56,13 +54,12 @@
/>
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="450dip"
android:layout_height="230dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#00000000"
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
android:visibility="visible"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -23,10 +23,7 @@
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="140dip"
android:layout_marginTop="20dip"
android:gravity="left"
>
>
<com.android.internal.widget.DigitalClock android:id="@+id/time"
android:layout_width="wrap_content"

View File

@@ -120,4 +120,16 @@
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
</style>
<style name="CryptKeeperTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:windowAnimationStyle">@style/CryptKeeperAnimation</item>
</style>
<style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:background">#ff000000</item>
</style>
<style name="CryptKeeperAnimation">
<item name="android:windowExitAnimation">@anim/crypt_keeper_exit</item>
</style>
</resources>

View File

@@ -57,6 +57,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private static final int COOL_DOWN_ATTEMPTS = 10;
private static final int COOL_DOWN_INTERVAL = 30; // 30 seconds
// This activity is used to fade the screen to black after the password is entered.
public static class Blank extends Activity {
}
private Handler mHandler = new Handler() {
@Override
@@ -103,7 +106,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
};
private int mFailedAttempts = 0;
private int mCooldown;
@Override
@@ -143,7 +145,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// is encrypted.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
wakeLock.acquire();
@@ -192,15 +194,20 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
IMountService service = getMountService();
try {
service.decryptStorage(password);
int failedAttempts = service.decryptStorage(password);
if (mFailedAttempts == 0) {
// Success. Do something here within 2 seconds
} else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
if (failedAttempts == 0) {
// The password was entered successfully. Start the Blank activity
// so this activity animates to black before the devices starts. Note
// It has 1 second to complete the animation or it will be frozen
// until the boot animation comes back up.
Intent intent = new Intent(this, Blank.class);
finish();
startActivity(intent);
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
} else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
} else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = COOL_DOWN_INTERVAL;
EditText passwordEntry = (EditText) findViewById(R.id.passwordEntry);
passwordEntry.setEnabled(false);