Start to add titles, replace customTitle()

This commit is contained in:
AlbrechtRoehm 2017-01-21 19:16:45 +01:00
parent 5905af486b
commit 8cad6876f2
7 changed files with 31 additions and 2 deletions

View file

@ -471,4 +471,6 @@ To start, which parts of your life do you want to improve?</string>
<string name="warning">Warning</string>
<string name="open_settings">Open Settings</string>
<string name="dont_keep_activities_warning">It seems like you have the Developer option \"Don\'t keep Activities\" active. Currently this option causes issues with the habitica app, so we suggest disabling it.</string>
<string name="inbox">Inbox</string>
<string name="FAQ">Frequently Asked Questions</string>
</resources>

View file

@ -879,11 +879,16 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
public void setActiveFragment(BaseMainFragment fragment) {
this.activeFragment = fragment;
if(fragment.customTitle() != null){
getSupportActionBar().setTitle(fragment.customTitle());
// BUG: setTitle not changed the title, just switched the length of "username"
//setTitle(fragment.customTitle());
Log.e(getClass().getSimpleName(), fragment.customTitle());
} else {
Log.e(getClass().getSimpleName(), "User is set");
setUserTitle();
}
@ -892,7 +897,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
private void setUserTitle(){
if(user != null && user.getProfile() != null){
setTitle(user.getProfile().getName());
getSupportActionBar().setTitle(user.getProfile().getName());
}
}

View file

@ -58,4 +58,9 @@ public class FAQOverviewFragment extends BaseMainFragment {
adapter.setArticles(articles);
}
@Override
public String customTitle() {
return getString(R.string.FAQ);
}
}

View file

@ -252,4 +252,9 @@ public class GuildFragment extends BaseMainFragment implements Action1<Group> {
}
this.activity.supportInvalidateOptionsMenu();
}
@Override
public String customTitle() {
return getString(R.string.guild);
}
}

View file

@ -205,4 +205,9 @@ public class InboxFragment extends BaseMainFragment
}
}
}
@Override
public String customTitle() {
return getString(R.string.inbox);
}
}

View file

@ -65,7 +65,7 @@ public class InboxMessageListFragment extends BaseMainFragment
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
chatRecyclerView.setLayoutManager(layoutManager);
chatAdapter = new ChatRecyclerViewAdapter(messages, null, null, false);
chatAdapter = new ChatRecyclerViewAdapter(messages, user, null, false);
chatAdapter.setToInboxChat(this.replyToUserUUID);
chatAdapter.setSendingUser(this.user);
chatRecyclerView.setAdapter(chatAdapter);
@ -134,4 +134,6 @@ public class InboxMessageListFragment extends BaseMainFragment
UiUtils.dismissKeyboard(HabiticaApplication.currentActivity);
}
}

View file

@ -133,4 +133,9 @@ public class TavernFragment extends BaseMainFragment {
tabLayout.setupWithViewPager(viewPager);
}
}
@Override
public String customTitle() {
return getString(R.string.inbox);
}
}