Removed unused code in PreferencesActivity
This commit is contained in:
parent
d3ab3556e6
commit
7d1871ca81
@ -158,13 +158,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||||||
* User password preference changed flag
|
* User password preference changed flag
|
||||||
*/
|
*/
|
||||||
private boolean userPasswordPrefChanged = false;
|
private boolean userPasswordPrefChanged = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* User password has errors
|
|
||||||
*/
|
|
||||||
private boolean mIncorrectPassword = false;
|
|
||||||
|
|
||||||
private static final String PASSWORD_VALIDATE = "passw_validate";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows an error message.
|
* Shows an error message.
|
||||||
@ -378,14 +371,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||||||
Log.i(TAG, "Forced logout due to " + key + " change in preferences");
|
Log.i(TAG, "Forced logout due to " + key + " change in preferences");
|
||||||
userPasswordPrefChanged = true;
|
userPasswordPrefChanged = true;
|
||||||
syncPrefsChanged = true;
|
syncPrefsChanged = true;
|
||||||
mIncorrectPassword = false;
|
|
||||||
Preferences.setPreferencesChanged();
|
Preferences.setPreferencesChanged();
|
||||||
Constants.setLogged(false);
|
Constants.setLogged(false);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(), R.string.pradoLoginToast,
|
Toast.makeText(getApplicationContext(), R.string.pradoLoginToast,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
highlightPasswordSummary();
|
|
||||||
mIncorrectPassword = true;
|
|
||||||
// Do not save the password to the preferences.
|
// Do not save the password to the preferences.
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
}
|
}
|
||||||
@ -485,10 +475,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||||||
if(userPasswordPrefChanged) {
|
if(userPasswordPrefChanged) {
|
||||||
Preferences.setUserPassword(userPassword);
|
Preferences.setUserPassword(userPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIncorrectPassword)
|
|
||||||
Constants.setLogged(false);
|
|
||||||
|
|
||||||
//Reconfigure automatic synchronization
|
//Reconfigure automatic synchronization
|
||||||
if(syncPrefsChanged) {
|
if(syncPrefsChanged) {
|
||||||
SyncUtils.removePeriodicSync(Constants.AUTHORITY, Bundle.EMPTY, ctx);
|
SyncUtils.removePeriodicSync(Constants.AUTHORITY, Bundle.EMPTY, ctx);
|
||||||
@ -542,27 +529,4 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
|
|||||||
|
|
||||||
syncTimePref.setSummary(prefSyncTimeEntry);
|
syncTimePref.setSummary(prefSyncTimeEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
|
|
||||||
if (mIncorrectPassword)
|
|
||||||
outState.putBoolean(PASSWORD_VALIDATE, mIncorrectPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRestoreInstanceState(Bundle state) {
|
|
||||||
super.onRestoreInstanceState(state);
|
|
||||||
|
|
||||||
if (state.getBoolean(PASSWORD_VALIDATE)){
|
|
||||||
highlightPasswordSummary();
|
|
||||||
mIncorrectPassword = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void highlightPasswordSummary(){
|
|
||||||
userPasswordPref.setLayoutResource(R.layout.preference_child_summary_error);
|
|
||||||
userPasswordPref.setSummary(mServer.equals("swad.ugr.es") ? R.string.error_password_summaryUGR : R.string.error_password_summary);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user