mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Added username to picture of the day icon.
This commit is contained in:
parent
da57ffeb2e
commit
d3ce751f59
3 changed files with 36 additions and 8 deletions
|
|
@ -58,7 +58,7 @@ class LoginTask extends AsyncTask<String, String, String> {
|
|||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
Timber.d("Login done!");
|
||||
|
||||
loginActivity.getSharedPreferences("fr.free.nrw.commons", LoginActivity.MODE_PRIVATE).edit().putString("username", username).apply();
|
||||
EventLog.schema(CommonsApplication.EVENT_LOGIN_ATTEMPT)
|
||||
.param("username", username)
|
||||
.param("result", result)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package fr.free.nrw.commons.theme;
|
||||
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
|
|
@ -13,6 +15,7 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
|
@ -42,7 +45,7 @@ public class NavigationBaseActivity extends BaseActivity
|
|||
|
||||
public void initDrawer() {
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
((TextView) navigationView.getHeaderView(0).findViewById(R.id.userNameText)).setText(getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE).getString("username", ""));
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
|
||||
|
|
@ -125,6 +128,7 @@ public class NavigationBaseActivity extends BaseActivity
|
|||
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
((CommonsApplication) getApplicationContext())
|
||||
.clearApplicationData(NavigationBaseActivity.this);
|
||||
getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE).edit().remove("username").apply();
|
||||
Intent nearbyIntent = new Intent(
|
||||
NavigationBaseActivity.this, LoginActivity.class);
|
||||
nearbyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="172dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pictureOfTheDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="172dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/commons_logo_large"/>
|
||||
android:src="@drawable/commons_logo_large" />
|
||||
<TextView
|
||||
android:id="@+id/userNameText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/pictureOfTheDay"
|
||||
android:layout_alignStart="@id/pictureOfTheDay"
|
||||
android:layout_alignTop="@id/pictureOfTheDay"
|
||||
android:layout_alignRight="@id/pictureOfTheDay"
|
||||
android:layout_alignEnd="@id/pictureOfTheDay"
|
||||
android:layout_alignBottom="@id/pictureOfTheDay"
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
style="?android:textAppearanceMedium"
|
||||
android:text="@string/placeholder_place_name"
|
||||
android:textSize="40sp"
|
||||
android:textColor="#fff" />
|
||||
</RelativeLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue