mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Using general preferences instead, splitting long lines.
This commit is contained in:
parent
fba9bf0327
commit
2764bc4dd8
2 changed files with 6 additions and 3 deletions
|
|
@ -58,7 +58,8 @@ class LoginTask extends AsyncTask<String, String, String> {
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
Timber.d("Login done!");
|
Timber.d("Login done!");
|
||||||
loginActivity.getSharedPreferences("fr.free.nrw.commons", LoginActivity.MODE_PRIVATE).edit().putString("username", username).apply();
|
loginActivity.getSharedPreferences("prefs", LoginActivity.MODE_PRIVATE).edit()
|
||||||
|
.putString("username", username).apply();
|
||||||
EventLog.schema(CommonsApplication.EVENT_LOGIN_ATTEMPT)
|
EventLog.schema(CommonsApplication.EVENT_LOGIN_ATTEMPT)
|
||||||
.param("username", username)
|
.param("username", username)
|
||||||
.param("result", result)
|
.param("result", result)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ public class NavigationBaseActivity extends BaseActivity
|
||||||
|
|
||||||
public void initDrawer() {
|
public void initDrawer() {
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
((TextView) navigationView.getHeaderView(0).findViewById(R.id.userNameText)).setText(getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE).getString("username", ""));
|
((TextView) navigationView.getHeaderView(0).findViewById(R.id.userNameText))
|
||||||
|
.setText(getSharedPreferences("prefs", MODE_PRIVATE).getString("username", ""));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
|
toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
|
||||||
|
|
@ -126,7 +127,8 @@ public class NavigationBaseActivity extends BaseActivity
|
||||||
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
((CommonsApplication) getApplicationContext())
|
((CommonsApplication) getApplicationContext())
|
||||||
.clearApplicationData(NavigationBaseActivity.this);
|
.clearApplicationData(NavigationBaseActivity.this);
|
||||||
getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE).edit().remove("username").apply();
|
getSharedPreferences("prefs", MODE_PRIVATE)
|
||||||
|
.edit().remove("username").apply();
|
||||||
Intent nearbyIntent = new Intent(
|
Intent nearbyIntent = new Intent(
|
||||||
NavigationBaseActivity.this, LoginActivity.class);
|
NavigationBaseActivity.this, LoginActivity.class);
|
||||||
nearbyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
nearbyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue