Replaced 'PIN code' by 'pass code'
authorDavid A. Velasco <dvelasco@solidgear.es>
Mon, 4 May 2015 09:41:09 +0000 (11:41 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Mon, 4 May 2015 09:41:09 +0000 (11:41 +0200)
AndroidManifest.xml
res/layout/passcodelock.xml [new file with mode: 0644]
res/layout/pincodelock.xml [deleted file]
res/values/strings.xml
res/xml/preferences.xml
src/com/owncloud/android/authentication/PassCodeManager.java
src/com/owncloud/android/ui/activity/PassCodeActivity.java [new file with mode: 0644]
src/com/owncloud/android/ui/activity/PinCodeActivity.java [deleted file]
src/com/owncloud/android/ui/activity/Preferences.java

index 8b9f214..2d989b1 100644 (file)
         <service android:name=".files.services.FileUploader" />
         <service android:name=".media.MediaService" />
         
-        <activity android:name=".ui.activity.PinCodeActivity" />
+        <activity android:name=".ui.activity.PassCodeActivity" />
         <activity android:name=".ui.activity.ConflictsResolveActivity"/>
         <activity android:name=".ui.activity.GenericExplanationActivity"/>
         <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
diff --git a/res/layout/passcodelock.xml b/res/layout/passcodelock.xml
new file mode 100644 (file)
index 0000000..7c87572
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2012  Bartek Przybylski
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  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/com.owncloud.android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:gravity="center_horizontal"
+    android:orientation="vertical"
+    android:padding="20dp" >
+
+
+    <TextView
+        android:id="@+id/header"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/pass_code_enter_pass_code"
+        android:textColor="@android:color/black"
+        android:gravity="center_horizontal"
+         />
+
+    <TextView
+        android:id="@+id/explanation"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/pass_code_configure_your_pass_code_explanation"
+        android:textAppearance="@android:style/TextAppearance.Small"
+        android:gravity="center_horizontal"
+         />
+    
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_horizontal" >
+
+        <EditText
+            android:id="@+id/txt1"
+            android:focusable="true"
+            style="@style/PassCodeStyle"
+            android:cursorVisible="true"
+            ><requestFocus/></EditText>
+
+        <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:id="@+id/cancel"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/common_cancel" />
+
+</LinearLayout>
diff --git a/res/layout/pincodelock.xml b/res/layout/pincodelock.xml
deleted file mode 100644 (file)
index 8c95c72..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<!--\r
-  ownCloud Android client application\r
-\r
-  Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2015 ownCloud Inc.\r
-\r
-  This program is free software: you can redistribute it and/or modify\r
-  it under the terms of the GNU General Public License version 2,\r
-  as published by the Free Software Foundation.\r
-\r
-  This program is distributed in the hope that it will be useful,\r
-  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-  GNU General Public License for more details.\r
-\r
-  You should have received a copy of the GNU General Public License\r
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-    xmlns:oc="http://schemas.android.com/apk/res/com.owncloud.android"\r
-    android:layout_width="fill_parent"\r
-    android:layout_height="fill_parent"\r
-    android:gravity="center_horizontal"\r
-    android:orientation="vertical"\r
-    android:padding="20dp" >\r
-\r
-\r
-    <TextView\r
-        android:id="@+id/pinHdr"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:text="@string/pincode_enter_pin_code"\r
-        android:textColor="@android:color/black"\r
-        android:gravity="center_horizontal"\r
-         />\r
-\r
-    <TextView\r
-        android:id="@+id/pinHdrExpl"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:text="@string/pincode_configure_your_pin_explanation"\r
-        android:textAppearance="@android:style/TextAppearance.Small"\r
-        android:gravity="center_horizontal"\r
-         />\r
-    \r
-    <LinearLayout\r
-        android:layout_width="fill_parent"\r
-        android:layout_height="wrap_content"\r
-        android:gravity="center_horizontal" >\r
-\r
-        <EditText\r
-            android:id="@+id/txt1"\r
-            android:focusable="true"\r
-            style="@style/PassCodeStyle"\r
-            android:cursorVisible="true"\r
-            ><requestFocus/></EditText>\r
-\r
-        <EditText\r
-            android:id="@+id/txt2"\r
-            style="@style/PassCodeStyle" />\r
-\r
-        <EditText\r
-            android:id="@+id/txt3"\r
-            style="@style/PassCodeStyle" />\r
-\r
-        <EditText\r
-            android:id="@+id/txt4"\r
-            style="@style/PassCodeStyle" />\r
-    </LinearLayout>\r
-\r
-    <Button\r
-        android:id="@+id/cancel"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:text="@string/common_cancel" />\r
-\r
-</LinearLayout>\r
index 71a40b5..b650264 100644 (file)
@@ -24,7 +24,7 @@
     <string name="prefs_category_more">More</string>
     <string name="prefs_accounts">Accounts</string>
     <string name="prefs_manage_accounts">Manage Accounts</string>
-    <string name="prefs_pincode">Passcode lock</string>
+    <string name="prefs_passcode">Pass code lock</string>
     <string name="prefs_instant_upload">Instant picture uploads</string>
     <string name="prefs_instant_upload_summary">Instantly upload pictures taken by camera</string>
     <string name="prefs_instant_video_upload">Instant video uploads</string>
     <string name="foreign_files_local_text">"Local: %1$s"</string>
     <string name="foreign_files_remote_text">"Remote: %1$s"</string>
     <string name="upload_query_move_foreign_files">There is not space enough to copy the selected files into the %1$s folder. Would you like to move them instead? </string>
-    <string name="pincode_enter_pin_code">Please, insert your App PIN</string>
+    <string name="pass_code_enter_pass_code">Please, insert your pass code</string>
     
-    <string name="pincode_configure_your_pin">Enter your App PIN</string>
-    <string name="pincode_configure_your_pin_explanation">The PIN will be requested every time the app is started</string>
-    <string name="pincode_reenter_your_pincode">Please, reenter your App PIN</string>
-    <string name="pincode_remove_your_pincode">Remove your App PIN</string>
-    <string name="pincode_mismatch">The App PINs are not the same</string>
-    <string name="pincode_wrong">Incorrect App PIN</string>
-    <string name="pincode_removed">App PIN removed</string>
-    <string name="pincode_stored">App PIN stored</string>
+    <string name="pass_code_configure_your_pass_code">Enter your pass code</string>
+    <string name="pass_code_configure_your_pass_code_explanation">The pass code will be requested every time the app is started</string>
+    <string name="pass_code_reenter_your_pass_code">Please, reenter your pass code</string>
+    <string name="pass_code_remove_your_pass_code">Remove your pass code</string>
+    <string name="pass_code_mismatch">The pass codes are not the same</string>
+    <string name="pass_code_wrong">Incorrect pass code</string>
+    <string name="pass_code_removed">Pass code removed</string>
+    <string name="pass_code_stored">Pass code stored</string>
     
     <string name="media_notif_ticker">"%1$s music player"</string>
     <string name="media_state_playing">"%1$s (playing)"</string>
index 18cb398..3154c91 100644 (file)
     </PreferenceCategory>
     
        <PreferenceCategory android:title="@string/prefs_category_security">
-           <!-- ListPreference
-               android:key="select_oc_account"
-               android:title="@string/prefs_select_oc_account"
-               android:summary="@string/prefs_summary_select_oc_account"
-               / -->
            <android.preference.CheckBoxPreference android:title="@string/prefs_pincode" android:key="set_pincode" />
        </PreferenceCategory>
 
index a49b2ab..6b89ab6 100644 (file)
@@ -6,11 +6,10 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.PowerManager;
 import android.preference.PreferenceManager;
-import android.view.View;
 import android.view.WindowManager;
 
 import com.owncloud.android.MainApp;
-import com.owncloud.android.ui.activity.PinCodeActivity;
+import com.owncloud.android.ui.activity.PassCodeActivity;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -21,7 +20,7 @@ public class PassCodeManager {
 
     static {
         sExemptOfPasscodeActivites = new HashSet<Class>();
-        sExemptOfPasscodeActivites.add(PinCodeActivity.class);
+        sExemptOfPasscodeActivites.add(PassCodeActivity.class);
         // other activities may be exempted, if needed
     }
 
@@ -55,8 +54,8 @@ public class PassCodeManager {
                 passCodeShouldBeRequested()
                 ){
 
-            Intent i = new Intent(MainApp.getAppContext(), PinCodeActivity.class);
-            i.setAction(PinCodeActivity.ACTION_REQUEST);
+            Intent i = new Intent(MainApp.getAppContext(), PassCodeActivity.class);
+            i.setAction(PassCodeActivity.ACTION_REQUEST);
             i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
             activity.startActivity(i);
 
diff --git a/src/com/owncloud/android/ui/activity/PassCodeActivity.java b/src/com/owncloud/android/ui/activity/PassCodeActivity.java
new file mode 100644 (file)
index 0000000..9da7784
--- /dev/null
@@ -0,0 +1,585 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2011 Bartek Przybylski
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   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 com.owncloud.android.ui.activity;
+
+import java.util.Arrays;
+
+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;
+import android.widget.Toast;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockFragmentActivity;
+import com.owncloud.android.R;
+import com.owncloud.android.utils.DisplayUtils;
+
+public class PassCodeActivity extends SherlockFragmentActivity {
+
+  
+    public final static String ACTION_TOGGLE = PassCodeActivity.class.getCanonicalName() + ".TOGGLE";
+    public final static String ACTION_REQUEST= PassCodeActivity.class.getCanonicalName()  + ".REQUEST";
+
+    public final static String EXTRA_NEW_STATE = PassCodeActivity.class.getCanonicalName() + ".NEW_STATE";
+    
+    private Button mBCancel;
+    private TextView mPassCodeHdr;
+    private TextView mPassCodeHdrExplanation;
+    private EditText mText1;
+    private EditText mText2;
+    private EditText mText3;
+    private EditText mText4;
+    
+    private String [] mTempText ={"","","",""};
+    
+    private boolean mConfirmingPassCode = false;
+    private boolean mPassCodeChecked = false;
+    private boolean mNewPasswordEntered = false;
+    private boolean mBChange = true; // to control that only one blocks jump
+    //private int mTCounter ; // Count the number of attempts an user could introduce the pass code
+
+    
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.passcodelock);
+        
+        mBCancel = (Button) findViewById(R.id.cancel);
+        mPassCodeHdr = (TextView) findViewById(R.id.header);
+        mPassCodeHdrExplanation = (TextView) findViewById(R.id.explanation);
+        mText1 = (EditText) findViewById(R.id.txt1);
+        mText1.requestFocus();
+        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);
+        
+        SharedPreferences appPrefs = PreferenceManager
+                .getDefaultSharedPreferences(getApplicationContext());
+        
+        // Not Pass Code defined yet.
+        // In a previous version settings is allow from start
+        if ( (appPrefs.getString("PrefPinCode1", null) == null ) ){
+            setChangePassCodeView(true);
+            mPassCodeChecked = true;
+            mNewPasswordEntered = true;
+            
+        } else {
+
+            /// TODO rewrite this activity; this logic is too twisted
+            if (appPrefs.getBoolean("set_pincode", false)){
+                // pass code activated
+                if (ACTION_TOGGLE.equals(getIntent().getAction())) {
+                    // pass code has been activated yet
+                    mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code);
+                    mPassCodeHdrExplanation.setVisibility(View.VISIBLE);
+                    mPassCodeChecked = true ; // No need to check it
+                    setChangePassCodeView(true);
+               } else {
+                    // pass code active
+                    mBCancel.setVisibility(View.INVISIBLE);
+                    mBCancel.setVisibility(View.GONE);
+                    mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
+                    mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
+                    setChangePassCodeView(false);
+              }
+            
+           } else {
+                // pass code removal
+                mPassCodeHdr.setText(R.string.pass_code_remove_your_pass_code);
+                mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
+                mPassCodeChecked = false;
+                setChangePassCodeView(true);
+           }
+           
+        }
+        setTextListeners();
+        
+        ActionBar actionBar = getSupportActionBar();
+        actionBar.setIcon(DisplayUtils.getSeasonalIconId());
+    }
+    
+
+     
+    protected void setInitVars(){
+        mConfirmingPassCode = false;
+        mPassCodeChecked = false;
+        mNewPasswordEntered = false;
+
+    }
+    
+    protected void setInitView(){
+        mBCancel.setVisibility(View.INVISIBLE);
+        mBCancel.setVisibility(View.GONE);
+        mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
+        mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
+    }
+    
+   
+    protected void setChangePassCodeView(boolean state){
+       
+        if(state){
+        mBCancel.setVisibility(View.VISIBLE);
+        mBCancel.setOnClickListener(new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            
+            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();
+            }
+        });
+        }  
+    
+    }
+    
+    
+    
+    /*
+     *  
+     */
+    protected void setTextListeners(){
+    
+        /*------------------------------------------------
+         *  FIRST BOX
+         -------------------------------------------------*/
+        
+        mText1.addTextChangedListener(new TextWatcher() {
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before,
+                    int count) {
+            }
+
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count,
+                    int after) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (s.length() > 0) {
+                    if (!mConfirmingPassCode){
+                       mTempText[0] = mText1.getText().toString();
+                       
+                    }
+                    mText2.requestFocus();
+                 }
+            }
+        });
+        
+        
+
+        /*------------------------------------------------
+         *  SECOND BOX 
+         -------------------------------------------------*/
+        mText2.addTextChangedListener(new TextWatcher() {
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before,
+                    int count) {
+            }
+
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count,
+                    int after) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (s.length() > 0) {
+                    if (!mConfirmingPassCode){
+                        mTempText[1] = mText2.getText().toString();
+                    }
+                    
+                    mText3.requestFocus();
+                }
+            }
+        });
+        mText2.setOnKeyListener(new OnKeyListener() {
+
+            @Override
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
+
+                    mText1.setText("");
+                    mText1.requestFocus();
+                    if (!mConfirmingPassCode)
+                       mTempText[0] = "";
+                    mBChange= false;
+                
+                }else if(!mBChange){
+                    mBChange=true;
+                    
+                }
+                return false;
+            }
+        });        
+        mText2.setOnFocusChangeListener(new OnFocusChangeListener() {
+               
+            @Override
+            public void onFocusChange(View v, boolean hasFocus) {
+                mText2.setCursorVisible(true);
+                if (mText1.getText().toString().equals("")){
+                    mText2.setSelected(false);
+                    mText2.setCursorVisible(false);
+                    mText1.requestFocus(); 
+                    mText1.setSelected(true);
+                    mText1.setSelection(0);
+                }
+                
+            }
+        });
+        
+        
+        /*------------------------------------------------
+         *  THIRD BOX
+         -------------------------------------------------*/
+        mText3.addTextChangedListener(new TextWatcher() {
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before,
+                    int count) {
+            }
+
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count,
+                    int after) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (s.length() > 0) {
+                    if (!mConfirmingPassCode){
+                        mTempText[2] = mText3.getText().toString();
+                    }
+                    mText4.requestFocus();
+                }
+            }
+        });
+        
+        mText3.setOnKeyListener(new OnKeyListener() {
+
+            @Override
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
+                    mText2.requestFocus();
+                    if (!mConfirmingPassCode)
+                        mTempText[1] = "";
+                    mText2.setText("");
+                    mBChange= false;
+                    
+                }else if(!mBChange){
+                    mBChange=true;                        
+                    
+                }
+                return false;
+            }
+        });
+        
+        mText3.setOnFocusChangeListener(new OnFocusChangeListener() {
+            
+            @Override
+            public void onFocusChange(View v, boolean hasFocus) {
+                mText3.setCursorVisible(true);
+                if (mText1.getText().toString().equals("")){
+                    mText3.setSelected(false);
+                    mText3.setCursorVisible(false);
+                    mText1.requestFocus();
+                    mText1.setSelected(true);
+                    mText1.setSelection(0);
+                }else if (mText2.getText().toString().equals("")){
+                    mText3.setSelected(false);
+                    mText3.setCursorVisible(false);
+                    mText2.requestFocus();
+                    mText2.setSelected(true);
+                    mText2.setSelection(0);
+                }
+                
+            }
+        });
+        
+        /*------------------------------------------------
+         *  FOURTH BOX
+         -------------------------------------------------*/
+        mText4.addTextChangedListener(new TextWatcher() {
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before,
+                    int count) {
+            }
+
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count,
+                    int after) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (s.length() > 0) {
+                    
+                    if (!mConfirmingPassCode){
+                       mTempText[3] = mText4.getText().toString();
+                    }
+                    mText1.requestFocus();
+
+                    if (!mPassCodeChecked){
+                        mPassCodeChecked = checkPassCode();
+                    }
+                    
+                    if (mPassCodeChecked) {
+                        if (ACTION_REQUEST.equals(getIntent().getAction())) {
+                            finish();
+
+                        } else if (mPassCodeChecked) {
+                            String newState = getIntent().getStringExtra(EXTRA_NEW_STATE);
+
+                            // TODO - next decision should done according to the current state of PIN in prefs (enable or not), not whatever says de client
+                            if (newState.equals("false")) {
+                                SharedPreferences.Editor appPrefs = PreferenceManager
+                                        .getDefaultSharedPreferences(getApplicationContext()).edit();
+                                appPrefs.putBoolean("set_pincode", false);
+                                appPrefs.commit();
+
+                                setInitVars();
+                                passCodeEnd(false);
+
+                            } else {
+
+                                if (!mConfirmingPassCode) {
+                                    passCodeChangeRequest();
+
+                                } else {
+                                    confirmPassCode();
+                                }
+                            }
+
+                        }
+                    }    
+                }
+            }
+        });
+
+        
+        
+        mText4.setOnKeyListener(new OnKeyListener() {
+
+            @Override
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
+                    mText3.requestFocus();
+                    if (!mConfirmingPassCode)
+                        mTempText[2]="";
+                    mText3.setText("");
+                    mBChange= false;
+                    
+                }else if(!mBChange){
+                    mBChange=true;    
+                }
+                return false;
+            }
+        });
+        
+       mText4.setOnFocusChangeListener(new OnFocusChangeListener() {
+            
+            @Override
+            public void onFocusChange(View v, boolean hasFocus) {
+                mText4.setCursorVisible(true);
+                
+                if (mText1.getText().toString().equals("")){
+                    mText4.setSelected(false);
+                    mText4.setCursorVisible(false);
+                    mText1.requestFocus();
+                    mText1.setSelected(true);
+                    mText1.setSelection(0);
+                }else if (mText2.getText().toString().equals("")){
+                    mText4.setSelected(false);
+                    mText4.setCursorVisible(false);
+                    mText2.requestFocus();
+                    mText2.setSelected(true);
+                    mText2.setSelection(0);
+                }else if (mText3.getText().toString().equals("")){
+                    mText4.setSelected(false);
+                    mText4.setCursorVisible(false);
+                    mText3.requestFocus();
+                    mText3.setSelected(true);
+                    mText3.setSelection(0);
+                }
+                
+            }
+        });
+        
+        
+        
+    } // end setTextListener
+    
+    
+    protected void passCodeChangeRequest(){
+    
+        clearBoxes(); 
+        mPassCodeHdr.setText(R.string.pass_code_reenter_your_pass_code);
+        mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
+        mConfirmingPassCode =true;
+        
+    }
+    
+    
+    protected boolean checkPassCode(){
+        
+        
+        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 ( mTempText[0].equals(pText1) && 
+             mTempText[1].equals(pText2) &&
+             mTempText[2].equals(pText3) &&
+             mTempText[3].equals(pText4) ) {
+            
+            return true;
+        
+        
+        }else {
+            Arrays.fill(mTempText, null);
+            CharSequence errorSeq = getString(R.string.common_error);
+            Toast.makeText(this, errorSeq, Toast.LENGTH_LONG).show();
+            
+            clearBoxes(); 
+            mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
+            mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
+            mNewPasswordEntered = true;
+            mConfirmingPassCode = false;
+            
+        }
+     
+        
+        return false;
+    }
+    
+    protected void confirmPassCode(){
+        
+        mConfirmingPassCode = false;
+        
+        String rText1 = mText1.getText().toString();
+        String rText2 = mText2.getText().toString();
+        String rText3 = mText3.getText().toString();
+        String rText4 = mText4.getText().toString();
+        
+        if ( mTempText[0].equals(rText1) && 
+             mTempText[1].equals(rText2) &&
+             mTempText[2].equals(rText3) &&
+             mTempText[3].equals(rText4) ) {
+                        
+            savePassCodeAndExit();
+            
+        } else {
+            Arrays.fill(mTempText, null);
+            CharSequence cseq = getString(R.string.pass_code_mismatch);
+            Toast.makeText(this, cseq, Toast.LENGTH_LONG).show();
+            
+            mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code);
+            mPassCodeHdrExplanation.setVisibility(View.VISIBLE);
+            clearBoxes();
+        }
+    
+    }
+   
+    
+    protected void passCodeEnd(boolean state){
+        CharSequence cseq;
+        if (state){
+           cseq = getString(R.string.pass_code_stored);
+        }else{
+             cseq = getString(R.string.pass_code_removed);
+        }
+        
+        Toast.makeText(this, cseq, Toast.LENGTH_LONG).show();
+        finish();
+    }
+    
+    protected void savePassCodeAndExit(){
+        SharedPreferences.Editor appPrefs = PreferenceManager
+                .getDefaultSharedPreferences(getApplicationContext()).edit();
+        
+        appPrefs.putString("PrefPinCode1", mTempText[0]);
+        appPrefs.putString("PrefPinCode2",mTempText[1]);
+        appPrefs.putString("PrefPinCode3", mTempText[2]);
+        appPrefs.putString("PrefPinCode4", mTempText[3]);
+        appPrefs.putBoolean("set_pincode",true);
+        appPrefs.commit();
+        
+        passCodeEnd(true);
+    }
+    
+    
+    protected void clearBoxes(){
+        mText1.setText("");
+        mText2.setText("");
+        mText3.setText("");
+        mText4.setText("");
+        mText1.requestFocus(); 
+    }
+    
+    
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event){
+        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount()== 0){
+            if (ACTION_TOGGLE.equals(getIntent().getAction())){
+                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; 
+        }
+        return super.onKeyDown(keyCode, event);
+    }     
+}
diff --git a/src/com/owncloud/android/ui/activity/PinCodeActivity.java b/src/com/owncloud/android/ui/activity/PinCodeActivity.java
deleted file mode 100644 (file)
index 11ddf11..0000000
+++ /dev/null
@@ -1,589 +0,0 @@
-/**
- *   ownCloud Android client application
- *
- *   Copyright (C) 2011 Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2,
- *   as published by the Free Software Foundation.
- *
- *   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 com.owncloud.android.ui.activity;
-
-import java.util.Arrays;
-
-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;
-import android.widget.Toast;
-
-import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.SherlockFragmentActivity;
-import com.owncloud.android.R;
-import com.owncloud.android.authentication.PassCodeManager;
-import com.owncloud.android.utils.DisplayUtils;
-
-public class PinCodeActivity extends SherlockFragmentActivity {
-
-  
-    public final static String ACTION_TOGGLE = PinCodeActivity.class.getCanonicalName() + ".TOGGLE";
-    public final static String ACTION_REQUEST= PinCodeActivity.class.getCanonicalName()  + ".REQUEST";
-
-    public final static String EXTRA_NEW_STATE = "com.owncloud.android.ui.activity.PinCodeActivity.NEW_STATE";
-    
-    private Button mBCancel;
-    private TextView mPinHdr;
-    private TextView mPinHdrExplanation;
-    private EditText mText1;
-    private EditText mText2;
-    private EditText mText3;
-    private EditText mText4;
-    
-    private String [] mTempText ={"","","",""};
-    
-    private boolean mConfirmingPinCode = false;
-    private boolean mPinCodeChecked = false;
-    private boolean mNewPasswordEntered = false;
-    private boolean mBChange = true; // to control that only one blocks jump
-    //private int mTCounter ; // Count the number of attempts an user could introduce the PIN code
-
-    
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.pincodelock); 
-        
-        mBCancel = (Button) findViewById(R.id.cancel);
-        mPinHdr = (TextView) findViewById(R.id.pinHdr);
-        mPinHdrExplanation = (TextView) findViewById(R.id.pinHdrExpl);
-        mText1 = (EditText) findViewById(R.id.txt1);
-        mText1.requestFocus();
-        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);
-        
-        SharedPreferences appPrefs = PreferenceManager
-                .getDefaultSharedPreferences(getApplicationContext());
-        
-        // Not PIN Code defined yet.
-        // In a previous version settings is allow from start
-        if ( (appPrefs.getString("PrefPinCode1", null) == null ) ){
-            setChangePincodeView(true);
-            mPinCodeChecked = true; 
-            mNewPasswordEntered = true;
-            
-        } else {
-
-            /// TODO rewrite this activity; this logic is too twisted
-            if (appPrefs.getBoolean("set_pincode", false)){
-                // pincode activated
-                if (ACTION_TOGGLE.equals(getIntent().getAction())) {
-                    // PIN has been activated yet
-                    mPinHdr.setText(R.string.pincode_configure_your_pin);
-                    mPinHdrExplanation.setVisibility(View.VISIBLE);
-                    mPinCodeChecked = true ; // No need to check it
-                    setChangePincodeView(true);
-               } else {
-                    // PIN active
-                    mBCancel.setVisibility(View.INVISIBLE);
-                    mBCancel.setVisibility(View.GONE);
-                    mPinHdr.setText(R.string.pincode_enter_pin_code);
-                    mPinHdrExplanation.setVisibility(View.INVISIBLE);
-                    setChangePincodeView(false);
-              }
-            
-           } else {
-                // pincode removal
-                mPinHdr.setText(R.string.pincode_remove_your_pincode);
-                mPinHdrExplanation.setVisibility(View.INVISIBLE);
-                mPinCodeChecked = false;
-                setChangePincodeView(true);
-           }
-           
-        }
-        setTextListeners();
-        
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setIcon(DisplayUtils.getSeasonalIconId());
-    }
-    
-
-     
-    protected void setInitVars(){
-        mConfirmingPinCode = false;
-        mPinCodeChecked = false;
-        mNewPasswordEntered = false;
-
-    }
-    
-    protected void setInitView(){
-        mBCancel.setVisibility(View.INVISIBLE);
-        mBCancel.setVisibility(View.GONE);
-        mPinHdr.setText(R.string.pincode_enter_pin_code);
-        mPinHdrExplanation.setVisibility(View.INVISIBLE);
-    }
-    
-   
-    protected void setChangePincodeView(boolean state){
-       
-        if(state){
-        mBCancel.setVisibility(View.VISIBLE);
-        mBCancel.setOnClickListener(new OnClickListener() {
-        @Override
-        public void onClick(View v) {
-            
-            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();
-            }
-        });
-        }  
-    
-    }
-    
-    
-    
-    /*
-     *  
-     */
-    protected void setTextListeners(){
-    
-        /*------------------------------------------------
-         *  FIRST BOX
-         -------------------------------------------------*/
-        
-        mText1.addTextChangedListener(new TextWatcher() {
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before,
-                    int count) {
-            }
-
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count,
-                    int after) {
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                if (s.length() > 0) {
-                    if (!mConfirmingPinCode){
-                       mTempText[0] = mText1.getText().toString();
-                       
-                    }
-                    mText2.requestFocus();
-                 }
-            }
-        });
-        
-        
-
-        /*------------------------------------------------
-         *  SECOND BOX 
-         -------------------------------------------------*/
-        mText2.addTextChangedListener(new TextWatcher() {
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before,
-                    int count) {
-            }
-
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count,
-                    int after) {
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                if (s.length() > 0) {
-                    if (!mConfirmingPinCode){
-                        mTempText[1] = mText2.getText().toString();
-                    }
-                    
-                    mText3.requestFocus();
-                }
-            }
-        });
-        mText2.setOnKeyListener(new OnKeyListener() {
-
-            @Override
-            public boolean onKey(View v, int keyCode, KeyEvent event) {
-                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
-
-                    mText1.setText("");
-                    mText1.requestFocus();
-                    if (!mConfirmingPinCode)
-                       mTempText[0] = "";
-                    mBChange= false;
-                
-                }else if(!mBChange){
-                    mBChange=true;
-                    
-                }
-                return false;
-            }
-        });        
-        mText2.setOnFocusChangeListener(new OnFocusChangeListener() {
-               
-            @Override
-            public void onFocusChange(View v, boolean hasFocus) {
-                mText2.setCursorVisible(true);
-                if (mText1.getText().toString().equals("")){
-                    mText2.setSelected(false);
-                    mText2.setCursorVisible(false);
-                    mText1.requestFocus(); 
-                    mText1.setSelected(true);
-                    mText1.setSelection(0);
-                }
-                
-            }
-        });
-        
-        
-        /*------------------------------------------------
-         *  THIRD BOX
-         -------------------------------------------------*/
-        mText3.addTextChangedListener(new TextWatcher() {
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before,
-                    int count) {
-            }
-
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count,
-                    int after) {
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                if (s.length() > 0) {
-                    if (!mConfirmingPinCode){
-                        mTempText[2] = mText3.getText().toString();
-                    }
-                    mText4.requestFocus();
-                }
-            }
-        });
-        
-        mText3.setOnKeyListener(new OnKeyListener() {
-
-            @Override
-            public boolean onKey(View v, int keyCode, KeyEvent event) {
-                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
-                    mText2.requestFocus();
-                    if (!mConfirmingPinCode)
-                        mTempText[1] = "";
-                    mText2.setText("");
-                    mBChange= false;
-                    
-                }else if(!mBChange){
-                    mBChange=true;                        
-                    
-                }
-                return false;
-            }
-        });
-        
-        mText3.setOnFocusChangeListener(new OnFocusChangeListener() {
-            
-            @Override
-            public void onFocusChange(View v, boolean hasFocus) {
-                mText3.setCursorVisible(true);
-                if (mText1.getText().toString().equals("")){
-                    mText3.setSelected(false);
-                    mText3.setCursorVisible(false);
-                    mText1.requestFocus();
-                    mText1.setSelected(true);
-                    mText1.setSelection(0);
-                }else if (mText2.getText().toString().equals("")){
-                    mText3.setSelected(false);
-                    mText3.setCursorVisible(false);
-                    mText2.requestFocus();
-                    mText2.setSelected(true);
-                    mText2.setSelection(0);
-                }
-                
-            }
-        });
-        
-        /*------------------------------------------------
-         *  FOURTH BOX
-         -------------------------------------------------*/
-        mText4.addTextChangedListener(new TextWatcher() {
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before,
-                    int count) {
-            }
-
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count,
-                    int after) {
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                if (s.length() > 0) {
-                    
-                    if (!mConfirmingPinCode){
-                       mTempText[3] = mText4.getText().toString();
-                    }
-                    mText1.requestFocus();
-
-                    if (!mPinCodeChecked){
-                        mPinCodeChecked = checkPincode();
-                    }
-                    
-                    if (mPinCodeChecked) {
-                        // TODO remove or update:
-                        // PassCodeManager.setUnlockTimestamp();
-
-                        if (ACTION_REQUEST.equals(getIntent().getAction())) {
-                            finish();
-
-                        } else if (mPinCodeChecked) {
-                            String newState = getIntent().getStringExtra(EXTRA_NEW_STATE);
-
-                            // TODO - next decision should done according to the current state of PIN in prefs (enable or not), not whatever says de client
-                            if (newState.equals("false")) {
-                                SharedPreferences.Editor appPrefs = PreferenceManager
-                                        .getDefaultSharedPreferences(getApplicationContext()).edit();
-                                appPrefs.putBoolean("set_pincode", false);
-                                appPrefs.commit();
-
-                                setInitVars();
-                                pinCodeEnd(false);
-
-                            } else {
-
-                                if (!mConfirmingPinCode) {
-                                    pinCodeChangeRequest();
-
-                                } else {
-                                    confirmPincode();
-                                }
-                            }
-
-                        }
-                    }    
-                }
-            }
-        });
-
-        
-        
-        mText4.setOnKeyListener(new OnKeyListener() {
-
-            @Override
-            public boolean onKey(View v, int keyCode, KeyEvent event) {
-                if (keyCode == KeyEvent.KEYCODE_DEL && mBChange) {
-                    mText3.requestFocus();
-                    if (!mConfirmingPinCode)
-                        mTempText[2]="";
-                    mText3.setText("");
-                    mBChange= false;
-                    
-                }else if(!mBChange){
-                    mBChange=true;    
-                }
-                return false;
-            }
-        });
-        
-       mText4.setOnFocusChangeListener(new OnFocusChangeListener() {
-            
-            @Override
-            public void onFocusChange(View v, boolean hasFocus) {
-                mText4.setCursorVisible(true);
-                
-                if (mText1.getText().toString().equals("")){
-                    mText4.setSelected(false);
-                    mText4.setCursorVisible(false);
-                    mText1.requestFocus();
-                    mText1.setSelected(true);
-                    mText1.setSelection(0);
-                }else if (mText2.getText().toString().equals("")){
-                    mText4.setSelected(false);
-                    mText4.setCursorVisible(false);
-                    mText2.requestFocus();
-                    mText2.setSelected(true);
-                    mText2.setSelection(0);
-                }else if (mText3.getText().toString().equals("")){
-                    mText4.setSelected(false);
-                    mText4.setCursorVisible(false);
-                    mText3.requestFocus();
-                    mText3.setSelected(true);
-                    mText3.setSelection(0);
-                }
-                
-            }
-        });
-        
-        
-        
-    } // end setTextListener
-    
-    
-    protected void pinCodeChangeRequest(){
-    
-        clearBoxes(); 
-        mPinHdr.setText(R.string.pincode_reenter_your_pincode); 
-        mPinHdrExplanation.setVisibility(View.INVISIBLE);        
-        mConfirmingPinCode =true;
-        
-    }
-    
-    
-    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 ( mTempText[0].equals(pText1) && 
-             mTempText[1].equals(pText2) &&
-             mTempText[2].equals(pText3) &&
-             mTempText[3].equals(pText4) ) {
-            
-            return true;
-        
-        
-        }else {
-            Arrays.fill(mTempText, null);
-            CharSequence errorSeq = getString(R.string.common_error);
-            Toast.makeText(this, errorSeq, Toast.LENGTH_LONG).show();
-            
-            clearBoxes(); 
-            mPinHdr.setText(R.string.pincode_enter_pin_code);
-            mPinHdrExplanation.setVisibility(View.INVISIBLE);
-            mNewPasswordEntered = true;
-            mConfirmingPinCode = false;
-            
-        }
-     
-        
-        return false;
-    }
-    
-    protected void confirmPincode(){
-        
-        mConfirmingPinCode = false;
-        
-        String rText1 = mText1.getText().toString();
-        String rText2 = mText2.getText().toString();
-        String rText3 = mText3.getText().toString();
-        String rText4 = mText4.getText().toString();
-        
-        if ( mTempText[0].equals(rText1) && 
-             mTempText[1].equals(rText2) &&
-             mTempText[2].equals(rText3) &&
-             mTempText[3].equals(rText4) ) {
-                        
-            savePincodeAndExit();
-            
-        } else {
-            Arrays.fill(mTempText, null);
-            CharSequence cseq = getString(R.string.pincode_mismatch);
-            Toast.makeText(this, cseq, Toast.LENGTH_LONG).show();
-            
-            mPinHdr.setText(R.string.pincode_configure_your_pin);
-            mPinHdrExplanation.setVisibility(View.VISIBLE);
-            clearBoxes();
-        }
-    
-    }
-   
-    
-    protected void pinCodeEnd(boolean state){
-        CharSequence cseq;
-        if (state){
-           cseq = getString(R.string.pincode_stored);
-        }else{
-             cseq = getString(R.string.pincode_removed);
-        }
-        
-        Toast.makeText(this, cseq, Toast.LENGTH_LONG).show();
-        finish();
-    }
-    
-    protected void savePincodeAndExit(){
-        SharedPreferences.Editor appPrefs = PreferenceManager
-                .getDefaultSharedPreferences(getApplicationContext()).edit();
-        
-        appPrefs.putString("PrefPinCode1", mTempText[0]);
-        appPrefs.putString("PrefPinCode2",mTempText[1]);
-        appPrefs.putString("PrefPinCode3", mTempText[2]);
-        appPrefs.putString("PrefPinCode4", mTempText[3]);
-        appPrefs.putBoolean("set_pincode",true);
-        appPrefs.commit();
-        
-        pinCodeEnd(true);
-    }
-    
-    
-    protected void clearBoxes(){
-        mText1.setText("");
-        mText2.setText("");
-        mText3.setText("");
-        mText4.setText("");
-        mText1.requestFocus(); 
-    }
-    
-    
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event){
-        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount()== 0){
-            if (ACTION_TOGGLE.equals(getIntent().getAction())){
-                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; 
-        }
-        return super.onKeyDown(keyCode, event);
-    }     
-}
index 7429f32..e66cefd 100644 (file)
@@ -58,7 +58,6 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AuthenticatorActivity;
-import com.owncloud.android.authentication.PassCodeManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.db.DbHandler;
@@ -167,9 +166,9 @@ public class Preferences extends SherlockPreferenceActivity
             pCode.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
                 @Override
                 public boolean onPreferenceChange(Preference preference, Object newValue) {
-                    Intent i = new Intent(getApplicationContext(), PinCodeActivity.class);
-                    i.setAction(PinCodeActivity.ACTION_TOGGLE);
-                    i.putExtra(PinCodeActivity.EXTRA_NEW_STATE, newValue.toString());
+                    Intent i = new Intent(getApplicationContext(), PassCodeActivity.class);
+                    i.setAction(PassCodeActivity.ACTION_TOGGLE);
+                    i.putExtra(PassCodeActivity.EXTRA_NEW_STATE, newValue.toString());
                     startActivity(i);
                     
                     return true;