Use native Android API for user-location (WebView causes high cpu load, even when IITC is stopped)

Also, move all user-location related functions into new class IITC_UserLocation.
This commit is contained in:
fkloft
2013-12-17 21:23:47 +01:00
parent f1aaad3c22
commit be05945eac
5 changed files with 257 additions and 130 deletions

View File

@ -51,7 +51,6 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
private final View mDrawerRight;
private boolean mDesktopMode = false;
private boolean mIsLoading;
private Pane mPane = Pane.MAP;
private String mHighlighter = null;
private int mDialogs = 0;
@ -150,7 +149,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerRight);
setDrawerIndicatorEnabled(false);
} else {
if (mIsLoading) {
if (mIitc.isLoading()) {
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
mActionBar.setHomeButtonEnabled(false);// Make icon unclickable
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
@ -175,7 +174,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
}
boolean mapVisible = mDesktopMode || mPane == Pane.MAP;
if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIsLoading || !mapVisible) {
if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIitc.isLoading() || !mapVisible) {
mActionBar.setSubtitle(null);
} else {
mActionBar.setSubtitle(mHighlighter);
@ -255,6 +254,10 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mDrawerLayout.closeDrawer(mDrawerLeft);
}
public void onLoadingStateChanged() {
updateViews();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
@ -295,11 +298,6 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
updateViews();
}
public void setLoadingState(boolean isLoading) {
mIsLoading = isLoading;
updateViews();
}
public void showActionBar() {
mActionBar.show();
}