-<?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"/>
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+ ownCloud Android client application\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 as published by\r
+ the Free Software Foundation, either version 3 of the License, or\r
+ (at your option) any later version.\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/eu.alefzero.owncloud"\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
+ />\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
+\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 android:layout_width="wrap_content"\r
+ android:layout_height="wrap_content"\r
+ android:text="@android:string/cancel"\r
+ android:textColor="@android:color/black"\r
+ android:id="@+id/cancel"/>\r
</LinearLayout>
\ No newline at end of file
\r
initDelayedTilAccountAvailabe();\r
\r
- // PIN CODE request\r
- // best location is to decide; let's try this first\r
- boolean pinStart = false;\r
- SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());\r
- pinStart = appPrefs.getBoolean("set_passcode", false);\r
- \r
- if (pinStart) {\r
- Intent i = new Intent(getApplicationContext(), PinCodeActivity.class);\r
- i.putExtra("activity", "splash");\r
- startActivity(i);\r
+ // PIN CODE request ; best location is to decide, let's try this first\r
+ //if (savedInstanceState == null) {\r
+ if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_MAIN) && savedInstanceState == null) {\r
+ requestPinCode();\r
}\r
\r
+ \r
} else {\r
\r
setContentView(R.layout.no_account_available);\r
}\r
\r
}\r
+ \r
+\r
+ /**\r
+ * Launch an intent to request the PIN code to the user before letting him use the app\r
+ */\r
+ private void requestPinCode() {\r
+ boolean pinStart = false;\r
+ SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());\r
+ pinStart = appPrefs.getBoolean("set_pincode", false);\r
+ if (pinStart) {\r
+ Intent i = new Intent(getApplicationContext(), PinCodeActivity.class);\r
+ i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "FileDisplayActivity");\r
+ startActivity(i);\r
+ }\r
+ }\r
\r
\r
}\r
public class PinCodeActivity extends SherlockFragmentActivity {
+ public final static String EXTRA_ACTIVITY = "eu.alefzero.owncloud.ui.activity.PinCodeActivity.ACTIVITY";
+ public final static String EXTRA_NEW_STATE = "eu.alefzero.owncloud.ui.activity.PinCodeActivity.NEW_STATE";
Button bCancel;
TextView mPinHdr;
setContentView(R.layout.pincodelock);
Intent intent = getIntent();
- activity = intent.getStringExtra("activity");
+ activity = intent.getStringExtra(EXTRA_ACTIVITY);
bCancel = (Button) findViewById(R.id.cancel);
mPinHdr = (TextView) findViewById(R.id.pinHdr);
@Override
public void onClick(View v) {
- // TODO Auto-generated method stub
finish();
}
});
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
- // TODO Auto-generated method stub
+
if (s.length() > 0) {
if (!confirmingPinCode){
pinCodeChecked = checkPincode();
}
- if (pinCodeChecked && activity.equals("splash")){
+ if (pinCodeChecked && activity.equals("FileDisplayActivity")){
finish();
} else if (pinCodeChecked){
Intent intent = getIntent();
- String newState = intent.getStringExtra("pinNewState");
+ String newState = intent.getStringExtra(EXTRA_NEW_STATE);
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){
+ } else if (newPasswordEntered && !confirmingPinCode){
mPinHdr.setText("Confirm your PINCode, please");
confirmingPinCode = true;
clearBoxes();
- }else {
+ } else {
confirmPincode();
}
}