Merge branch 'master' of https://github.com/jonatkins/ingress-intel-total-conversion
This commit is contained in:
commit
14fc5a1a04
@ -81,6 +81,13 @@
|
|||||||
They won\'t appear in the info pane any more.<br><br>
|
They won\'t appear in the info pane any more.<br><br>
|
||||||
Swipe from the left edge of your screen (or click the app icon) to seem them.]]>
|
Swipe from the left edge of your screen (or click the app icon) to seem them.]]>
|
||||||
</string>
|
</string>
|
||||||
|
<string name="notice_extplugins">
|
||||||
|
<![CDATA[Hint:<br><br>
|
||||||
|
IITC Mobile is able to load external plugins too!<br><br>
|
||||||
|
• create <b>%1$s</b><br>
|
||||||
|
• move *.user.js files there<br>
|
||||||
|
• plugins should be listed above the official plugins]]>
|
||||||
|
</string>
|
||||||
|
|
||||||
<string name="pref_ui_cat">UI</string>
|
<string name="pref_ui_cat">UI</string>
|
||||||
<string name="pref_misc_cat">Misc</string>
|
<string name="pref_misc_cat">Misc</string>
|
||||||
|
@ -25,6 +25,7 @@ import android.widget.ListView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnItemClickListener {
|
public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnItemClickListener {
|
||||||
|
|
||||||
// Show/hide the up arrow on the very left
|
// Show/hide the up arrow on the very left
|
||||||
// getActionBar().setDisplayHomeAsUpEnabled(enabled);
|
// getActionBar().setDisplayHomeAsUpEnabled(enabled);
|
||||||
|
|
||||||
@ -37,11 +38,6 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
// Makes the icon/title clickable
|
// Makes the icon/title clickable
|
||||||
// getActionBar().setHomeButtonEnabled(enabled);
|
// getActionBar().setHomeButtonEnabled(enabled);
|
||||||
|
|
||||||
public static final int NOTICE_HOWTO = 1 << 0;
|
|
||||||
public static final int NOTICE_INFO = 1 << 1;
|
|
||||||
public static final int NOTICE_PANES = 1 << 2;
|
|
||||||
// next one would be 1<<2; (this results in 1,2,4,8,...)
|
|
||||||
|
|
||||||
private final IITC_Mobile mIitc;
|
private final IITC_Mobile mIitc;
|
||||||
private final ActionBar mActionBar;
|
private final ActionBar mActionBar;
|
||||||
private final SharedPreferences mPrefs;
|
private final SharedPreferences mPrefs;
|
||||||
@ -49,11 +45,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
private final DrawerLayout mDrawerLayout;
|
private final DrawerLayout mDrawerLayout;
|
||||||
private final ListView mDrawerLeft;
|
private final ListView mDrawerLeft;
|
||||||
private final View mDrawerRight;
|
private final View mDrawerRight;
|
||||||
|
private final IITC_NotificationHelper mNotificationHelper;
|
||||||
|
|
||||||
private boolean mDesktopMode = false;
|
private boolean mDesktopMode = false;
|
||||||
private Pane mPane = Pane.MAP;
|
private Pane mPane = Pane.MAP;
|
||||||
private String mHighlighter = null;
|
private String mHighlighter = null;
|
||||||
private int mDialogs = 0;
|
|
||||||
|
|
||||||
public IITC_NavigationHelper(IITC_Mobile activity, ActionBar bar) {
|
public IITC_NavigationHelper(IITC_Mobile activity, ActionBar bar) {
|
||||||
super(activity, (DrawerLayout) activity.findViewById(R.id.drawer_layout),
|
super(activity, (DrawerLayout) activity.findViewById(R.id.drawer_layout),
|
||||||
@ -74,63 +70,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
mDrawerLeft.setOnItemClickListener(this);
|
mDrawerLeft.setOnItemClickListener(this);
|
||||||
mDrawerLeft.setItemChecked(0, true);
|
mDrawerLeft.setItemChecked(0, true);
|
||||||
mDrawerLayout.setDrawerListener(this);
|
mDrawerLayout.setDrawerListener(this);
|
||||||
|
mNotificationHelper = new IITC_NotificationHelper(mIitc);
|
||||||
|
|
||||||
onPrefChanged(); // also calls updateActionBar()
|
onPrefChanged(); // also calls updateActionBar()
|
||||||
|
|
||||||
showNotice(NOTICE_HOWTO);
|
mNotificationHelper.showNotice(IITC_NotificationHelper.NOTICE_HOWTO);
|
||||||
}
|
|
||||||
|
|
||||||
private void showNotice(final int which) {
|
|
||||||
if ((mPrefs.getInt("pref_messages", 0) & which) != 0 || (mDialogs & which) != 0) return;
|
|
||||||
|
|
||||||
int text;
|
|
||||||
switch (which) {
|
|
||||||
case NOTICE_HOWTO:
|
|
||||||
text = R.string.notice_how_to;
|
|
||||||
break;
|
|
||||||
case NOTICE_INFO:
|
|
||||||
text = R.string.notice_info;
|
|
||||||
break;
|
|
||||||
case NOTICE_PANES:
|
|
||||||
text = R.string.notice_panes;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final View content = mIitc.getLayoutInflater().inflate(R.layout.dialog_notice, null);
|
|
||||||
TextView message = (TextView) content.findViewById(R.id.tv_notice);
|
|
||||||
message.setText(Html.fromHtml(mIitc.getString(text)));
|
|
||||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
|
|
||||||
AlertDialog dialog = new AlertDialog.Builder(mIitc)
|
|
||||||
.setView(content)
|
|
||||||
.setCancelable(true)
|
|
||||||
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.cancel();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.create();
|
|
||||||
dialog.setOnDismissListener(new OnDismissListener() {
|
|
||||||
@Override
|
|
||||||
public void onDismiss(DialogInterface dialog) {
|
|
||||||
mDialogs &= ~which;
|
|
||||||
if (((CheckBox) content.findViewById(R.id.cb_do_not_show_again)).isChecked()) {
|
|
||||||
int value = mPrefs.getInt("pref_messages", 0);
|
|
||||||
value |= which;
|
|
||||||
|
|
||||||
mPrefs
|
|
||||||
.edit()
|
|
||||||
.putInt("pref_messages", value)
|
|
||||||
.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mDialogs |= which;
|
|
||||||
dialog.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateViews() {
|
private void updateViews() {
|
||||||
@ -182,7 +126,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addPane(String name, String label, String icon) {
|
public void addPane(String name, String label, String icon) {
|
||||||
showNotice(NOTICE_PANES);
|
mNotificationHelper.showNotice(IITC_NotificationHelper.NOTICE_PANES);
|
||||||
|
|
||||||
Resources res = mIitc.getResources();
|
Resources res = mIitc.getResources();
|
||||||
String packageName = res.getResourcePackageName(R.string.app_name);
|
String packageName = res.getResourcePackageName(R.string.app_name);
|
||||||
@ -248,7 +192,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
|||||||
mIitc.switchToPane(item);
|
mIitc.switchToPane(item);
|
||||||
|
|
||||||
if (item == Pane.INFO) {
|
if (item == Pane.INFO) {
|
||||||
showNotice(NOTICE_INFO);
|
mNotificationHelper.showNotice(IITC_NotificationHelper.NOTICE_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDrawerLayout.closeDrawer(mDrawerLeft);
|
mDrawerLayout.closeDrawer(mDrawerLeft);
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.cradle.iitc_mobile;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class IITC_NotificationHelper {
|
||||||
|
|
||||||
|
public static final int NOTICE_HOWTO = 1 << 0;
|
||||||
|
public static final int NOTICE_INFO = 1 << 1;
|
||||||
|
public static final int NOTICE_PANES = 1 << 2;
|
||||||
|
public static final int NOTICE_EXTPLUGINS = 1 << 3;
|
||||||
|
// next one would be 1<<4; (this results in 1,2,4,8,...)
|
||||||
|
|
||||||
|
private final Activity mActivity;
|
||||||
|
private final SharedPreferences mPrefs;
|
||||||
|
private int mDialogs = 0;
|
||||||
|
|
||||||
|
public IITC_NotificationHelper(Activity activity) {
|
||||||
|
mActivity = activity;
|
||||||
|
mPrefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showNotice(final int which) {
|
||||||
|
if ((mPrefs.getInt("pref_messages", 0) & which) != 0 || (mDialogs & which) != 0) return;
|
||||||
|
|
||||||
|
String text;
|
||||||
|
switch (which) {
|
||||||
|
case NOTICE_HOWTO:
|
||||||
|
text = mActivity.getString(R.string.notice_how_to);
|
||||||
|
break;
|
||||||
|
case NOTICE_INFO:
|
||||||
|
text = mActivity.getString(R.string.notice_info);
|
||||||
|
break;
|
||||||
|
case NOTICE_PANES:
|
||||||
|
text = mActivity.getString(R.string.notice_panes);
|
||||||
|
break;
|
||||||
|
case NOTICE_EXTPLUGINS:
|
||||||
|
text = mActivity.getString(R.string.notice_extplugins);
|
||||||
|
text = String.format(text, Environment.getExternalStorageDirectory().getPath() + "/IITC_Mobile/plugins/");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final View content = mActivity.getLayoutInflater().inflate(R.layout.dialog_notice, null);
|
||||||
|
TextView message = (TextView) content.findViewById(R.id.tv_notice);
|
||||||
|
message.setText(Html.fromHtml(text));
|
||||||
|
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
|
||||||
|
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
||||||
|
.setView(content)
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
mDialogs &= ~which;
|
||||||
|
if (((CheckBox) content.findViewById(R.id.cb_do_not_show_again)).isChecked()) {
|
||||||
|
int value = mPrefs.getInt("pref_messages", 0);
|
||||||
|
value |= which;
|
||||||
|
|
||||||
|
mPrefs
|
||||||
|
.edit()
|
||||||
|
.putInt("pref_messages", value)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mDialogs |= which;
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -47,6 +47,10 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
public void onBuildHeaders(List<Header> target) {
|
public void onBuildHeaders(List<Header> target) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
// notify about external plugins
|
||||||
|
IITC_NotificationHelper nh = new IITC_NotificationHelper(this);
|
||||||
|
nh.showNotice(IITC_NotificationHelper.NOTICE_EXTPLUGINS);
|
||||||
|
|
||||||
mHeaders = target;
|
mHeaders = target;
|
||||||
// since the plugins container is static,
|
// since the plugins container is static,
|
||||||
// it is enough to parse the plugin only on first start.
|
// it is enough to parse the plugin only on first start.
|
||||||
@ -62,11 +66,12 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (onIsMultiPane()) {
|
if (onIsMultiPane()) {
|
||||||
getIntent()
|
getIntent()
|
||||||
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,12 +36,6 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
this.mIitcPath = Environment.getExternalStorageDirectory().getPath() + "/IITC_Mobile/";
|
this.mIitcPath = Environment.getExternalStorageDirectory().getPath() + "/IITC_Mobile/";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use somewhere else:
|
|
||||||
// Toast.makeText(mIitc, "File " + mIitcPath +
|
|
||||||
// "dev/total-conversion-build.user.js not found. " +
|
|
||||||
// "Disable developer mode or add iitc files to the dev folder.",
|
|
||||||
// Toast.LENGTH_LONG).show();
|
|
||||||
|
|
||||||
// enable https
|
// enable https
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user