Hide drawer while loading
This commit is contained in:
parent
5884619024
commit
94b1663df6
@ -134,8 +134,7 @@ public class IITC_JSInterface {
|
|||||||
iitc.runOnUiThread(new Runnable() {
|
iitc.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
iitc.findViewById(R.id.iitc_webview).setVisibility(View.VISIBLE);
|
iitc.setLoadingState(false);
|
||||||
iitc.findViewById(R.id.imageLoading).setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
// inject the iitc-script and load the intel url
|
// inject the iitc-script and load the intel url
|
||||||
// plugins are injected onPageFinished
|
// plugins are injected onPageFinished
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
showSplashScreen();
|
setLoadingState(true);
|
||||||
url = addUrlParam(url);
|
url = addUrlParam(url);
|
||||||
loadIITC();
|
loadIITC();
|
||||||
mIitcWebView.loadUrl(url);
|
mIitcWebView.loadUrl(url);
|
||||||
@ -577,7 +577,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
public void loginSucceeded() {
|
public void loginSucceeded() {
|
||||||
// garbage collection
|
// garbage collection
|
||||||
mLogin = null;
|
mLogin = null;
|
||||||
showSplashScreen();
|
setLoadingState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable/enable some menu buttons...
|
// disable/enable some menu buttons...
|
||||||
@ -611,10 +611,15 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showSplashScreen() {
|
public void setLoadingState(boolean isLoading) {
|
||||||
if (!mSharedPrefs.getBoolean("pref_disable_splash", false)) {
|
mNavigationHelper.setLoadingState(isLoading);
|
||||||
|
|
||||||
|
if (isLoading && !mSharedPrefs.getBoolean("pref_disable_splash", false)) {
|
||||||
findViewById(R.id.iitc_webview).setVisibility(View.GONE);
|
findViewById(R.id.iitc_webview).setVisibility(View.GONE);
|
||||||
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
|
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.iitc_webview).setVisibility(View.VISIBLE);
|
||||||
|
findViewById(R.id.imageLoading).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,29 +29,24 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
// Makes the icon/title clickable
|
// Makes the icon/title clickable
|
||||||
// getActionBar().setHomeButtonEnabled(enabled);
|
// getActionBar().setHomeButtonEnabled(enabled);
|
||||||
|
|
||||||
public static enum Pane {
|
private class HighlighterAdapter extends ArrayAdapter<String> {
|
||||||
MAP, INFO, FULL, COMPACT, PUBLIC, FACTION, DEBUG
|
public HighlighterAdapter() {
|
||||||
};
|
super(mIitc, android.R.layout.simple_list_item_1);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
public String getPaneTitle(Pane pane)
|
@Override
|
||||||
{
|
public void add(String object) {
|
||||||
switch (pane) {
|
super.remove(object); // to avoid duplicates
|
||||||
case INFO:
|
super.add(object);
|
||||||
return "Info";
|
|
||||||
case FULL:
|
|
||||||
return "Full";
|
|
||||||
case COMPACT:
|
|
||||||
return "Compact";
|
|
||||||
case PUBLIC:
|
|
||||||
return "Public";
|
|
||||||
case FACTION:
|
|
||||||
return "Faction";
|
|
||||||
case DEBUG:
|
|
||||||
return "Debug";
|
|
||||||
default:
|
|
||||||
return mIitc.getString(R.string.app_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
add("No Highlights");// Probably must be the same as window._no_highlighter
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private class NavigationAdapter extends ArrayAdapter<Pane> {
|
private class NavigationAdapter extends ArrayAdapter<Pane> {
|
||||||
public NavigationAdapter() {
|
public NavigationAdapter() {
|
||||||
@ -83,23 +78,8 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HighlighterAdapter extends ArrayAdapter<String> {
|
public static enum Pane {
|
||||||
public HighlighterAdapter() {
|
COMPACT, DEBUG, FACTION, FULL, INFO, MAP, PUBLIC
|
||||||
super(mIitc, android.R.layout.simple_list_item_1);
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void add(String object) {
|
|
||||||
super.remove(object); // to avoid duplicates
|
|
||||||
super.add(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
super.clear();
|
|
||||||
add("No Highlights");// Probably must be the same as window._no_highlighter
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IITC_Mobile mIitc;
|
private IITC_Mobile mIitc;
|
||||||
@ -115,6 +95,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
private boolean mFullscreen = false;
|
private boolean mFullscreen = false;
|
||||||
private boolean mHideInFullscreen = false;
|
private boolean mHideInFullscreen = false;
|
||||||
private Pane mPane = Pane.MAP;
|
private Pane mPane = Pane.MAP;
|
||||||
|
private boolean mIsLoading;
|
||||||
|
|
||||||
public IITC_NavigationHelper(IITC_Mobile activity, ActionBar bar, ListView drawerList, DrawerLayout drawerLayout) {
|
public IITC_NavigationHelper(IITC_Mobile activity, ActionBar bar, ListView drawerList, DrawerLayout drawerLayout) {
|
||||||
super(activity, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
|
super(activity, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
|
||||||
@ -139,8 +120,6 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateActionBar() {
|
private void updateActionBar() {
|
||||||
// TODO setDisplayHomeAsUpEnabled should always be true on mobile mode
|
|
||||||
// TODO hide draw list in desktop mode
|
|
||||||
boolean showHighlighter = true;
|
boolean showHighlighter = true;
|
||||||
|
|
||||||
if (mDesktopMode) {
|
if (mDesktopMode) {
|
||||||
@ -149,16 +128,25 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
mActionBar.setTitle(mIitc.getString(R.string.app_name));
|
mActionBar.setTitle(mIitc.getString(R.string.app_name));
|
||||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
setDrawerIndicatorEnabled(false);
|
setDrawerIndicatorEnabled(false);
|
||||||
|
} else {
|
||||||
|
if (mIsLoading) {
|
||||||
|
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
|
||||||
|
mActionBar.setHomeButtonEnabled(false);// Make icon unclickable
|
||||||
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
|
setDrawerIndicatorEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mActionBar.setDisplayHomeAsUpEnabled(true); // Show "up" indicator
|
mActionBar.setDisplayHomeAsUpEnabled(true); // Show "up" indicator
|
||||||
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
|
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
|
||||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||||
if (mPane != Pane.MAP) {
|
|
||||||
showHighlighter = false;
|
if (mPane != Pane.MAP)
|
||||||
setDrawerIndicatorEnabled(false);
|
setDrawerIndicatorEnabled(false);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
setDrawerIndicatorEnabled(true);
|
setDrawerIndicatorEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mPane != Pane.MAP)
|
||||||
|
showHighlighter = false;
|
||||||
|
|
||||||
mActionBar.setTitle(getPaneTitle(mPane));
|
mActionBar.setTitle(getPaneTitle(mPane));
|
||||||
}
|
}
|
||||||
@ -189,10 +177,49 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
updateActionBar();
|
updateActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPaneTitle(Pane pane)
|
||||||
|
{
|
||||||
|
switch (pane) {
|
||||||
|
case INFO:
|
||||||
|
return "Info";
|
||||||
|
case FULL:
|
||||||
|
return "Full";
|
||||||
|
case COMPACT:
|
||||||
|
return "Compact";
|
||||||
|
case PUBLIC:
|
||||||
|
return "Public";
|
||||||
|
case FACTION:
|
||||||
|
return "Faction";
|
||||||
|
case DEBUG:
|
||||||
|
return "Debug";
|
||||||
|
default:
|
||||||
|
return mIitc.getString(R.string.app_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hideInFullscreen() {
|
public boolean hideInFullscreen() {
|
||||||
return mHideInFullscreen;
|
return mHideInFullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerClosed(View drawerView) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onDrawerClosed(drawerView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerOpened(View drawerView) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onDrawerOpened(drawerView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
Pane item = mNavigationAdapter.getItem(position);
|
||||||
|
mIitc.switchToPane(item);
|
||||||
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(int position, long itemId) {
|
public boolean onNavigationItemSelected(int position, long itemId) {
|
||||||
String name = mHighlighters.getItem(position);
|
String name = mHighlighters.getItem(position);
|
||||||
@ -201,6 +228,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
// Sync the toggle state after onRestoreInstanceState has occurred.
|
||||||
|
syncState();
|
||||||
|
}
|
||||||
|
|
||||||
public void onPrefChanged() {
|
public void onPrefChanged() {
|
||||||
mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false);
|
mDesktopMode = mPrefs.getBoolean("pref_force_desktop", false);
|
||||||
mHideInFullscreen = mPrefs.getBoolean("pref_fullscreen_actionbar", false);
|
mHideInFullscreen = mPrefs.getBoolean("pref_fullscreen_actionbar", false);
|
||||||
@ -233,33 +265,14 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
|
|||||||
updateActionBar();
|
updateActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLoadingState(boolean isLoading) {
|
||||||
|
mIsLoading = isLoading;
|
||||||
|
updateActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
public void switchTo(Pane pane) {
|
public void switchTo(Pane pane) {
|
||||||
mPane = pane;
|
mPane = pane;
|
||||||
|
|
||||||
updateActionBar();
|
updateActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
Pane item = mNavigationAdapter.getItem(position);
|
|
||||||
mIitc.switchToPane(item);
|
|
||||||
mDrawerLayout.closeDrawer(mDrawerList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDrawerOpened(View drawerView) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
super.onDrawerOpened(drawerView);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDrawerClosed(View drawerView) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
super.onDrawerClosed(drawerView);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
// Sync the toggle state after onRestoreInstanceState has occurred.
|
|
||||||
syncState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user