From: David A. Velasco Date: Fri, 13 Jul 2012 12:46:40 +0000 (+0200) Subject: More fixes to PIN code X-Git-Tag: oc-android-1.4.3~276 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/91b1728493397437b37a03740260f43fdd82f173?hp=--cc More fixes to PIN code --- 91b1728493397437b37a03740260f43fdd82f173 diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3af24ef1..5a3060e4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,7 +18,7 @@ --> + android:versionName="0.1.158B" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/res/values/strings.xml b/res/values/strings.xml index b62ba9bb..c53e475a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -75,10 +75,14 @@ Use Secure Connection ownCloud cannot track your device. Please check your location settings - Please, insert your PIN code - Please, insert your new PIN code - Configure your PIN code - "Confirm your PIN code, please" + Please, insert your App PIN + Please, insert your new App PIN + Enter ownCloud App PIN + Reenter ownCloud App PIN, please; + Remove your ownCloud App PIN; + Both ownCloud App PIN are not the same; + Incorrect ownCloud App PIN; + 15 Minutes @@ -122,10 +126,10 @@ Rename Remove - "Do you really want " - "?" - - "Successful removal" - "Removal could not be completed" - + Do you really want + "?" + + "Successful removal" + "Removal could not be completed" + diff --git a/src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java b/src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java index d2ad198d..d9ae73c5 100644 --- a/src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/PinCodeActivity.java @@ -60,7 +60,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { 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 + int tCounter ; // Count the number of attempts an user could introduce the PIN code protected void onCreate(Bundle savedInstanceState) { @@ -74,7 +74,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { mPinHdr = (TextView) findViewById(R.id.pinHdr); mText1 = (EditText) findViewById(R.id.txt1); mText1.requestFocus(); - getWindow().setSoftInputMode(android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); + getWindow().setSoftInputMode(android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); mText2 = (EditText) findViewById(R.id.txt2); mText3 = (EditText) findViewById(R.id.txt3); mText4 = (EditText) findViewById(R.id.txt4); @@ -91,29 +91,42 @@ public class PinCodeActivity extends SherlockFragmentActivity { pinCodeChecked = true; newPasswordEntered = true; - }else if (appPrefs.getBoolean("set_pincode", false)){ - if (activity.equals("preferences")){ - mPinHdr.setText(R.string.pincode_configure_your_pin); - setChangePincodeView(true); - }else{ - bCancel.setVisibility(View.INVISIBLE); - bCancel.setVisibility(View.GONE); - mPinHdr.setText(R.string.pincode_enter_pin_code); - setChangePincodeView(false); - } + }else{ - }else { - mPinHdr.setText(R.string.pincode_enter_pin_code); - pinCodeChecked = true; - setChangePincodeView(true); - } + if (appPrefs.getBoolean("set_pincode", false)){ + // pincode activated + if (activity.equals("preferences")){ + // PIN has been activated yet + mPinHdr.setText(R.string.pincode_configure_your_pin); + pinCodeChecked = true ; // No need to check it + setChangePincodeView(true); + }else{ + // PIN active + bCancel.setVisibility(View.INVISIBLE); + bCancel.setVisibility(View.GONE); + mPinHdr.setText(R.string.pincode_enter_pin_code); + setChangePincodeView(false); + } + + }else { + // pincode removal + mPinHdr.setText(R.string.pincode_enter_pin_code); + pinCodeChecked = false; + setChangePincodeView(true); + } - + } setTextListeners(); } - + + protected void setInitVars(){ + confirmingPinCode = false; + pinCodeChecked = false; + newPasswordEntered = false; + + } protected void setInitView(){ bCancel.setVisibility(View.INVISIBLE); @@ -139,7 +152,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { boolean state = appPrefs.getBoolean("set_pincode", false); appPrefsE.putBoolean("set_pincode",!state); appPrefsE.commit(); - + setInitVars(); finish(); } }); @@ -351,6 +364,8 @@ public class PinCodeActivity extends SherlockFragmentActivity { .getDefaultSharedPreferences(getApplicationContext()).edit(); appPrefs.putBoolean("set_pincode",false); appPrefs.commit(); + + setInitVars(); pinCodeEnd(false); }else{ @@ -358,7 +373,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { if (!confirmingPinCode && !newPasswordEntered){ pinCodeChangeRequest(); } else if (newPasswordEntered && !confirmingPinCode){ - mPinHdr.setText(R.string.pincode_confirm_your_pincode); + mPinHdr.setText(R.string.pincode_reenter_your_pincode); confirmingPinCode = true; clearBoxes(); } else { @@ -431,7 +446,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { protected void pinCodeChangeRequest(){ clearBoxes(); - mPinHdr.setText(R.string.pincode_confirm_your_pincode); + mPinHdr.setText(R.string.pincode_reenter_your_pincode); confirmingPinCode =true; } @@ -459,7 +474,8 @@ public class PinCodeActivity extends SherlockFragmentActivity { }else { AlertDialog aDialog = new AlertDialog.Builder(this).create(); aDialog.setTitle("ERROR"); - aDialog.setMessage("Wrong PIN"); + CharSequence cseq = getString(R.string.pincode_wrong); + aDialog.setMessage(cseq); aDialog.setButton("OK", new DialogInterface.OnClickListener(){ @Override @@ -471,7 +487,7 @@ public class PinCodeActivity extends SherlockFragmentActivity { }); aDialog.show(); clearBoxes(); - mPinHdr.setText(R.string.pincode_configure_your_pin); + mPinHdr.setText(R.string.pincode_enter_pin_code); newPasswordEntered = true; confirmingPinCode = false; @@ -501,7 +517,8 @@ public class PinCodeActivity extends SherlockFragmentActivity { AlertDialog aDialog = new AlertDialog.Builder(this).create(); aDialog.setTitle("ERROR"); - aDialog.setMessage("PIN Code Mismatch"); + CharSequence cseq = getString(R.string.pincode_mismatch); + aDialog.setMessage(cseq); aDialog.setButton("OK", new DialogInterface.OnClickListener(){ @Override @@ -575,7 +592,20 @@ public class PinCodeActivity extends SherlockFragmentActivity { public boolean onKeyDown(int keyCode, KeyEvent event){ if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount()== 0){ + if (activity.equals("preferences")){ + SharedPreferences.Editor appPrefsE = PreferenceManager + + .getDefaultSharedPreferences(getApplicationContext()).edit(); + + SharedPreferences appPrefs = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); + boolean state = appPrefs.getBoolean("set_pincode", false); + appPrefsE.putBoolean("set_pincode",!state); + appPrefsE.commit(); + setInitVars(); + finish(); + } return true; }