Fix 3148496: Initial pass at fragmentizing lockscreen settings.
This converts most of the existing activities to fragments and wraps them in PreferenceActivities so they can be launched as before (e.g. by a DevicePolicyManager) Upload after sync/rebase. Change-Id: I4f351b75d9fca0498bcb04b4e11ff3b70765a4ba
This commit is contained in:
@@ -651,9 +651,8 @@
|
||||
<!-- Second and third-level settings -->
|
||||
|
||||
<activity android:name="ConfirmLockPattern"/>
|
||||
<activity android:name="ConfirmLockPassword"
|
||||
android:theme="@android:style/Theme.NoTitleBar">
|
||||
</activity>
|
||||
|
||||
<activity android:name="ConfirmLockPassword"/>>
|
||||
|
||||
<activity android:name="ChooseLockGeneric">
|
||||
<intent-filter>
|
||||
@@ -669,7 +668,6 @@
|
||||
|
||||
<activity android:name="ChooseLockPassword"
|
||||
android:label="@string/lockpattern_change_lock_pin_label"
|
||||
android:theme="@android:style/Theme.NoTitleBar"
|
||||
android:exported="false">
|
||||
</activity>
|
||||
|
||||
|
109
res/layout-xlarge-land/choose_lock_password.xml
Normal file
109
res/layout-xlarge-land/choose_lock_password.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2008, 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.
|
||||
*/
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- "Enter PIN(Password) to unlock" -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:layout_marginBottom="10dip"
|
||||
android:gravity="left"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
/>
|
||||
|
||||
<!-- Password entry field -->
|
||||
<EditText android:id="@+id/password_entry"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="24sp"
|
||||
android:layout_marginTop="5dip"
|
||||
android:layout_marginBottom="5dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:background="@drawable/password_field_default"
|
||||
android:textColor="#ffffffff"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Spacer between password entry and keyboard -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- Alphanumeric keyboard -->
|
||||
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<Button android:id="@+id/cancel_button"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="140dip"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toLeftOf="@id/next_button"
|
||||
android:text="@string/lockpassword_cancel_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/next_button"
|
||||
android:layout_width="140dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/lockpassword_continue_label"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
82
res/layout-xlarge-land/choose_lock_pattern.xml
Normal file
82
res/layout-xlarge-land/choose_lock_pattern.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/topLayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- left side: lock pattern -->
|
||||
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!-- right side: pattern and messages -->
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<!-- header message -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="22sp"
|
||||
android:gravity="left"/>
|
||||
|
||||
<!-- footer message -->
|
||||
<TextView android:id="@+id/footerText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="22sp"
|
||||
android:layout_marginTop="40dip"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<!-- confirm / restart buttons -->
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<!-- right / bottom button: confirm or ok -->
|
||||
<Button android:id="@+id/footerRightButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="140dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:text="@string/lockpattern_confirm_button_text"/>
|
||||
|
||||
<!-- left / top button: skip, or re-try -->
|
||||
<Button android:id="@+id/footerLeftButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="140dip"
|
||||
android:layout_toLeftOf="@id/footerRightButton"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:text="@string/lockpattern_restart_button_text"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
||||
|
108
res/layout-xlarge-land/confirm_lock_password.xml
Normal file
108
res/layout-xlarge-land/confirm_lock_password.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2008, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- This is the same layout as choose_lock_password. TODO: find out why merge fails -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- "Enter PIN(Password) to unlock" -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:layout_marginBottom="10dip"
|
||||
android:gravity="left"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
/>
|
||||
|
||||
<!-- Password entry field -->
|
||||
<EditText android:id="@+id/password_entry"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="24sp"
|
||||
android:layout_marginTop="5dip"
|
||||
android:layout_marginBottom="5dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:background="@drawable/password_field_default"
|
||||
android:textColor="#ffffffff"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Spacer between password entry and keyboard -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- Alphanumeric keyboard -->
|
||||
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<Button android:id="@+id/cancel_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_toLeftOf="@id/next_button"
|
||||
android:text="@string/lockpassword_cancel_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/next_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:drawableRight="@drawable/ic_btn_next"
|
||||
android:drawablePadding="10dip"
|
||||
android:text="@string/lockpassword_continue_label"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
53
res/layout-xlarge-land/confirm_lock_pattern.xml
Normal file
53
res/layout-xlarge-land/confirm_lock_pattern.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/topLayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- left side: lock pattern -->
|
||||
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- right side: instructions and buttons -->
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<!-- header message -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
<!-- footer message -->
|
||||
<TextView android:id="@+id/footerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dip"
|
||||
android:gravity="left"
|
||||
android:textSize="22sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
||||
|
101
res/layout-xlarge/choose_lock_password.xml
Normal file
101
res/layout-xlarge/choose_lock_password.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2008, 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.
|
||||
*/
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/background_dark"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<!-- header text ('Enter Pin') -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:lines="2"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
<!-- spacer above text entry field -->
|
||||
<View
|
||||
android:id="@+id/spacerBottom"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark"
|
||||
/>
|
||||
|
||||
<!-- Password entry field -->
|
||||
<EditText android:id="@+id/password_entry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="32sp"
|
||||
android:layout_marginTop="15dip"
|
||||
android:layout_marginLeft="30dip"
|
||||
android:layout_marginRight="30dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:background="@drawable/password_field_default"
|
||||
android:textColor="#ffffffff"
|
||||
/>
|
||||
|
||||
<!-- Spacer between password entry and keyboard -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- Alphanumeric keyboard -->
|
||||
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:layout_marginBottom="30dip"
|
||||
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<Button android:id="@+id/cancel_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/lockpassword_cancel_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/next_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:drawableRight="@drawable/ic_btn_next"
|
||||
android:drawablePadding="10dip"
|
||||
android:text="@string/lockpassword_continue_label"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
91
res/layout-xlarge/choose_lock_pattern.xml
Normal file
91
res/layout-xlarge/choose_lock_pattern.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/topLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black">
|
||||
|
||||
<!-- takes up all space above button bar at bottom -->
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<View
|
||||
android:background="@*android:drawable/code_lock_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dip" />
|
||||
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- bottom line looks bad when button bar is their too, omit in this case -->
|
||||
<!--View
|
||||
android:background="@*android:drawable/code_lock_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dip" /-->
|
||||
|
||||
<TextView android:id="@+id/footerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout style="@android:style/ButtonBar"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button android:id="@+id/footerLeftButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="140dip"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:text="@string/lockpattern_restart_button_text"/>
|
||||
|
||||
<View
|
||||
android:visibility="invisible"
|
||||
android:layout_height="0dip"
|
||||
android:layout_width="1dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button android:id="@+id/footerRightButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="140dip"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:drawableRight="@drawable/ic_btn_next"
|
||||
android:drawablePadding="3dip"
|
||||
android:text="@string/lockpattern_confirm_button_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
105
res/layout-xlarge/confirm_lock_password.xml
Normal file
105
res/layout-xlarge/confirm_lock_password.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2008, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- This is the same layout as choose_lock_password -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/background_dark"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<!-- header text ('Enter Pin') -->
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:lines="2"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
<!-- spacer above text entry field -->
|
||||
<View
|
||||
android:id="@+id/spacerBottom"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark"
|
||||
/>
|
||||
|
||||
<!-- Password entry field -->
|
||||
<EditText android:id="@+id/password_entry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="32sp"
|
||||
android:layout_marginTop="15dip"
|
||||
android:layout_marginLeft="30dip"
|
||||
android:layout_marginRight="30dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:background="@drawable/password_field_default"
|
||||
android:textColor="#ffffffff"
|
||||
/>
|
||||
|
||||
<!-- Spacer between password entry and keyboard -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- Alphanumeric keyboard -->
|
||||
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:layout_marginBottom="30dip"
|
||||
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<Button android:id="@+id/cancel_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/lockpassword_cancel_label"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/next_button"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:drawableRight="@drawable/ic_btn_next"
|
||||
android:drawablePadding="10dip"
|
||||
android:text="@string/lockpassword_continue_label"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
51
res/layout-xlarge/confirm_lock_pattern.xml
Normal file
51
res/layout-xlarge/confirm_lock_pattern.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/topLayout"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black">
|
||||
|
||||
<TextView android:id="@+id/headerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<View
|
||||
android:background="@*android:drawable/code_lock_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dip" />
|
||||
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<View
|
||||
android:background="@*android:drawable/code_lock_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dip" />
|
||||
|
||||
<TextView android:id="@+id/footerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
|
||||
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
|
@@ -18,6 +18,7 @@ package com.android.settings;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -28,6 +29,16 @@ import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
public class ChooseLockGeneric extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockGenericFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static class ChooseLockGenericFragment extends SettingsPreferenceFragment {
|
||||
private static final int MIN_PASSWORD_LENGTH = 4;
|
||||
private static final String KEY_UNLOCK_SET_OFF = "unlock_set_off";
|
||||
private static final String KEY_UNLOCK_SET_NONE = "unlock_set_none";
|
||||
@@ -43,18 +54,18 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
private boolean mPasswordConfirmed = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this);
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
||||
}
|
||||
|
||||
if (!mPasswordConfirmed) {
|
||||
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
|
||||
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||
if (!helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST, null, null)) {
|
||||
mPasswordConfirmed = true; // no password set, so no need to confirm
|
||||
updatePreferencesOrFinish();
|
||||
@@ -86,26 +97,26 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == RESULT_OK) {
|
||||
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mPasswordConfirmed = true;
|
||||
updatePreferencesOrFinish();
|
||||
} else {
|
||||
setResult(RESULT_CANCELED);
|
||||
getActivity().setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
// Saved so we don't force user to re-enter their password if configuration changes
|
||||
outState.putBoolean(PASSWORD_CONFIRMED, mPasswordConfirmed);
|
||||
}
|
||||
|
||||
private void updatePreferencesOrFinish() {
|
||||
int quality = getIntent().getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
|
||||
int quality = getActivity().getIntent().getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
|
||||
if (quality == -1) {
|
||||
// If caller didn't specify password quality, show the UI and allow the user to choose.
|
||||
quality = mChooseLockSettingsHelper.utils().getKeyguardStoredPasswordQuality();
|
||||
@@ -179,7 +190,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
minLength = MIN_PASSWORD_LENGTH;
|
||||
}
|
||||
final int maxLength = mDPM.getPasswordMaximumLength(quality);
|
||||
Intent intent = new Intent().setClass(this, ChooseLockPassword.class);
|
||||
Intent intent = new Intent().setClass(getActivity(), ChooseLockPassword.class);
|
||||
intent.putExtra(LockPatternUtils.PASSWORD_TYPE_KEY, quality);
|
||||
intent.putExtra(ChooseLockPassword.PASSWORD_MIN_KEY, minLength);
|
||||
intent.putExtra(ChooseLockPassword.PASSWORD_MAX_KEY, maxLength);
|
||||
@@ -189,7 +200,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||
boolean showTutorial = !mChooseLockSettingsHelper.utils().isPatternEverChosen();
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(this, showTutorial
|
||||
intent.setClass(getActivity(), showTutorial
|
||||
? ChooseLockPatternTutorial.class
|
||||
: ChooseLockPattern.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
@@ -199,8 +210,9 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||
mChooseLockSettingsHelper.utils().clearLock();
|
||||
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
|
||||
setResult(RESULT_OK);
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,19 +21,22 @@ import com.android.internal.widget.PasswordEntryKeyboardHelper;
|
||||
import com.android.internal.widget.PasswordEntryKeyboardView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Intent;
|
||||
import android.inputmethodservice.KeyboardView;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
@@ -41,8 +44,35 @@ import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
|
||||
public class ChooseLockPassword extends Activity implements OnClickListener, OnEditorActionListener,
|
||||
TextWatcher {
|
||||
public class ChooseLockPassword extends PreferenceActivity {
|
||||
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
||||
public static final String PASSWORD_MAX_KEY = "lockscreen.password_max";
|
||||
public static final String PASSWORD_MIN_LETTERS_KEY = "lockscreen.password_min_letters";
|
||||
public static final String PASSWORD_MIN_LOWERCASE_KEY = "lockscreen.password_min_lowercase";
|
||||
public static final String PASSWORD_MIN_UPPERCASE_KEY = "lockscreen.password_min_uppercase";
|
||||
public static final String PASSWORD_MIN_NUMERIC_KEY = "lockscreen.password_min_numeric";
|
||||
public static final String PASSWORD_MIN_SYMBOLS_KEY = "lockscreen.password_min_symbols";
|
||||
public static final String PASSWORD_MIN_NONLETTER_KEY = "lockscreen.password_min_nonletter";
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPasswordFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// TODO: Fix on phones
|
||||
// Disable IME on our window since we provide our own keyboard
|
||||
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
|
||||
//WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static class ChooseLockPasswordFragment extends Fragment
|
||||
implements OnClickListener, OnEditorActionListener, TextWatcher {
|
||||
private static final String KEY_FIRST_PIN = "first_pin";
|
||||
private static final String KEY_UI_STAGE = "ui_stage";
|
||||
private TextView mPasswordEntry;
|
||||
@@ -57,7 +87,7 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
private int mRequestedQuality = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
|
||||
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||
private com.android.settings.ChooseLockPassword.Stage mUiStage = Stage.Introduction;
|
||||
private Stage mUiStage = Stage.Introduction;
|
||||
private TextView mHeaderText;
|
||||
private String mFirstPin;
|
||||
private KeyboardView mKeyboardView;
|
||||
@@ -65,14 +95,6 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
private boolean mIsAlphaMode;
|
||||
private Button mCancelButton;
|
||||
private Button mNextButton;
|
||||
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
||||
public static final String PASSWORD_MAX_KEY = "lockscreen.password_max";
|
||||
public static final String PASSWORD_MIN_LETTERS_KEY = "lockscreen.password_min_letters";
|
||||
public static final String PASSWORD_MIN_LOWERCASE_KEY = "lockscreen.password_min_lowercase";
|
||||
public static final String PASSWORD_MIN_UPPERCASE_KEY = "lockscreen.password_min_uppercase";
|
||||
public static final String PASSWORD_MIN_NUMERIC_KEY = "lockscreen.password_min_numeric";
|
||||
public static final String PASSWORD_MIN_SYMBOLS_KEY = "lockscreen.password_min_symbols";
|
||||
public static final String PASSWORD_MIN_NONLETTER_KEY = "lockscreen.password_min_nonletter";
|
||||
private static Handler mHandler = new Handler();
|
||||
private static final int CONFIRM_EXISTING_REQUEST = 58;
|
||||
static final int RESULT_FINISHED = RESULT_FIRST_USER;
|
||||
@@ -109,104 +131,109 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
public final int buttonText;
|
||||
}
|
||||
|
||||
// required constructor for fragments
|
||||
public ChooseLockPasswordFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mLockPatternUtils = new LockPatternUtils(this);
|
||||
mRequestedQuality = Math.max(getIntent().getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
|
||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
||||
Intent intent = getActivity().getIntent();
|
||||
mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
|
||||
mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality());
|
||||
mPasswordMinLength = Math.max(
|
||||
getIntent().getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength), mLockPatternUtils
|
||||
intent.getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength), mLockPatternUtils
|
||||
.getRequestedMinimumPasswordLength());
|
||||
mPasswordMaxLength = getIntent().getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength);
|
||||
mPasswordMinLetters = Math.max(getIntent().getIntExtra(PASSWORD_MIN_LETTERS_KEY,
|
||||
mPasswordMaxLength = intent.getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength);
|
||||
mPasswordMinLetters = Math.max(intent.getIntExtra(PASSWORD_MIN_LETTERS_KEY,
|
||||
mPasswordMinLetters), mLockPatternUtils.getRequestedPasswordMinimumLetters());
|
||||
mPasswordMinUpperCase = Math.max(getIntent().getIntExtra(PASSWORD_MIN_UPPERCASE_KEY,
|
||||
mPasswordMinUpperCase = Math.max(intent.getIntExtra(PASSWORD_MIN_UPPERCASE_KEY,
|
||||
mPasswordMinUpperCase), mLockPatternUtils.getRequestedPasswordMinimumUpperCase());
|
||||
mPasswordMinLowerCase = Math.max(getIntent().getIntExtra(PASSWORD_MIN_LOWERCASE_KEY,
|
||||
mPasswordMinLowerCase = Math.max(intent.getIntExtra(PASSWORD_MIN_LOWERCASE_KEY,
|
||||
mPasswordMinLowerCase), mLockPatternUtils.getRequestedPasswordMinimumLowerCase());
|
||||
mPasswordMinNumeric = Math.max(getIntent().getIntExtra(PASSWORD_MIN_NUMERIC_KEY,
|
||||
mPasswordMinNumeric = Math.max(intent.getIntExtra(PASSWORD_MIN_NUMERIC_KEY,
|
||||
mPasswordMinNumeric), mLockPatternUtils.getRequestedPasswordMinimumNumeric());
|
||||
mPasswordMinSymbols = Math.max(getIntent().getIntExtra(PASSWORD_MIN_SYMBOLS_KEY,
|
||||
mPasswordMinSymbols = Math.max(intent.getIntExtra(PASSWORD_MIN_SYMBOLS_KEY,
|
||||
mPasswordMinSymbols), mLockPatternUtils.getRequestedPasswordMinimumSymbols());
|
||||
mPasswordMinNonLetter = Math.max(getIntent().getIntExtra(PASSWORD_MIN_NONLETTER_KEY,
|
||||
mPasswordMinNonLetter = Math.max(intent.getIntExtra(PASSWORD_MIN_NONLETTER_KEY,
|
||||
mPasswordMinNonLetter), mLockPatternUtils.getRequestedPasswordMinimumNonLetter());
|
||||
final boolean confirmCredentials = getIntent().getBooleanExtra("confirm_credentials", true);
|
||||
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
||||
}
|
||||
|
||||
initViews();
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this);
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.choose_lock_password, null);
|
||||
|
||||
mCancelButton = (Button) view.findViewById(R.id.cancel_button);
|
||||
mCancelButton.setOnClickListener(this);
|
||||
mNextButton = (Button) view.findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
mIsAlphaMode = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == mRequestedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == mRequestedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == mRequestedQuality;
|
||||
mKeyboardView = (PasswordEntryKeyboardView) view.findViewById(R.id.keyboard);
|
||||
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
||||
mPasswordEntry.setOnEditorActionListener(this);
|
||||
mPasswordEntry.addTextChangedListener(this);
|
||||
|
||||
mKeyboardHelper = new PasswordEntryKeyboardHelper(getActivity(),
|
||||
mKeyboardView, mPasswordEntry);
|
||||
mKeyboardHelper.setKeyboardMode(mIsAlphaMode ?
|
||||
PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
|
||||
: PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
|
||||
|
||||
mHeaderText = (TextView) view.findViewById(R.id.headerText);
|
||||
mKeyboardView.requestFocus();
|
||||
|
||||
Intent intent = getActivity().getIntent();
|
||||
final boolean confirmCredentials = intent.getBooleanExtra("confirm_credentials", true);
|
||||
if (savedInstanceState == null) {
|
||||
updateStage(Stage.Introduction);
|
||||
if (confirmCredentials) {
|
||||
mChooseLockSettingsHelper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST,
|
||||
null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
setContentView(R.layout.choose_lock_password);
|
||||
// Disable IME on our window since we provide our own keyboard
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
|
||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
|
||||
mCancelButton = (Button) findViewById(R.id.cancel_button);
|
||||
mCancelButton.setOnClickListener(this);
|
||||
mNextButton = (Button) findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard);
|
||||
mPasswordEntry = (TextView) findViewById(R.id.password_entry);
|
||||
mPasswordEntry.setOnEditorActionListener(this);
|
||||
mPasswordEntry.addTextChangedListener(this);
|
||||
|
||||
mIsAlphaMode = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == mRequestedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == mRequestedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == mRequestedQuality;
|
||||
mKeyboardHelper = new PasswordEntryKeyboardHelper(this, mKeyboardView, mPasswordEntry);
|
||||
mKeyboardHelper.setKeyboardMode(mIsAlphaMode ?
|
||||
PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
|
||||
: PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
|
||||
|
||||
mHeaderText = (TextView) findViewById(R.id.headerText);
|
||||
mKeyboardView.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateStage(mUiStage);
|
||||
mKeyboardView.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(KEY_UI_STAGE, mUiStage.name());
|
||||
outState.putString(KEY_FIRST_PIN, mFirstPin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
String state = savedInstanceState.getString(KEY_UI_STAGE);
|
||||
} else {
|
||||
mFirstPin = savedInstanceState.getString(KEY_FIRST_PIN);
|
||||
final String state = savedInstanceState.getString(KEY_UI_STAGE);
|
||||
if (state != null) {
|
||||
mUiStage = Stage.valueOf(state);
|
||||
updateStage(mUiStage);
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateStage(mUiStage);
|
||||
mKeyboardView.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(KEY_UI_STAGE, mUiStage.name());
|
||||
outState.putString(KEY_FIRST_PIN, mFirstPin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case CONFIRM_EXISTING_REQUEST:
|
||||
if (resultCode != Activity.RESULT_OK) {
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -326,7 +353,7 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
if (mFirstPin.equals(pin)) {
|
||||
mLockPatternUtils.clearLock();
|
||||
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality);
|
||||
finish();
|
||||
getActivity().finish();
|
||||
} else {
|
||||
updateStage(Stage.ConfirmWrong);
|
||||
CharSequence tmp = mPasswordEntry.getText();
|
||||
@@ -347,7 +374,7 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
break;
|
||||
|
||||
case R.id.cancel_button:
|
||||
finish();
|
||||
getActivity().finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -415,3 +442,4 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,14 +22,18 @@ import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.internal.widget.LockPatternView;
|
||||
import com.android.internal.widget.LockPatternView.Cell;
|
||||
|
||||
import static com.android.internal.widget.LockPatternView.DisplayMode;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -44,7 +48,7 @@ import java.util.List;
|
||||
* - asks for confirmation / restart
|
||||
* - saves chosen password when confirmed
|
||||
*/
|
||||
public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
public class ChooseLockPattern extends PreferenceActivity {
|
||||
/**
|
||||
* Used by the choose lock pattern wizard to indicate the wizard is
|
||||
* finished, and each activity in the wizard should finish.
|
||||
@@ -56,6 +60,30 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
*/
|
||||
static final int RESULT_FINISHED = RESULT_FIRST_USER;
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
// *** TODO ***
|
||||
// chooseLockPatternFragment.onKeyDown(keyCode, event);
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
public static class ChooseLockPatternFragment extends Fragment
|
||||
implements View.OnClickListener {
|
||||
|
||||
public static final int CONFIRM_EXISTING_REQUEST = 55;
|
||||
|
||||
// how long after a confirmation message is shown before moving on
|
||||
@@ -85,14 +113,14 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
));
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
public void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case CONFIRM_EXISTING_REQUEST:
|
||||
if (resultCode != Activity.RESULT_OK) {
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
}
|
||||
updateStage(Stage.Introduction);
|
||||
break;
|
||||
@@ -103,7 +131,8 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
* The pattern listener that responds according to a user choosing a new
|
||||
* lock pattern.
|
||||
*/
|
||||
protected LockPatternView.OnPatternListener mChooseNewLockPatternListener = new LockPatternView.OnPatternListener() {
|
||||
protected LockPatternView.OnPatternListener mChooseNewLockPatternListener =
|
||||
new LockPatternView.OnPatternListener() {
|
||||
|
||||
public void onPatternStart() {
|
||||
mLockPatternView.removeCallbacks(mClearPatternRunnable);
|
||||
@@ -116,7 +145,8 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
|
||||
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
|
||||
if (mUiStage == Stage.NeedToConfirm || mUiStage == Stage.ConfirmWrong) {
|
||||
if (mChosenPattern == null) throw new IllegalStateException("null chosen pattern in stage 'need to confirm");
|
||||
if (mChosenPattern == null) throw new IllegalStateException(
|
||||
"null chosen pattern in stage 'need to confirm");
|
||||
if (mChosenPattern.equals(pattern)) {
|
||||
updateStage(Stage.ChoiceConfirmed);
|
||||
} else {
|
||||
@@ -266,30 +296,49 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
private static final String KEY_PATTERN_CHOICE = "chosenPattern";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
||||
}
|
||||
|
||||
setupViews();
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
// setupViews()
|
||||
View view = inflater.inflate(R.layout.choose_lock_pattern, null);
|
||||
mHeaderText = (TextView) view.findViewById(R.id.headerText);
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
|
||||
mLockPatternView.setTactileFeedbackEnabled(
|
||||
mChooseLockSettingsHelper.utils().isTactileFeedbackEnabled());
|
||||
|
||||
mFooterText = (TextView) view.findViewById(R.id.footerText);
|
||||
|
||||
mFooterLeftButton = (TextView) view.findViewById(R.id.footerLeftButton);
|
||||
mFooterRightButton = (TextView) view.findViewById(R.id.footerRightButton);
|
||||
|
||||
mFooterLeftButton.setOnClickListener(this);
|
||||
mFooterRightButton.setOnClickListener(this);
|
||||
|
||||
// make it so unhandled touch events within the unlock screen go to the
|
||||
// lock pattern view.
|
||||
final LinearLayoutWithDefaultTouchRecepient topLayout
|
||||
= (LinearLayoutWithDefaultTouchRecepient) findViewById(
|
||||
= (LinearLayoutWithDefaultTouchRecepient) view.findViewById(
|
||||
R.id.topLayout);
|
||||
topLayout.setDefaultTouchRecepient(mLockPatternView);
|
||||
|
||||
final boolean confirmCredentials = getIntent().getBooleanExtra("confirm_credentials", true);
|
||||
final boolean confirmCredentials = getActivity().getIntent()
|
||||
.getBooleanExtra("confirm_credentials", true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
if (confirmCredentials) {
|
||||
// first launch. As a security measure, we're in NeedToConfirm mode until we know
|
||||
// there isn't an existing password or the user confirms their password.
|
||||
// first launch. As a security measure, we're in NeedToConfirm mode until we
|
||||
// know there isn't an existing password or the user confirms their password.
|
||||
updateStage(Stage.NeedToConfirm);
|
||||
boolean launchedConfirmationActivity =
|
||||
mChooseLockSettingsHelper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST,
|
||||
null, null);
|
||||
mChooseLockSettingsHelper.launchConfirmationActivity(
|
||||
CONFIRM_EXISTING_REQUEST, null, null);
|
||||
if (!launchedConfirmationActivity) {
|
||||
updateStage(Stage.Introduction);
|
||||
}
|
||||
@@ -304,29 +353,7 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
}
|
||||
updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep all "find view" related stuff confined to this function since in
|
||||
* case someone needs to subclass and customize.
|
||||
*/
|
||||
protected void setupViews() {
|
||||
setContentView(R.layout.choose_lock_pattern);
|
||||
|
||||
mHeaderText = (TextView) findViewById(R.id.headerText);
|
||||
|
||||
mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
|
||||
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
|
||||
mLockPatternView.setTactileFeedbackEnabled(
|
||||
mChooseLockSettingsHelper.utils().isTactileFeedbackEnabled());
|
||||
|
||||
mFooterText = (TextView) findViewById(R.id.footerText);
|
||||
|
||||
mFooterLeftButton = (TextView) findViewById(R.id.footerLeftButton);
|
||||
mFooterRightButton = (TextView) findViewById(R.id.footerRightButton);
|
||||
|
||||
mFooterLeftButton.setOnClickListener(this);
|
||||
mFooterRightButton.setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
@@ -337,8 +364,8 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
updateStage(Stage.Introduction);
|
||||
} else if (mUiStage.leftMode == LeftButtonMode.Cancel) {
|
||||
// They are canceling the entire wizard
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
throw new IllegalStateException("left footer button pressed, but stage of " +
|
||||
mUiStage + " doesn't make sense");
|
||||
@@ -369,7 +396,6 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||
if (mUiStage == Stage.HelpScreen) {
|
||||
@@ -381,21 +407,19 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
updateStage(Stage.HelpScreen);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
outState.putInt(KEY_UI_STAGE, mUiStage.ordinal());
|
||||
if (mChosenPattern != null) {
|
||||
outState.putString(KEY_PATTERN_CHOICE, LockPatternUtils.patternToString(mChosenPattern));
|
||||
outState.putString(KEY_PATTERN_CHOICE,
|
||||
LockPatternUtils.patternToString(mChosenPattern));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the messages and buttons appropriate to what stage the user
|
||||
* is at in choosing a view. This doesn't handle clearing out the pattern;
|
||||
@@ -489,7 +513,8 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
utils.setTactileFeedbackEnabled(false);
|
||||
}
|
||||
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,15 +16,34 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class ChooseLockPatternExample extends Activity implements View.OnClickListener {
|
||||
public class ChooseLockPatternExample extends PreferenceActivity {
|
||||
|
||||
// required constructor for fragments
|
||||
public ChooseLockPatternExample() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternExampleFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static class ChooseLockPatternExampleFragment extends Fragment
|
||||
implements View.OnClickListener {
|
||||
private static final long START_DELAY = 1000;
|
||||
protected static final String TAG = "Settings";
|
||||
private View mNextButton;
|
||||
@@ -39,20 +58,30 @@ public class ChooseLockPatternExample extends Activity implements View.OnClickLi
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.choose_lock_pattern_example);
|
||||
initViews();
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.choose_lock_pattern_example, null);
|
||||
mNextButton = view.findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
mSkipButton = view.findViewById(R.id.skip_button);
|
||||
mSkipButton.setOnClickListener(this);
|
||||
|
||||
mImageView = (ImageView) view.findViewById(R.id.lock_anim);
|
||||
mImageView.setBackgroundResource(R.drawable.lock_anim);
|
||||
mImageView.setOnClickListener(this);
|
||||
mAnimation = (AnimationDrawable) mImageView.getBackground();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mHandler.postDelayed(mRunnable, START_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
stopAnimation(mAnimation);
|
||||
}
|
||||
@@ -60,31 +89,18 @@ public class ChooseLockPatternExample extends Activity implements View.OnClickLi
|
||||
public void onClick(View v) {
|
||||
if (v == mSkipButton) {
|
||||
// Canceling, so finish all
|
||||
setResult(ChooseLockPattern.RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(ChooseLockPattern.RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
} else if (v == mNextButton) {
|
||||
stopAnimation(mAnimation);
|
||||
Intent intent = new Intent(this, ChooseLockPattern.class);
|
||||
Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
intent.putExtra("confirm_credentials", false);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
mNextButton = findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
mSkipButton = findViewById(R.id.skip_button);
|
||||
mSkipButton.setOnClickListener(this);
|
||||
|
||||
mImageView = (ImageView) findViewById(R.id.lock_anim);
|
||||
mImageView.setBackgroundResource(R.drawable.lock_anim);
|
||||
mImageView.setOnClickListener(this);
|
||||
mAnimation = (AnimationDrawable) mImageView.getBackground();
|
||||
}
|
||||
|
||||
protected void startAnimation(final AnimationDrawable animation) {
|
||||
if (animation != null && !animation.isRunning()) {
|
||||
animation.run();
|
||||
@@ -95,4 +111,5 @@ public class ChooseLockPatternExample extends Activity implements View.OnClickLi
|
||||
if (animation != null && animation.isRunning()) animation.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,49 +18,70 @@ package com.android.settings;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class ChooseLockPatternTutorial extends Activity implements View.OnClickListener {
|
||||
public class ChooseLockPatternTutorial extends PreferenceActivity {
|
||||
|
||||
// required constructor for fragments
|
||||
public ChooseLockPatternTutorial() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternTutorialFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static class ChooseLockPatternTutorialFragment extends Fragment
|
||||
implements View.OnClickListener {
|
||||
private View mNextButton;
|
||||
private View mSkipButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Don't show the tutorial if the user has seen it before.
|
||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
|
||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
|
||||
if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
|
||||
Intent intent = new Intent(this, ChooseLockPattern.class);
|
||||
Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
intent.putExtra("confirm_credentials", false);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
initViews();
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
setContentView(R.layout.choose_lock_pattern_tutorial);
|
||||
mNextButton = findViewById(R.id.next_button);
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.choose_lock_pattern_tutorial, null);
|
||||
mNextButton = view.findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
mSkipButton = findViewById(R.id.skip_button);
|
||||
mSkipButton = view.findViewById(R.id.skip_button);
|
||||
mSkipButton.setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
if (v == mSkipButton) {
|
||||
// Canceling, so finish all
|
||||
setResult(ChooseLockPattern.RESULT_FINISHED);
|
||||
finish();
|
||||
getActivity().setResult(ChooseLockPattern.RESULT_FINISHED);
|
||||
getActivity().finish();
|
||||
} else if (v == mNextButton) {
|
||||
Intent intent = new Intent(this, ChooseLockPatternExample.class);
|
||||
Intent intent = new Intent(getActivity(), ChooseLockPatternExample.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,21 +20,40 @@ import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.internal.widget.PasswordEntryKeyboardHelper;
|
||||
import com.android.internal.widget.PasswordEntryKeyboardView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
public class ConfirmLockPassword extends Activity implements OnClickListener,
|
||||
public class ConfirmLockPassword extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ConfirmLockPasswordFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// Disable IME on our window since we provide our own keyboard
|
||||
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
|
||||
//WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static class ConfirmLockPasswordFragment extends Fragment implements OnClickListener,
|
||||
OnEditorActionListener {
|
||||
private static final long ERROR_MESSAGE_TIMEOUT = 3000;
|
||||
private TextView mPasswordEntry;
|
||||
@@ -44,45 +63,52 @@ public class ConfirmLockPassword extends Activity implements OnClickListener,
|
||||
private PasswordEntryKeyboardHelper mKeyboardHelper;
|
||||
private PasswordEntryKeyboardView mKeyboardView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mLockPatternUtils = new LockPatternUtils(this);
|
||||
initViews();
|
||||
|
||||
// required constructor for fragments
|
||||
public ConfirmLockPasswordFragment() {
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
|
||||
setContentView(R.layout.confirm_lock_password);
|
||||
// Disable IME on our window since we provide our own keyboard
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
|
||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
||||
}
|
||||
|
||||
findViewById(R.id.cancel_button).setOnClickListener(this);
|
||||
findViewById(R.id.next_button).setOnClickListener(this);
|
||||
mPasswordEntry = (TextView) findViewById(R.id.password_entry);
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
|
||||
View view = inflater.inflate(R.layout.confirm_lock_password, null);
|
||||
// Disable IME on our window since we provide our own keyboard
|
||||
|
||||
view.findViewById(R.id.cancel_button).setOnClickListener(this);
|
||||
view.findViewById(R.id.next_button).setOnClickListener(this);
|
||||
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
||||
mPasswordEntry.setOnEditorActionListener(this);
|
||||
mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard);
|
||||
mHeaderText = (TextView) findViewById(R.id.headerText);
|
||||
mKeyboardView = (PasswordEntryKeyboardView) view.findViewById(R.id.keyboard);
|
||||
mHeaderText = (TextView) view.findViewById(R.id.headerText);
|
||||
final boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == storedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == storedQuality
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality;
|
||||
mHeaderText.setText(isAlpha ? R.string.lockpassword_confirm_your_password_header
|
||||
: R.string.lockpassword_confirm_your_pin_header);
|
||||
mKeyboardHelper = new PasswordEntryKeyboardHelper(this, mKeyboardView, mPasswordEntry);
|
||||
mKeyboardHelper = new PasswordEntryKeyboardHelper(getActivity(),
|
||||
mKeyboardView, mPasswordEntry);
|
||||
mKeyboardHelper.setKeyboardMode(isAlpha ? PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
|
||||
: PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
|
||||
mKeyboardView.requestFocus();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mKeyboardView.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
public void onResume() {
|
||||
// TODO Auto-generated method stub
|
||||
super.onResume();
|
||||
mKeyboardView.requestFocus();
|
||||
@@ -91,8 +117,8 @@ public class ConfirmLockPassword extends Activity implements OnClickListener,
|
||||
private void handleNext() {
|
||||
final String pin = mPasswordEntry.getText().toString();
|
||||
if (mLockPatternUtils.checkPassword(pin)) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_OK);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
showError(R.string.lockpattern_need_to_unlock_wrong);
|
||||
}
|
||||
@@ -105,8 +131,8 @@ public class ConfirmLockPassword extends Activity implements OnClickListener,
|
||||
break;
|
||||
|
||||
case R.id.cancel_button:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
getActivity().setResult(RESULT_CANCELED);
|
||||
getActivity().finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -130,3 +156,4 @@ public class ConfirmLockPassword extends Activity implements OnClickListener,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,12 +22,16 @@ import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
|
||||
import com.android.internal.widget.LockPatternView.Cell;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.widget.TextView;
|
||||
import android.view.Window;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,7 +41,7 @@ import java.util.List;
|
||||
* Sets an activity result of {@link Activity#RESULT_OK} when the user
|
||||
* successfully confirmed their pattern.
|
||||
*/
|
||||
public class ConfirmLockPattern extends Activity {
|
||||
public class ConfirmLockPattern extends PreferenceActivity {
|
||||
|
||||
/**
|
||||
* Names of {@link CharSequence} fields within the originating {@link Intent}
|
||||
@@ -45,10 +49,27 @@ public class ConfirmLockPattern extends Activity {
|
||||
* The view will use the system-defined resource strings for any labels that
|
||||
* the caller does not supply.
|
||||
*/
|
||||
public static final String HEADER_TEXT = "com.android.settings.ConfirmLockPattern.header";
|
||||
public static final String FOOTER_TEXT = "com.android.settings.ConfirmLockPattern.footer";
|
||||
public static final String HEADER_WRONG_TEXT = "com.android.settings.ConfirmLockPattern.header_wrong";
|
||||
public static final String FOOTER_WRONG_TEXT = "com.android.settings.ConfirmLockPattern.footer_wrong";
|
||||
public static final String PACKAGE = "com.android.settings";
|
||||
public static final String HEADER_TEXT = PACKAGE + ".ConfirmLockPattern.header";
|
||||
public static final String FOOTER_TEXT = PACKAGE + ".ConfirmLockPattern.footer";
|
||||
public static final String HEADER_WRONG_TEXT = PACKAGE + ".ConfirmLockPattern.header_wrong";
|
||||
public static final String FOOTER_WRONG_TEXT = PACKAGE + ".ConfirmLockPattern.footer_wrong";
|
||||
|
||||
private enum Stage {
|
||||
NeedToUnlock,
|
||||
NeedToUnlockWrong,
|
||||
LockedOut
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ConfirmLockPatternFragment.class.getName());
|
||||
modIntent.putExtra(EXTRA_NO_HEADERS, true);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static class ConfirmLockPatternFragment extends Fragment {
|
||||
|
||||
// how long we wait to clear a wrong pattern
|
||||
private static final int WRONG_PATTERN_CLEAR_TIMEOUT_MS = 2000;
|
||||
@@ -69,34 +90,32 @@ public class ConfirmLockPattern extends Activity {
|
||||
private CharSequence mHeaderWrongText;
|
||||
private CharSequence mFooterWrongText;
|
||||
|
||||
// required constructor for fragments
|
||||
public ConfirmLockPatternFragment() {
|
||||
|
||||
private enum Stage {
|
||||
NeedToUnlock,
|
||||
NeedToUnlockWrong,
|
||||
LockedOut
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
||||
}
|
||||
|
||||
mLockPatternUtils = new LockPatternUtils(this);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.confirm_lock_pattern);
|
||||
|
||||
mHeaderTextView = (TextView) findViewById(R.id.headerText);
|
||||
mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
|
||||
mFooterTextView = (TextView) findViewById(R.id.footerText);
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.confirm_lock_pattern, null);
|
||||
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mFooterTextView = (TextView) view.findViewById(R.id.footerText);
|
||||
|
||||
// make it so unhandled touch events within the unlock screen go to the
|
||||
// lock pattern view.
|
||||
final LinearLayoutWithDefaultTouchRecepient topLayout
|
||||
= (LinearLayoutWithDefaultTouchRecepient) findViewById(
|
||||
R.id.topLayout);
|
||||
= (LinearLayoutWithDefaultTouchRecepient) view.findViewById(R.id.topLayout);
|
||||
topLayout.setDefaultTouchRecepient(mLockPatternView);
|
||||
|
||||
Intent intent = getIntent();
|
||||
Intent intent = getActivity().getIntent();
|
||||
if (intent != null) {
|
||||
mHeaderText = intent.getCharSequenceExtra(HEADER_TEXT);
|
||||
mFooterText = intent.getCharSequenceExtra(FOOTER_TEXT);
|
||||
@@ -115,20 +134,21 @@ public class ConfirmLockPattern extends Activity {
|
||||
// success (don't want user to get stuck confirming something that
|
||||
// doesn't exist).
|
||||
if (!mLockPatternUtils.savedPatternExists()) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
// deliberately not calling super since we are managing this in full
|
||||
outState.putInt(KEY_NUM_WRONG_ATTEMPTS, mNumWrongConfirmAttempts);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (mCountdownTimer != null) {
|
||||
@@ -137,7 +157,7 @@ public class ConfirmLockPattern extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// if the user is currently locked out, enforce it.
|
||||
@@ -212,7 +232,8 @@ public class ConfirmLockPattern extends Activity {
|
||||
* The pattern listener that responds according to a user confirming
|
||||
* an existing lock pattern.
|
||||
*/
|
||||
private LockPatternView.OnPatternListener mConfirmExistingLockPatternListener = new LockPatternView.OnPatternListener() {
|
||||
private LockPatternView.OnPatternListener mConfirmExistingLockPatternListener
|
||||
= new LockPatternView.OnPatternListener() {
|
||||
|
||||
public void onPatternStart() {
|
||||
mLockPatternView.removeCallbacks(mClearPatternRunnable);
|
||||
@@ -228,11 +249,12 @@ public class ConfirmLockPattern extends Activity {
|
||||
|
||||
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
|
||||
if (mLockPatternUtils.checkPattern(pattern)) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL &&
|
||||
++mNumWrongConfirmAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||
++mNumWrongConfirmAttempts
|
||||
>= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
|
||||
handleAttemptLockout(deadline);
|
||||
} else {
|
||||
@@ -268,3 +290,4 @@ public class ConfirmLockPattern extends Activity {
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||
private static final int FALLBACK_LOCK_AFTER_TIMEOUT_VALUE = 5000; // compatible with pre-Froyo
|
||||
|
||||
private static final String TAG = "SecuritySettings";
|
||||
|
||||
// Credential storage
|
||||
private final CredentialStorage mCredentialStorage = new CredentialStorage();
|
||||
|
||||
@@ -359,8 +361,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
|
||||
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
||||
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
||||
Intent intent = new Intent(getActivity(), ChooseLockGeneric.class);
|
||||
startActivityForResult(intent, SET_OR_CHANGE_LOCK_METHOD_REQUEST);
|
||||
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
||||
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||
} else if (KEY_LOCK_ENABLED.equals(key)) {
|
||||
lockPatternUtils.setLockPatternEnabled(isToggled(preference));
|
||||
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
||||
|
Reference in New Issue
Block a user