Merge branch 'master' of https://github.com/jonatkins/ingress-intel-total-conversion
This commit is contained in:
commit
751c1b9e05
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.cradle.iitc_mobile"
|
package="com.cradle.iitc_mobile"
|
||||||
android:versionCode="51"
|
android:versionCode="52"
|
||||||
android:versionName="0.7.1">
|
android:versionName="0.7.2">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="14"
|
android:minSdkVersion="14"
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Locale;
|
|||||||
// provide communication between IITC script and android app
|
// provide communication between IITC script and android app
|
||||||
public class IITC_JSInterface {
|
public class IITC_JSInterface {
|
||||||
// context of main activity
|
// context of main activity
|
||||||
private IITC_Mobile mIitc;
|
private final IITC_Mobile mIitc;
|
||||||
|
|
||||||
IITC_JSInterface(IITC_Mobile iitc) {
|
IITC_JSInterface(IITC_Mobile iitc) {
|
||||||
mIitc = iitc;
|
mIitc = iitc;
|
||||||
@ -111,7 +111,7 @@ public class IITC_JSInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mIitc.setLoadingState(false);
|
mIitc.setLoadingState(false);
|
||||||
|
|
||||||
mIitc.getMapSettings().onBootFinished();
|
mIitc.getMapSettings().onBootFinished();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ import java.util.Comparator;
|
|||||||
|
|
||||||
public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickListener, OnItemLongClickListener {
|
public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickListener, OnItemLongClickListener {
|
||||||
private class HighlighterAdapter extends ArrayAdapter<String> {
|
private class HighlighterAdapter extends ArrayAdapter<String> {
|
||||||
private HighlighterComparator mComparator = new HighlighterComparator();
|
private final HighlighterComparator mComparator = new HighlighterComparator();
|
||||||
|
|
||||||
private HighlighterAdapter(int resource) {
|
private HighlighterAdapter(int resource) {
|
||||||
super(mIitc, resource);
|
super(mIitc, resource);
|
||||||
@ -67,8 +67,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LayerAdapter extends ArrayAdapter<Layer>
|
private class LayerAdapter extends ArrayAdapter<Layer> {
|
||||||
{
|
|
||||||
public LayerAdapter(int resource) {
|
public LayerAdapter(int resource) {
|
||||||
super(mIitc, resource);
|
super(mIitc, resource);
|
||||||
}
|
}
|
||||||
@ -84,15 +83,15 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IITC_Mobile mIitc;
|
private final IITC_Mobile mIitc;
|
||||||
|
|
||||||
private ArrayAdapter<String> mHighlighters;
|
private final ArrayAdapter<String> mHighlighters;
|
||||||
private ArrayAdapter<Layer> mBaseLayers;
|
private final ArrayAdapter<Layer> mBaseLayers;
|
||||||
private ArrayAdapter<Layer> mOverlayLayers;
|
private final ArrayAdapter<Layer> mOverlayLayers;
|
||||||
|
|
||||||
private Spinner mSpinnerBaseMap;
|
private final Spinner mSpinnerBaseMap;
|
||||||
private Spinner mSpinnerHighlighter;
|
private final Spinner mSpinnerHighlighter;
|
||||||
private ListView mListViewOverlayLayers;
|
private final ListView mListViewOverlayLayers;
|
||||||
|
|
||||||
private String mActiveHighlighter;
|
private String mActiveHighlighter;
|
||||||
private int mActiveLayer;
|
private int mActiveLayer;
|
||||||
@ -181,8 +180,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
if (parent.equals(mSpinnerHighlighter)) {
|
if (parent.equals(mSpinnerHighlighter)) {
|
||||||
String name = mHighlighters.getItem(position);
|
String name = mHighlighters.getItem(position);
|
||||||
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
|
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
|
||||||
}
|
} else if (parent.equals(mSpinnerBaseMap)) {
|
||||||
else if (parent.equals(mSpinnerBaseMap)) {
|
|
||||||
mBaseLayers.getItem(mActiveLayer).active = false; // set old layer to hidden, but no need to really hide
|
mBaseLayers.getItem(mActiveLayer).active = false; // set old layer to hidden, but no need to really hide
|
||||||
|
|
||||||
Layer layer = mBaseLayers.getItem(position);
|
Layer layer = mBaseLayers.getItem(position);
|
||||||
@ -253,7 +251,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
mBaseLayers.add(layer);
|
mBaseLayers.add(layer);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mBaseLayers.notifyDataSetChanged();
|
mBaseLayers.notifyDataSetChanged();
|
||||||
@ -273,7 +270,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
|
|||||||
mOverlayLayers.add(layer);
|
mOverlayLayers.add(layer);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mOverlayLayers.notifyDataSetChanged();
|
mOverlayLayers.notifyDataSetChanged();
|
||||||
|
@ -24,7 +24,6 @@ import android.view.View;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
import android.webkit.WebSettings;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -36,17 +35,15 @@ import java.net.URISyntaxException;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
public class IITC_Mobile extends Activity {
|
public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeListener, LocationListener {
|
||||||
|
|
||||||
private static final int REQUEST_LOGIN = 1;
|
private static final int REQUEST_LOGIN = 1;
|
||||||
|
|
||||||
private IITC_WebView mIitcWebView;
|
private IITC_WebView mIitcWebView;
|
||||||
private OnSharedPreferenceChangeListener mSharedPrefChangeListener;
|
|
||||||
private final String mIntelUrl = "https://www.ingress.com/intel";
|
private final String mIntelUrl = "https://www.ingress.com/intel";
|
||||||
private boolean mIsLocEnabled = false;
|
private boolean mIsLocEnabled = false;
|
||||||
private Location mLastLocation = null;
|
private Location mLastLocation = null;
|
||||||
private LocationManager mLocMngr = null;
|
private LocationManager mLocMngr = null;
|
||||||
private LocationListener mLocListener = null;
|
|
||||||
private boolean mFullscreenMode = false;
|
private boolean mFullscreenMode = false;
|
||||||
private IITC_DeviceAccountLogin mLogin;
|
private IITC_DeviceAccountLogin mLogin;
|
||||||
private MenuItem mSearchMenuItem;
|
private MenuItem mSearchMenuItem;
|
||||||
@ -81,39 +78,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
|
|
||||||
// do something if user changed something in the settings
|
// do something if user changed something in the settings
|
||||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
mSharedPrefChangeListener = new OnSharedPreferenceChangeListener() {
|
mSharedPrefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(
|
|
||||||
SharedPreferences sharedPreferences, String key) {
|
|
||||||
if (key.equals("pref_force_desktop")) {
|
|
||||||
mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false);
|
|
||||||
mNavigationHelper.onPrefChanged();
|
|
||||||
}
|
|
||||||
if (key.equals("pref_user_loc"))
|
|
||||||
mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc",
|
|
||||||
false);
|
|
||||||
if (key.equals("pref_fullscreen_actionbar")) {
|
|
||||||
mNavigationHelper.onPrefChanged();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (key.equals("pref_advanced_menu")) {
|
|
||||||
mAdvancedMenu = sharedPreferences.getBoolean("pref_advanced_menu", false);
|
|
||||||
mNavigationHelper.setDebugMode(mAdvancedMenu);
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
// no reload needed
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key.equals("pref_press_twice_to_exit")
|
|
||||||
|| key.equals("pref_share_selected_tab")
|
|
||||||
|| key.equals("pref_messages"))
|
|
||||||
// no reload needed
|
|
||||||
return;
|
|
||||||
|
|
||||||
mReloadNeeded = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mSharedPrefs.registerOnSharedPreferenceChangeListener(mSharedPrefChangeListener);
|
|
||||||
|
|
||||||
// enable/disable mDesktopMode mode on menu create and url load
|
// enable/disable mDesktopMode mode on menu create and url load
|
||||||
mDesktopMode = mSharedPrefs.getBoolean("pref_force_desktop", false);
|
mDesktopMode = mSharedPrefs.getBoolean("pref_force_desktop", false);
|
||||||
@ -125,33 +90,14 @@ public class IITC_Mobile extends Activity {
|
|||||||
mLocMngr = (LocationManager) this
|
mLocMngr = (LocationManager) this
|
||||||
.getSystemService(Context.LOCATION_SERVICE);
|
.getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
|
||||||
// Define a mSharedPrefChangeListener that responds to location updates
|
|
||||||
mLocListener = new LocationListener() {
|
|
||||||
public void onLocationChanged(Location location) {
|
|
||||||
// Called when a new location is found by the network location
|
|
||||||
// provider.
|
|
||||||
drawMarker(location);
|
|
||||||
mLastLocation = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onProviderEnabled(String provider) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onProviderDisabled(String provider) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mIsLocEnabled = mSharedPrefs.getBoolean("pref_user_loc", false);
|
mIsLocEnabled = mSharedPrefs.getBoolean("pref_user_loc", false);
|
||||||
if (mIsLocEnabled) {
|
if (mIsLocEnabled) {
|
||||||
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
||||||
// location updates
|
// location updates
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
|
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
|
||||||
0, 0, mLocListener);
|
0, 0, this);
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
|
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
|
||||||
mLocListener);
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the back stack
|
// Clear the back stack
|
||||||
@ -160,6 +106,63 @@ public class IITC_Mobile extends Activity {
|
|||||||
handleIntent(getIntent(), true);
|
handleIntent(getIntent(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------- onSharedPreferenceListener -----------------------
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
if (key.equals("pref_force_desktop")) {
|
||||||
|
mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false);
|
||||||
|
mNavigationHelper.onPrefChanged();
|
||||||
|
}
|
||||||
|
if (key.equals("pref_user_loc"))
|
||||||
|
mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc",
|
||||||
|
false);
|
||||||
|
if (key.equals("pref_fullscreen_actionbar")) {
|
||||||
|
mNavigationHelper.onPrefChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key.equals("pref_advanced_menu")) {
|
||||||
|
mAdvancedMenu = sharedPreferences.getBoolean("pref_advanced_menu", false);
|
||||||
|
mNavigationHelper.setDebugMode(mAdvancedMenu);
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
// no reload needed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.equals("pref_press_twice_to_exit")
|
||||||
|
|| key.equals("pref_share_selected_tab")
|
||||||
|
|| key.equals("pref_messages"))
|
||||||
|
// no reload needed
|
||||||
|
return;
|
||||||
|
|
||||||
|
mReloadNeeded = true;
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ------------------------ LocationListener ------------------------------
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
// Called when a new location is found by the network location
|
||||||
|
// provider.
|
||||||
|
drawMarker(location);
|
||||||
|
mLastLocation = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderEnabled(String provider) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderDisabled(String provider) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
@ -273,15 +276,14 @@ public class IITC_Mobile extends Activity {
|
|||||||
if (mIsLocEnabled) {
|
if (mIsLocEnabled) {
|
||||||
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
// Register the mSharedPrefChangeListener with the Location Manager to receive
|
||||||
// location updates
|
// location updates
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mLocListener);
|
mLocMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
|
||||||
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocListener);
|
mLocMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mReloadNeeded) {
|
if (mReloadNeeded) {
|
||||||
Log.d("iitcm", "preference had changed...reload needed");
|
Log.d("iitcm", "preference had changed...reload needed");
|
||||||
reloadIITC();
|
reloadIITC();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// iitc is not fully booted...timer will be reset by the script itself
|
// iitc is not fully booted...timer will be reset by the script itself
|
||||||
if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) {
|
if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) {
|
||||||
mIitcWebView.loadUrl("javascript: window.idleReset();");
|
mIitcWebView.loadUrl("javascript: window.idleReset();");
|
||||||
@ -295,7 +297,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
mIitcWebView.loadUrl("javascript: window.idleSet();");
|
mIitcWebView.loadUrl("javascript: window.idleSet();");
|
||||||
|
|
||||||
if (mIsLocEnabled)
|
if (mIsLocEnabled)
|
||||||
mLocMngr.removeUpdates(mLocListener);
|
mLocMngr.removeUpdates(this);
|
||||||
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
@ -350,7 +352,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
|
|
||||||
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false)) {
|
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false)) {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
mBackButtonPressed = true;
|
mBackButtonPressed = true;
|
||||||
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
|
||||||
@ -571,7 +572,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
* called by IITC_WebViewClient when the Google login form is opened.
|
* called by IITC_WebViewClient when the Google login form is opened.
|
||||||
*/
|
*/
|
||||||
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
|
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
|
||||||
String realm, String account, String args) {
|
String realm, String account, String args) {
|
||||||
mLogin = new IITC_DeviceAccountLogin(this, view, client);
|
mLogin = new IITC_DeviceAccountLogin(this, view, client);
|
||||||
mLogin.startLogin(realm, account, args);
|
mLogin.startLogin(realm, account, args);
|
||||||
}
|
}
|
||||||
@ -618,8 +619,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
|
|
||||||
* @see getNavigationHelper()
|
* @see getNavigationHelper()
|
||||||
|
* @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,8 +60,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
view.setText(getPaneTitle(item));
|
view.setText(getPaneTitle(item));
|
||||||
|
|
||||||
int icon = 0;
|
int icon = 0;
|
||||||
switch (item)
|
switch (item) {
|
||||||
{
|
|
||||||
case MAP:
|
case MAP:
|
||||||
icon = R.drawable.location_map;
|
icon = R.drawable.location_map;
|
||||||
break;
|
break;
|
||||||
@ -100,13 +99,13 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
public static final int NOTICE_INFO = 1 << 1;
|
public static final int NOTICE_INFO = 1 << 1;
|
||||||
// next one would be 1<<2; (this results in 1,2,4,8,...)
|
// next one would be 1<<2; (this results in 1,2,4,8,...)
|
||||||
|
|
||||||
private IITC_Mobile mIitc;
|
private final IITC_Mobile mIitc;
|
||||||
private ActionBar mActionBar;
|
private final ActionBar mActionBar;
|
||||||
private SharedPreferences mPrefs;
|
private final SharedPreferences mPrefs;
|
||||||
private NavigationAdapter mNavigationAdapter;
|
private final NavigationAdapter mNavigationAdapter;
|
||||||
private DrawerLayout mDrawerLayout;
|
private final DrawerLayout mDrawerLayout;
|
||||||
private ListView mDrawerLeft;
|
private final ListView mDrawerLeft;
|
||||||
private View mDrawerRight;
|
private final View mDrawerRight;
|
||||||
|
|
||||||
private boolean mDesktopMode = false;
|
private boolean mDesktopMode = false;
|
||||||
private boolean mFullscreen = false;
|
private boolean mFullscreen = false;
|
||||||
@ -236,8 +235,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
mDrawerLayout.closeDrawers();
|
mDrawerLayout.closeDrawers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPaneTitle(Pane pane)
|
public String getPaneTitle(Pane pane) {
|
||||||
{
|
|
||||||
switch (pane) {
|
switch (pane) {
|
||||||
case INFO:
|
case INFO:
|
||||||
return "Info";
|
return "Info";
|
||||||
|
@ -62,7 +62,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
if(onIsMultiPane()) getIntent()
|
if (onIsMultiPane()) getIntent()
|
||||||
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
// Select the displayed fragment in the headers (when using a tablet) :
|
// Select the displayed fragment in the headers (when using a tablet) :
|
||||||
// This should be done by Android, it is a bug fix
|
// This should be done by Android, it is a bug fix
|
||||||
// thx to http://stackoverflow.com/a/16793839
|
// thx to http://stackoverflow.com/a/16793839
|
||||||
if(mHeaders != null) {
|
if (mHeaders != null) {
|
||||||
|
|
||||||
final String displayedFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
|
final String displayedFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
|
||||||
if (displayedFragment != null) {
|
if (displayedFragment != null) {
|
||||||
@ -227,7 +227,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
// now we have all stuff together and can build the preference
|
// now we have all stuff together and can build the preference
|
||||||
// first check if we need a new category
|
// first check if we need a new category
|
||||||
if (sPlugins.containsKey(plugin_cat) == false) {
|
if (!sPlugins.containsKey(plugin_cat)) {
|
||||||
sPlugins.put(plugin_cat, new ArrayList<IITC_PluginPreference>());
|
sPlugins.put(plugin_cat, new ArrayList<IITC_PluginPreference>());
|
||||||
Log.d("iitcm", "create " + plugin_cat + " and add " + plugin_name);
|
Log.d("iitcm", "create " + plugin_cat + " and add " + plugin_name);
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
TextView summary;
|
TextView summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
|
|
||||||
static int getHeaderType(Header header) {
|
static int getHeaderType(Header header) {
|
||||||
if (header.fragment == null && header.intent == null) {
|
if (header.fragment == null && header.intent == null) {
|
||||||
|
@ -53,7 +53,7 @@ public class IITC_WebView extends WebView {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onGeolocationPermissionsShowPrompt(String origin,
|
public void onGeolocationPermissionsShowPrompt(String origin,
|
||||||
GeolocationPermissions.Callback callback) {
|
GeolocationPermissions.Callback callback) {
|
||||||
callback.invoke(origin, true, false);
|
callback.invoke(origin, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
if (url.startsWith("http://www.ingress.com/intel")
|
if (url.startsWith("http://www.ingress.com/intel")
|
||||||
|| url.startsWith("https://www.ingress.com/intel")) {
|
|| url.startsWith("https://www.ingress.com/intel")) {
|
||||||
Log.d("iitcm", "injecting iitc..");
|
Log.d("iitcm", "injecting iitc..");
|
||||||
view.loadUrl("javascript: " + this.mIitcScript);
|
view.loadUrl("javascript: " + this.mIitcScript);
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class CheckHttpResponse extends AsyncTask<String, Void, Boolean> {
|
public class CheckHttpResponse extends AsyncTask<String, Void, Boolean> {
|
||||||
|
|
||||||
private IITC_JSInterface mJsInterface;
|
private final IITC_JSInterface mJsInterface;
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) {
|
public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) {
|
||||||
mContext = c;
|
mContext = c;
|
||||||
mJsInterface = jsInterface;
|
mJsInterface = jsInterface;
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(String... urls) {
|
protected Boolean doInBackground(String... urls) {
|
||||||
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class IntentFragmentAdapter extends FragmentPagerAdapter {
|
public class IntentFragmentAdapter extends FragmentPagerAdapter {
|
||||||
private List<IntentFragment> mTabs;
|
private final List<IntentFragment> mTabs;
|
||||||
|
|
||||||
public IntentFragmentAdapter(FragmentManager fm) {
|
public IntentFragmentAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm);
|
||||||
|
@ -74,7 +74,7 @@ public class IntentListView extends ListView {
|
|||||||
|
|
||||||
private IntentAdapter mAdapter;
|
private IntentAdapter mAdapter;
|
||||||
private PackageManager mPackageManager;
|
private PackageManager mPackageManager;
|
||||||
HashMap<ComponentName, Intent> mActivities = new HashMap<ComponentName, Intent>();
|
private final HashMap<ComponentName, Intent> mActivities = new HashMap<ComponentName, Intent>();
|
||||||
|
|
||||||
public IntentListView(Context context) {
|
public IntentListView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -155,7 +155,6 @@ public class IntentListView extends ListView {
|
|||||||
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
|
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
|
||||||
activityList.remove(i);
|
activityList.remove(i);
|
||||||
i--;
|
i--;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,8 +171,7 @@ public class IntentListView extends ListView {
|
|||||||
if (resolveInfo.activityInfo.packageName.equals(defaultTarget.activityInfo.packageName)
|
if (resolveInfo.activityInfo.packageName.equals(defaultTarget.activityInfo.packageName)
|
||||||
&& resolveInfo.activityInfo.name.equals(defaultTarget.activityInfo.name)) {
|
&& resolveInfo.activityInfo.name.equals(defaultTarget.activityInfo.name)) {
|
||||||
allActivities.add(0, resolveInfo);
|
allActivities.add(0, resolveInfo);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
allActivities.add(resolveInfo);
|
allActivities.add(resolveInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
|
|||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
// from portallinks/permalinks we build 3 intents (share / geo / vanilla-intel-link)
|
// from portallinks/permalinks we build 3 intents (share / geo / vanilla-intel-link)
|
||||||
if (intent.getBooleanExtra("onlyShare", false) == false) {
|
if (!intent.getBooleanExtra("onlyShare", false)) {
|
||||||
mTitle = intent.getStringExtra("title");
|
mTitle = intent.getStringExtra("title");
|
||||||
mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0);
|
mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0);
|
||||||
mZoom = intent.getIntExtra("zoom", 0);
|
mZoom = intent.getIntExtra("zoom", 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user