Merge "Update PUK unlock screen." into ics-factoryrom
This commit is contained in:
@ -34,6 +34,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
<!-- Carrier info -->
|
||||
@ -44,6 +47,8 @@
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
<LinearLayout
|
||||
@ -51,28 +56,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginLeft="10dip">
|
||||
<TextView android:id="@+id/enter_puk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@android:string/keyguard_password_enter_puk_prompt"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginBottom="10dip"/>
|
||||
<TextView android:id="@+id/enter_pin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@android:string/keyguard_password_enter_pin_prompt"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="10dip"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
@ -92,14 +75,15 @@
|
||||
android:background="@android:drawable/edit_text">
|
||||
|
||||
<!-- displays dots as user enters puk -->
|
||||
<TextView android:id="@+id/pukDisplay"
|
||||
<EditText android:id="@+id/pukDisplay"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?android:attr/textAppearanceLargeInverse"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#000"
|
||||
android:hint="@android:string/keyguard_password_enter_puk_prompt"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/pukDel"
|
||||
@ -122,14 +106,15 @@
|
||||
android:background="@android:drawable/edit_text">
|
||||
|
||||
<!-- displays dots as user enters new pin -->
|
||||
<TextView android:id="@+id/pinDisplay"
|
||||
<EditText android:id="@+id/pinDisplay"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?android:attr/textAppearanceLargeInverse"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#000"
|
||||
android:hint="@android:string/keyguard_password_enter_pin_prompt"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/pinDel"
|
||||
@ -177,7 +162,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@android:drawable/ic_emergency"
|
||||
android:drawablePadding="8dip"
|
||||
android:drawablePadding="4dip"
|
||||
android:text="@android:string/lockscreen_emergency_call"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
@ -27,6 +27,7 @@ import com.android.internal.telephony.ITelephony;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import android.text.Editable;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -40,21 +41,20 @@ import com.android.internal.R;
|
||||
* Displays a dialer like interface to unlock the SIM PUK.
|
||||
*/
|
||||
public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
View.OnClickListener {
|
||||
View.OnClickListener, View.OnFocusChangeListener {
|
||||
|
||||
private static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
|
||||
|
||||
private final KeyguardUpdateMonitor mUpdateMonitor;
|
||||
private final KeyguardScreenCallback mCallback;
|
||||
private KeyguardStatusViewManager mKeyguardStatusViewManager;
|
||||
|
||||
private TextView mHeaderText;
|
||||
private TextView mPukText;
|
||||
private TextView mPinText;
|
||||
|
||||
private TextView mFocusedEntry;
|
||||
|
||||
private TextView mOkButton;
|
||||
|
||||
private View mOkButton;
|
||||
private View mDelPukButton;
|
||||
private View mDelPinButton;
|
||||
|
||||
@ -66,8 +66,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
|
||||
private int mKeyboardHidden;
|
||||
|
||||
private KeyguardStatusViewManager mKeyguardStatusViewManager;
|
||||
|
||||
private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
|
||||
public SimPukUnlockScreen(Context context, Configuration configuration,
|
||||
@ -92,44 +90,33 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
}
|
||||
|
||||
mHeaderText = (TextView) findViewById(R.id.headerText);
|
||||
|
||||
mPukText = (TextView) findViewById(R.id.pukDisplay);
|
||||
mPukText.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
requestFocus(mPukText);
|
||||
mCallback.pokeWakelock();
|
||||
}
|
||||
});
|
||||
mPinText = (TextView) findViewById(R.id.pinDisplay);
|
||||
mPinText.setOnClickListener(this);
|
||||
|
||||
mDelPukButton = findViewById(R.id.pukDel);
|
||||
mDelPukButton.setOnClickListener(this);
|
||||
mDelPinButton = findViewById(R.id.pinDel);
|
||||
mOkButton = findViewById(R.id.ok);
|
||||
|
||||
mDelPinButton.setOnClickListener(this);
|
||||
|
||||
mOkButton = (TextView) findViewById(R.id.ok);
|
||||
|
||||
mHeaderText.setText(R.string.keyguard_password_enter_puk_code);
|
||||
mPukText.setFocusable(false);
|
||||
mPinText.setFocusable(false);
|
||||
mDelPukButton.setOnClickListener(this);
|
||||
mOkButton.setOnClickListener(this);
|
||||
|
||||
requestFocus(mPukText);
|
||||
mHeaderText.setText(R.string.keyguard_password_enter_puk_code);
|
||||
// To make marquee work
|
||||
mHeaderText.setSelected(true);
|
||||
|
||||
mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
|
||||
lockpatternutils, callback, true);
|
||||
|
||||
setFocusableInTouchMode(true);
|
||||
}
|
||||
|
||||
private void requestFocus(TextView entry) {
|
||||
mFocusedEntry = entry;
|
||||
mFocusedEntry.setText("");
|
||||
mPinText.setFocusableInTouchMode(true);
|
||||
mPinText.setOnFocusChangeListener(this);
|
||||
mPukText.setFocusableInTouchMode(true);
|
||||
mPukText.setOnFocusChangeListener(this);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean needsInput() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@ -141,9 +128,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
public void onResume() {
|
||||
// start fresh
|
||||
mHeaderText.setText(R.string.keyguard_password_enter_puk_code);
|
||||
requestFocus(mPukText);
|
||||
mPinText.setText("");
|
||||
|
||||
mKeyguardStatusViewManager.onResume();
|
||||
}
|
||||
|
||||
@ -196,25 +180,32 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
|
||||
public void onClick(View v) {
|
||||
if (v == mDelPukButton) {
|
||||
if (mFocusedEntry != mPukText)
|
||||
mPukText.requestFocus();
|
||||
final Editable digits = mPukText.getEditableText();
|
||||
final int len = digits.length();
|
||||
if (len > 0) {
|
||||
digits.delete(len-1, len);
|
||||
}
|
||||
mCallback.pokeWakelock();
|
||||
} else if (v == mDelPinButton) {
|
||||
if (mFocusedEntry != mPinText)
|
||||
mPinText.requestFocus();
|
||||
final Editable digits = mPinText.getEditableText();
|
||||
final int len = digits.length();
|
||||
if (len > 0) {
|
||||
digits.delete(len-1, len);
|
||||
}
|
||||
mCallback.pokeWakelock();
|
||||
} else if (v == mPinText) {
|
||||
requestFocus(mPinText);
|
||||
mCallback.pokeWakelock();
|
||||
} else if (v == mOkButton) {
|
||||
checkPuk();
|
||||
}
|
||||
mCallback.pokeWakelock(DIGIT_PRESS_WAKE_MILLIS);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus)
|
||||
mFocusedEntry = (TextView)v;
|
||||
}
|
||||
|
||||
private Dialog getSimUnlockProgressDialog() {
|
||||
@ -236,7 +227,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
// otherwise, display a message to the user, and don't submit.
|
||||
mHeaderText.setText(R.string.invalidPuk);
|
||||
mPukText.setText("");
|
||||
mCallback.pokeWakelock();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -245,7 +235,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
// otherwise, display a message to the user, and don't submit.
|
||||
mHeaderText.setText(R.string.invalidPin);
|
||||
mPinText.setText("");
|
||||
mCallback.pokeWakelock();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -267,7 +256,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
mPukText.setText("");
|
||||
mPinText.setText("");
|
||||
}
|
||||
mCallback.pokeWakelock();
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
@ -290,7 +278,7 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
|
||||
if (len > 0) {
|
||||
digits.delete(len-1, len);
|
||||
}
|
||||
mCallback.pokeWakelock();
|
||||
mCallback.pokeWakelock(DIGIT_PRESS_WAKE_MILLIS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user