mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
Merge remote-tracking branch 'origin/master' into moresync
This commit is contained in:
commit
cbf9ca8bea
7 changed files with 666 additions and 1 deletions
|
@ -142,6 +142,7 @@
|
|||
</receiver>
|
||||
|
||||
<activity android:name=".ui.activity.FileDetailActivity" />
|
||||
<activity android:name=".ui.activity.PinCodeActivity" />
|
||||
<activity android:name=".extensions.ExtensionsAvailableActivity"></activity>
|
||||
<activity android:name=".extensions.ExtensionsListActivity"></activity>
|
||||
<activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
|
||||
|
|
63
res/layout/pincodelock.xml
Normal file
63
res/layout/pincodelock.xml
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
ownCloud Android client application
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:oc="http://schemas.android.com/apk/res/eu.alefzero.owncloud"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp" >
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pinHdr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Enter pin code"
|
||||
android:textColor="@android:color/black"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txt1"
|
||||
android:focusable="true"
|
||||
style="@style/PassCodeStyle" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txt2"
|
||||
style="@style/PassCodeStyle" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txt3"
|
||||
style="@style/PassCodeStyle" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txt4"
|
||||
style="@style/PassCodeStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cancel"
|
||||
android:textColor="@android:color/black"
|
||||
android:id="@+id/cancel"/>
|
||||
</LinearLayout>
|
|
@ -69,6 +69,21 @@
|
|||
<item name="@android:windowEnterAnimation">@anim/pump_bottom</item>
|
||||
<item name="@android:windowExitAnimation">@anim/disappear</item>
|
||||
</style>
|
||||
|
||||
<style name="PassCodeStyle">
|
||||
<item name="android:layout_width">50dp</item>
|
||||
<item name="android:layout_height">50dp</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_margin">10dp</item>
|
||||
<item name="android:inputType">numberDecimal</item>
|
||||
<item name="android:numeric">decimal</item>
|
||||
<item name="android:digits">1234567890</item>
|
||||
<item name="android:maxLength">1</item>
|
||||
<item name="android:password">true</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
|
||||
</style>
|
||||
|
||||
<color name="setup_text_hint">#777777</color>
|
||||
<color name="setup_text_typed">#000000</color>
|
||||
</resources>
|
|
@ -7,7 +7,12 @@
|
|||
android:title="@string/prefs_select_oc_account"
|
||||
android:summary="@string/prefs_summary_select_oc_account"
|
||||
/>
|
||||
<Preference android:title="Manage accounts" android:key="manage_account" /><CheckBoxPreference android:key="instant_uploading" android:title="Enable instant uploading" android:summary="Instantly upload photos taken by camera"/>
|
||||
<Preference android:title="Manage accounts" android:key="manage_account" />
|
||||
<CheckBoxPreference android:title="ownCloud App PIN" android:key="set_pincode"
|
||||
android:summary="Protect your ownCloud client"/>
|
||||
<CheckBoxPreference android:key="instant_uploading"
|
||||
android:title="Enable instant uploading"
|
||||
android:summary="Instantly upload photos taken by camera"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
|
@ -33,11 +33,13 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.util.Log;
|
||||
|
@ -129,6 +131,18 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
|
||||
initDelayedTilAccountAvailabe();
|
||||
|
||||
// PIN CODE request
|
||||
// best location is to decide; let's try this first
|
||||
boolean pinStart = false;
|
||||
SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
pinStart = appPrefs.getBoolean("set_passcode", false);
|
||||
|
||||
if (pinStart) {
|
||||
Intent i = new Intent(getApplicationContext(), PinCodeActivity.class);
|
||||
i.putExtra("activity", "splash");
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
setContentView(R.layout.no_account_available);
|
||||
|
|
547
src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java
Normal file
547
src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java
Normal file
|
@ -0,0 +1,547 @@
|
|||
/* ownCloud Android client application
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package eu.alefzero.owncloud.ui.activity;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
|
||||
import eu.alefzero.owncloud.R;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnFocusChangeListener;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class PinCodeActivity extends SherlockFragmentActivity {
|
||||
|
||||
|
||||
|
||||
Button bCancel;
|
||||
TextView mPinHdr;
|
||||
EditText mText1;
|
||||
EditText mText2;
|
||||
EditText mText3;
|
||||
EditText mText4;
|
||||
|
||||
String [] tempText ={"","","",""};
|
||||
|
||||
String activity;
|
||||
|
||||
boolean confirmingPinCode = false;
|
||||
boolean pinCodeChecked = false;
|
||||
boolean newPasswordEntered = false;
|
||||
boolean bChange = true; // to control that only one blocks jump
|
||||
int tCounter ; // Count the number of attempts an user could introduce de PIN code
|
||||
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.pincodelock);
|
||||
|
||||
Intent intent = getIntent();
|
||||
activity = intent.getStringExtra("activity");
|
||||
|
||||
bCancel = (Button) findViewById(R.id.cancel);
|
||||
mPinHdr = (TextView) findViewById(R.id.pinHdr);
|
||||
mText1 = (EditText) findViewById(R.id.txt1);
|
||||
mText1.requestFocus();
|
||||
mText2 = (EditText) findViewById(R.id.txt2);
|
||||
mText3 = (EditText) findViewById(R.id.txt3);
|
||||
mText4 = (EditText) findViewById(R.id.txt4);
|
||||
|
||||
|
||||
SharedPreferences appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
||||
// Not PIN Code defined yet
|
||||
if ( appPrefs.getString("PrefPinCode1", null) == null ){
|
||||
setChangePincodeView();
|
||||
pinCodeChecked = true;
|
||||
newPasswordEntered = true;
|
||||
|
||||
} else {
|
||||
setInitView();
|
||||
}
|
||||
|
||||
|
||||
setTextListeners();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setInitView(){
|
||||
bCancel.setVisibility(View.INVISIBLE);
|
||||
bCancel.setVisibility(View.GONE);
|
||||
mPinHdr.setText("Please, Insert your PIN");
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void setChangePincodeView(){
|
||||
mPinHdr.setText("Configure your PIN");
|
||||
bCancel.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
protected void setTextListeners(){
|
||||
|
||||
/*------------------------------------------------
|
||||
* FIRST BOX
|
||||
-------------------------------------------------*/
|
||||
|
||||
mText1.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// TODO Auto-generated method stub
|
||||
if (s.length() > 0) {
|
||||
if (!confirmingPinCode){
|
||||
tempText[0] = mText1.getText().toString();
|
||||
|
||||
}
|
||||
mText2.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------
|
||||
* SECOND BOX
|
||||
-------------------------------------------------*/
|
||||
mText2.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// TODO Auto-generated method stub
|
||||
if (s.length() > 0) {
|
||||
if (!confirmingPinCode){
|
||||
tempText[1] = mText2.getText().toString();
|
||||
}
|
||||
mText3.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mText2.setOnKeyListener(new OnKeyListener() {
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
|
||||
|
||||
mText1.setText("");
|
||||
mText1.requestFocus();
|
||||
tempText[0] = "";
|
||||
bChange= false;
|
||||
|
||||
}else if(!bChange){
|
||||
bChange=true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mText2.setOnFocusChangeListener(new OnFocusChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
// TODO Auto-generated method stub
|
||||
if (mText1.getText().toString().equals("")){
|
||||
mText1.requestFocus();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*------------------------------------------------
|
||||
* THIRD BOX
|
||||
-------------------------------------------------*/
|
||||
mText3.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// TODO Auto-generated method stub
|
||||
if (s.length() > 0) {
|
||||
if (!confirmingPinCode){
|
||||
tempText[2] = mText3.getText().toString();
|
||||
}
|
||||
mText4.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mText3.setOnKeyListener(new OnKeyListener() {
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
|
||||
mText2.requestFocus();
|
||||
tempText[1] = "";
|
||||
mText2.setText("");
|
||||
bChange= false;
|
||||
|
||||
}else if(!bChange){
|
||||
bChange=true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mText3.setOnFocusChangeListener(new OnFocusChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
// TODO Auto-generated method stub
|
||||
if (mText1.getText().toString().equals("")){
|
||||
mText1.requestFocus();
|
||||
}else if (mText2.getText().toString().equals("")){
|
||||
mText2.requestFocus();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/*------------------------------------------------
|
||||
* FOURTH BOX
|
||||
-------------------------------------------------*/
|
||||
mText4.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before,
|
||||
int count) {
|
||||
// TODO Auto-generated method stub
|
||||
if (s.length() > 0) {
|
||||
|
||||
if (!confirmingPinCode){
|
||||
tempText[3] = mText4.getText().toString();
|
||||
}
|
||||
mText1.requestFocus();
|
||||
|
||||
if (!pinCodeChecked){
|
||||
pinCodeChecked = checkPincode();
|
||||
}
|
||||
|
||||
if (pinCodeChecked && activity.equals("splash")){
|
||||
finish();
|
||||
} else if (pinCodeChecked){
|
||||
|
||||
Intent intent = getIntent();
|
||||
String newState = intent.getStringExtra("pinNewState");
|
||||
|
||||
if (newState.equals("false")){
|
||||
SharedPreferences.Editor appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getApplicationContext()).edit();
|
||||
appPrefs.putBoolean("set_pincode",false);
|
||||
appPrefs.commit();
|
||||
|
||||
// TODO Alert Message que salte y vuelva a la pantalla anterior
|
||||
|
||||
finish();
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
if (!confirmingPinCode && !newPasswordEntered){
|
||||
pinCodeChangeRequest();
|
||||
}else if (newPasswordEntered && !confirmingPinCode){
|
||||
mPinHdr.setText("Confirm your PINCode, please");
|
||||
confirmingPinCode = true;
|
||||
clearBoxes();
|
||||
}else {
|
||||
confirmPincode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
mText4.setOnKeyListener(new OnKeyListener() {
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL && bChange) {
|
||||
mText3.requestFocus();
|
||||
tempText[2]="";
|
||||
mText3.setText("");
|
||||
bChange= false;
|
||||
|
||||
}else if(!bChange){
|
||||
bChange=true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mText4.setOnFocusChangeListener(new OnFocusChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
// TODO Auto-generated method stub
|
||||
if (mText1.getText().toString().equals("")){
|
||||
mText1.requestFocus();
|
||||
}else if (mText2.getText().toString().equals("")){
|
||||
mText2.requestFocus();
|
||||
}else if (mText3.getText().toString().equals("")){
|
||||
mText3.requestFocus();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
} // end setTextListener
|
||||
|
||||
|
||||
protected void pinCodeChangeRequest(){
|
||||
|
||||
AlertDialog.Builder aBuilder = new AlertDialog.Builder(this);
|
||||
aBuilder.setMessage("Do yo want to set a new PIN Code")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
setChangePincodeView();
|
||||
mPinHdr.setText("Please, insert your new PIN Code");
|
||||
clearBoxes();
|
||||
newPasswordEntered = true;
|
||||
}
|
||||
})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
SharedPreferences.Editor appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getApplicationContext()).edit();
|
||||
appPrefs.putBoolean("set_pincode",false);
|
||||
appPrefs.commit();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog alert =aBuilder.create();
|
||||
|
||||
alert.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected boolean checkPincode(){
|
||||
|
||||
|
||||
SharedPreferences appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
||||
String pText1 = appPrefs.getString("PrefPinCode1", null);
|
||||
String pText2 = appPrefs.getString("PrefPinCode2", null);
|
||||
String pText3 = appPrefs.getString("PrefPinCode3", null);
|
||||
String pText4 = appPrefs.getString("PrefPinCode4", null);
|
||||
|
||||
if ( tempText[0].equals(pText1) &&
|
||||
tempText[1].equals(pText2) &&
|
||||
tempText[2].equals(pText3) &&
|
||||
tempText[3].equals(pText4) ) {
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}else {
|
||||
AlertDialog aDialog = new AlertDialog.Builder(this).create();
|
||||
aDialog.setTitle("ERROR");
|
||||
aDialog.setMessage("Wrong PIN");
|
||||
aDialog.setButton("OK", new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub("");
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
aDialog.show();
|
||||
clearBoxes();
|
||||
mPinHdr.setText("Configure your PIN");
|
||||
newPasswordEntered = true;
|
||||
confirmingPinCode = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void confirmPincode(){
|
||||
|
||||
confirmingPinCode = false;
|
||||
|
||||
String rText1 = mText1.getText().toString();
|
||||
String rText2 = mText2.getText().toString();
|
||||
String rText3 = mText3.getText().toString();
|
||||
String rText4 = mText4.getText().toString();
|
||||
|
||||
if ( tempText[0].equals(rText1) &&
|
||||
tempText[1].equals(rText2) &&
|
||||
tempText[2].equals(rText3) &&
|
||||
tempText[3].equals(rText4) ) {
|
||||
|
||||
savePincodeAndExit();
|
||||
|
||||
} else {
|
||||
|
||||
AlertDialog aDialog = new AlertDialog.Builder(this).create();
|
||||
aDialog.setTitle("ERROR");
|
||||
aDialog.setMessage("PIN Code Mismatch");
|
||||
aDialog.setButton("OK", new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub("");
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
aDialog.show();
|
||||
mPinHdr.setText("Configure your PIN");
|
||||
clearBoxes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void savePincodeAndExit(){
|
||||
SharedPreferences.Editor appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(getApplicationContext()).edit();
|
||||
|
||||
appPrefs.putString("PrefPinCode1", tempText[0]);
|
||||
appPrefs.putString("PrefPinCode2",tempText[1]);
|
||||
appPrefs.putString("PrefPinCode3", tempText[2]);
|
||||
appPrefs.putString("PrefPinCode4", tempText[3]);
|
||||
appPrefs.putBoolean("set_pincode",true);
|
||||
appPrefs.commit();
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
protected void clearBoxes(){
|
||||
|
||||
mText1.setText("");
|
||||
mText2.setText("");
|
||||
mText3.setText("");
|
||||
mText4.setText("");
|
||||
mText1.requestFocus();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -84,6 +84,26 @@ public class Preferences extends SherlockPreferenceActivity implements
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
CheckBoxPreference pCode = (CheckBoxPreference) findPreference("set_pincode");
|
||||
if (pCode != null){
|
||||
|
||||
pCode.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
|
||||
|
||||
Intent i = new Intent(getApplicationContext(), PinCodeActivity.class);
|
||||
i.putExtra("activity", "preferences");
|
||||
i.putExtra("pinNewState",newValue.toString());
|
||||
startActivity(i);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue