Browse Source

Default Avatar when user has none

Disabled topic title's scrollability
pull/24/head
Ezerous 7 years ago
parent
commit
e53264b6d6
  1. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  2. 20
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

1
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -214,6 +214,7 @@ public class TopicActivity extends BaseActivity {
toolbarTitle.setMarqueeRepeatLimit(-1); toolbarTitle.setMarqueeRepeatLimit(-1);
toolbarTitle.setText(topicTitle); toolbarTitle.setText(topicTitle);
toolbarTitle.setSelected(true); toolbarTitle.setSelected(true);
toolbarTitle.setEnabled(false);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

20
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -358,14 +358,15 @@ public abstract class BaseActivity extends AppCompatActivity {
{ {
drawer.removeItem(DOWNLOADS_ID); drawer.removeItem(DOWNLOADS_ID);
loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login
profileDrawerItem.withName(sessionManager.getUsername()).withIcon(new IconicsDrawable(this) profileDrawerItem.withName(sessionManager.getUsername());
.icon(FontAwesome.Icon.faw_user) setDefaultAvatar();
.paddingDp(10)
.color(ContextCompat.getColor(this, R.color.primary_light))
.backgroundColor(ContextCompat.getColor(this, R.color.primary)));
} else { } else {
loginLogoutItem.withName(R.string.logout).withIcon(logoutIcon); //Swap login with logout loginLogoutItem.withName(R.string.logout).withIcon(logoutIcon); //Swap login with logout
profileDrawerItem.withName(sessionManager.getUsername()).withIcon(sessionManager.getAvatarLink()); profileDrawerItem.withName(sessionManager.getUsername());
if(sessionManager.hasAvatar())
profileDrawerItem.withIcon(sessionManager.getAvatarLink());
else
setDefaultAvatar();
} }
accountHeader.updateProfile(profileDrawerItem); accountHeader.updateProfile(profileDrawerItem);
drawer.updateItem(loginLogoutItem); drawer.updateItem(loginLogoutItem);
@ -373,6 +374,13 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
} }
private void setDefaultAvatar() {
profileDrawerItem.withIcon(new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_user)
.paddingDp(10)
.color(ContextCompat.getColor(this, R.color.primary_light))
.backgroundColor(ContextCompat.getColor(this, R.color.primary)));
}
//-------------------------------------------LOGOUT------------------------------------------------- //-------------------------------------------LOGOUT-------------------------------------------------

Loading…
Cancel
Save