mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Main activity title is sometimes "Contributions", sometimes "Commons" (#4472)
Fixes #4438 Replace == with equals() in onRestoreInstanceState
This commit is contained in:
parent
7b016c7dcf
commit
399d798159
1 changed files with 12 additions and 7 deletions
|
|
@ -4,13 +4,12 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
|
@ -247,17 +246,23 @@ public class MainActivity extends BaseActivity
|
|||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
String currentFragmentName = savedInstanceState.getString("activeFragment");
|
||||
if(currentFragmentName == ActiveFragment.CONTRIBUTIONS.name()) {
|
||||
String activeFragmentName = savedInstanceState.getString("activeFragment");
|
||||
if(activeFragmentName != null) {
|
||||
restoreActiveFragment(activeFragmentName);
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreActiveFragment(@NonNull String fragmentName) {
|
||||
if(fragmentName.equals(ActiveFragment.CONTRIBUTIONS.name())) {
|
||||
setTitle(getString(R.string.contributions_fragment));
|
||||
loadFragment(ContributionsFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.NEARBY.name()) {
|
||||
}else if(fragmentName.equals(ActiveFragment.NEARBY.name())) {
|
||||
setTitle(getString(R.string.nearby_fragment));
|
||||
loadFragment(NearbyParentFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.EXPLORE.name()) {
|
||||
}else if(fragmentName.equals(ActiveFragment.EXPLORE.name())) {
|
||||
setTitle(getString(R.string.navigation_item_explore));
|
||||
loadFragment(ExploreFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.BOOKMARK.name()) {
|
||||
}else if(fragmentName.equals(ActiveFragment.BOOKMARK.name())) {
|
||||
setTitle(getString(R.string.favorites));
|
||||
loadFragment(BookmarkFragment.newInstance(),false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue