removed Last_Fragment 2
This commit is contained in:
@@ -64,6 +64,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
private NavigationView mNavigationView;
|
private NavigationView mNavigationView;
|
||||||
|
|
||||||
private int fragmentPage = FRAGMENT_NONE;
|
private int fragmentPage = FRAGMENT_NONE;
|
||||||
|
private int currentPage = FRAGMENT_NONE;
|
||||||
private String fragmentData = "";
|
private String fragmentData = "";
|
||||||
private CanteenBrowser mCanteenBrowser;
|
private CanteenBrowser mCanteenBrowser;
|
||||||
private boolean mOfflineMode = false;
|
private boolean mOfflineMode = false;
|
||||||
@@ -116,7 +117,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
if (fragmentPage == FRAGMENT_SCHEDULE) {
|
if (currentPage == FRAGMENT_SCHEDULE) {
|
||||||
getMenuInflater().inflate(R.menu.options_schedule, menu);
|
getMenuInflater().inflate(R.menu.options_schedule, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -337,7 +338,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
findViewById(R.id.app_bar_layout).setVisibility(View.VISIBLE);
|
findViewById(R.id.app_bar_layout).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
// switch to logout
|
// switch to logout
|
||||||
if ((fragmentPage != FRAGMENT_STARTUP && fragmentPage != FRAGMENT_LOGIN) && (newFragment == FRAGMENT_STARTUP || newFragment == FRAGMENT_LOGIN)) {
|
if ((currentPage != FRAGMENT_STARTUP && currentPage != FRAGMENT_LOGIN) && (newFragment == FRAGMENT_STARTUP || newFragment == FRAGMENT_LOGIN)) {
|
||||||
View header = mNavigationView.getHeaderView(0);
|
View header = mNavigationView.getHeaderView(0);
|
||||||
//header.findViewById(R.id.imageView).setVisibility(View.GONE);
|
//header.findViewById(R.id.imageView).setVisibility(View.GONE);
|
||||||
header.findViewById(R.id.login_name).setVisibility(View.GONE);
|
header.findViewById(R.id.login_name).setVisibility(View.GONE);
|
||||||
@@ -355,7 +356,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
afterAnyMenuInflate();
|
afterAnyMenuInflate();
|
||||||
} // switch to login
|
} // switch to login
|
||||||
else if (
|
else if (
|
||||||
(fragmentPage == FRAGMENT_STARTUP || fragmentPage == FRAGMENT_LOGIN || fragmentPage == FRAGMENT_NONE) &&
|
(currentPage == FRAGMENT_STARTUP || currentPage == FRAGMENT_LOGIN || currentPage == FRAGMENT_NONE) &&
|
||||||
(newFragment != FRAGMENT_STARTUP && newFragment != FRAGMENT_LOGIN && getKVV().isLoggedIn())
|
(newFragment != FRAGMENT_STARTUP && newFragment != FRAGMENT_LOGIN && getKVV().isLoggedIn())
|
||||||
) {
|
) {
|
||||||
View header = mNavigationView.getHeaderView(0);
|
View header = mNavigationView.getHeaderView(0);
|
||||||
@@ -402,8 +403,11 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}, log::e);
|
}, log::e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newFragment != FRAGMENT_STARTUP && newFragment != FRAGMENT_NONE) {
|
||||||
this.fragmentPage = newFragment;
|
this.fragmentPage = newFragment;
|
||||||
this.fragmentData = newData;
|
this.fragmentData = newData;
|
||||||
|
}
|
||||||
|
this.currentPage = newFragment;
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user