From 2a418e06da843fa2073165570d6020876f42f10c Mon Sep 17 00:00:00 2001 From: Zachary Epps Date: Fri, 7 Apr 2017 04:14:25 -0400 Subject: [PATCH] changed the construction of the AccountHeader so that it listens for clicks on the current profile avatar and opens the user's account if they click on it --- .../com/keylesspalace/tusky/MainActivity.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index a75e869e4..662c4e0f9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -49,6 +49,7 @@ import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.ProfileDrawerItem; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; +import com.mikepenz.materialdrawer.model.interfaces.IProfile; import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader; import com.mikepenz.materialdrawer.util.DrawerImageLoader; import com.squareup.picasso.Picasso; @@ -212,6 +213,23 @@ public class MainActivity extends BaseActivity { .withActivity(this) .withSelectionListEnabledForSingleProfile(false) .withDividerBelowHeader(false) + .withOnAccountHeaderProfileImageListener(new AccountHeader.OnAccountHeaderProfileImageListener() { + @Override + public boolean onProfileImageClick(View view, IProfile profile, boolean current) { + if (current && loggedInAccountId != null) { + Intent intent = new Intent(MainActivity.this, AccountActivity.class); + intent.putExtra("id", loggedInAccountId); + startActivity(intent); + return true; + } + return false; + } + + @Override + public boolean onProfileImageLongClick(View view, IProfile profile, boolean current) { + return false; + } + }) .withCompactStyle(true) .build();