Skip to content

Commit

Permalink
Clicking "More" on tabLayout caused it to be displayed on toolbar (in…
Browse files Browse the repository at this point in the history
… any other language than English) (commons-app#4666)

* Changed hardcoded "More" to getStrings(R.string.more) for Unlogged user
- MainActivity toolbar showed "More" when clicked on More options
   in other language than English

* Changed hardcoded "More" to getStrings(R.string.more) for Logged user
- MainActivity toolbar showed "More" when clicked on More options
   in other language than English

* Added test for: MainActivity.setUpPager
  • Loading branch information
dado1111 authored Oct 17, 2021
1 parent 6978d00 commit 6649da8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void setSelectedItemId(int id) {

private void setUpPager() {
tabLayout.setOnNavigationItemSelectedListener(item -> {
if (!item.getTitle().equals("More")) {
if (!item.getTitle().equals(getString(R.string.more))) {
// do not change title for more fragment
setTitle(item.getTitle());
}
Expand All @@ -150,7 +150,7 @@ private void setUpPager() {
private void setUpLoggedOutPager() {
loadFragment(ExploreFragment.newInstance(),false);
tabLayout.setOnNavigationItemSelectedListener(item -> {
if (!item.getTitle().equals("More")) {
if (!item.getTitle().equals(getString(R.string.more))) {
// do not change title for more fragment
setTitle(item.getTitle());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ class MainActivityUnitTests {
activity.toggleLimitedConnectionMode()
}

@Test
@Throws(Exception::class)
fun testSetUpPager() {
val method: Method = MainActivity::class.java.getDeclaredMethod(
"setUpPager"
)
method.isAccessible = true
method.invoke(activity)
}

@Test
@Throws(Exception::class)
fun testSetUpLoggedOutPager() {
Expand Down

0 comments on commit 6649da8

Please sign in to comment.