mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge pull request #826 from Nethermane/master
Adding username to Drawer
This commit is contained in:
commit
9ea805f9f5
3 changed files with 34 additions and 6 deletions
|
|
@ -58,7 +58,6 @@ class LoginTask extends AsyncTask<String, String, String> {
|
|||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
Timber.d("Login done!");
|
||||
|
||||
EventLog.schema(CommonsApplication.EVENT_LOGIN_ATTEMPT)
|
||||
.param("username", username)
|
||||
.param("result", result)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package fr.free.nrw.commons.theme;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
|
@ -10,9 +12,11 @@ import android.support.v4.widget.DrawerLayout;
|
|||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
|
@ -39,9 +43,15 @@ public class NavigationBaseActivity extends BaseActivity
|
|||
DrawerLayout drawerLayout;
|
||||
|
||||
private ActionBarDrawerToggle toggle;
|
||||
private String username;
|
||||
private TextView usernameTextView;
|
||||
|
||||
public void initDrawer() {
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
username = CommonsApplication.getInstance().getCurrentAccount().name;
|
||||
usernameTextView = ((TextView) navigationView.getHeaderView(0)
|
||||
.findViewById(R.id.userNameText));
|
||||
usernameTextView.setText(username != null ? username : "");
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:layout_height="172dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pictureOfTheDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="172dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:padding="16dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.8"
|
||||
android:paddingTop="5dp"
|
||||
android:src="@drawable/commons_logo_large" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userNameText"
|
||||
style="?android:textAppearanceLargeInverse"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.2"
|
||||
android:maxLines="1"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/placeholder_place_name"
|
||||
android:textColor="@android:color/white" />
|
||||
</LinearLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue