mobile: added first version of 'about' view
This commit is contained in:
parent
529f7fa254
commit
2287b09f17
@ -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="1"
|
android:versionCode="7"
|
||||||
android:versionName="0.2.5" >
|
android:versionName="0.2.6" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="14"
|
android:minSdkVersion="14"
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_settings"></item>
|
android:title="@string/action_settings"></item>
|
||||||
|
|
||||||
|
<item android:id="@+id/about"
|
||||||
|
android:orderInCategory="1200"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/action_about"></item>
|
||||||
|
|
||||||
<item android:id="@+id/cache_clear"
|
<item android:id="@+id/cache_clear"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
|
@ -8,9 +8,29 @@
|
|||||||
<string name="cache_clear">Clear Cache</string>
|
<string name="cache_clear">Clear Cache</string>
|
||||||
<string name="locate">Get Location</string>
|
<string name="locate">Get Location</string>
|
||||||
<string name="local">local</string>
|
<string name="local">local</string>
|
||||||
|
<string name="close">close</string>
|
||||||
<string name="build_version">Build Version</string>
|
<string name="build_version">Build Version</string>
|
||||||
<string name="iitc_version">IITC Version</string>
|
<string name="iitc_version">IITC Version</string>
|
||||||
|
|
||||||
|
<string name="action_about">About</string>
|
||||||
|
<string name="about_title">About</string>
|
||||||
|
<!-- Use CDATA to prevent android from parsin html tags....we are doing this with Html.fromHtml() -->
|
||||||
|
<string name="about_msg">
|
||||||
|
<![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br>
|
||||||
|
<b>by <a href="https://github.com/leCradle">cradle</a></b><br><br>
|
||||||
|
<b>Icon by <a href="https://twitter.com/machtwerk">machtwerk</a></b><br><br>
|
||||||
|
IITC Mobile is an optimized mobile browser for the
|
||||||
|
Ingress Intel Total Conversion (IITC) userscript by <a href="https://github.com/breunigs"><b>breunigs</b></a>.
|
||||||
|
After Niantic asked the main developer to shut down his github project, development
|
||||||
|
is continued on a fork of <a href="https://github.com/jonatkins"><b>jonatkins</b></a>.<br><br>
|
||||||
|
<b>Website:</b><br>
|
||||||
|
<a href="http://iitc.jonatkins.com/">http://iitc.jonatkins.com/</a><br><br>
|
||||||
|
<b>Fork github:</b><br>
|
||||||
|
<a href="https://github.com/jonatkins/ingress-intel-total-conversion">https://github.com/jonatkins/ingress-intel-total-conversion</a><br><br>
|
||||||
|
<b>Old github:</b><br>
|
||||||
|
<a href="https://github.com/breunigs/ingress-intel-total-conversion">https://github.com/breunigs/ingress-intel-total-conversion</a>]]>
|
||||||
|
</string>
|
||||||
|
|
||||||
<string name="pref_force_desktop">Force desktop mode</string>
|
<string name="pref_force_desktop">Force desktop mode</string>
|
||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
|
@ -13,14 +13,20 @@ import android.os.Handler;
|
|||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class IITC_Mobile extends Activity {
|
public class IITC_Mobile extends Activity {
|
||||||
@ -29,6 +35,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
private boolean back_button_pressed = false;
|
private boolean back_button_pressed = false;
|
||||||
private boolean desktop = false;
|
private boolean desktop = false;
|
||||||
private OnSharedPreferenceChangeListener listener;
|
private OnSharedPreferenceChangeListener listener;
|
||||||
|
private String intel_url = "https://www.ingress.com/intel";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -45,9 +52,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if (key.equals("pref_force_desktop"))
|
if (key.equals("pref_force_desktop"))
|
||||||
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
|
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
|
||||||
// reload intel map
|
IITC_Mobile.this.loadUrl(intel_url);
|
||||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
|
||||||
injectJS();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
||||||
@ -60,24 +65,26 @@ public class IITC_Mobile extends Activity {
|
|||||||
String url = uri.toString();
|
String url = uri.toString();
|
||||||
if (intent.getScheme().equals("http://"))
|
if (intent.getScheme().equals("http://"))
|
||||||
url = url.replace("http://", "https://");
|
url = url.replace("http://", "https://");
|
||||||
Log.d("Intent received", "url: " + url);
|
Log.d("iitcm", "intent received url: " + url);
|
||||||
if (url.contains("ingress.com")) {
|
if (url.contains("ingress.com")) {
|
||||||
Log.d("Intent received", "loading url...");
|
Log.d("iitcm", "loading url...");
|
||||||
iitc_view.loadUrl(addUrlParam(url));
|
this.loadUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log.d("No Intent call", "loading https://www.ingress.com/intel");
|
Log.d("iitcm", "no intent...loading " + intel_url);
|
||||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
this.loadUrl(intel_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
// enough idle...let's do some work
|
// enough idle...let's do some work
|
||||||
|
Log.d("iitcm", "resuming...setting reset idleTimer");
|
||||||
iitc_view.loadUrl("javascript: window.idleTime = 0");
|
iitc_view.loadUrl("javascript: window.idleTime = 0");
|
||||||
iitc_view.loadUrl("javascript: window.renderUpdateStatus()");
|
iitc_view.loadUrl("javascript: window.renderUpdateStatus()");
|
||||||
super.onResume();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -100,8 +107,11 @@ public class IITC_Mobile extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
Log.d("iitcm", "configuration changed...restoring...");
|
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
|
Log.d("iitcm", "configuration changed...restoring...reset idleTimer");
|
||||||
|
iitc_view.loadUrl("javascript: window.idleTime = 0");
|
||||||
|
iitc_view.loadUrl("javascript: window.renderUpdateStatus()");
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want a self defined behavior for the back button
|
// we want a self defined behavior for the back button
|
||||||
@ -137,8 +147,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.reload_button:
|
case R.id.reload_button:
|
||||||
iitc_view.loadUrl(addUrlParam("https://www.ingress.com/intel"));
|
this.loadUrl(intel_url);
|
||||||
injectJS();
|
|
||||||
return true;
|
return true;
|
||||||
// clear cache
|
// clear cache
|
||||||
case R.id.cache_clear:
|
case R.id.cache_clear:
|
||||||
@ -150,11 +159,36 @@ public class IITC_Mobile extends Activity {
|
|||||||
case R.id.locate:
|
case R.id.locate:
|
||||||
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||||
return true;
|
return true;
|
||||||
|
// start settings activity
|
||||||
case R.id.settings:
|
case R.id.settings:
|
||||||
Intent intent = new Intent(this, IITC_Settings.class);
|
Intent intent = new Intent(this, IITC_Settings.class);
|
||||||
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
|
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
/*
|
||||||
|
* start a little about-dialog
|
||||||
|
* srsly...I found no better way for clickable links in a TextView then
|
||||||
|
* using Html.fromHtml...Linkify ist just broken and does not understand
|
||||||
|
* html href tags...so let's tag the @string/about_msg with CDATA and
|
||||||
|
* use Html.fromHtml(...) for clickable hrefs with tags.
|
||||||
|
*/
|
||||||
|
case R.id.about:
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
final TextView message = new TextView(this);
|
||||||
|
String about_msg = this.getText(R.string.about_msg).toString();
|
||||||
|
message.setText(Html.fromHtml(about_msg));
|
||||||
|
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
builder.setView(message)
|
||||||
|
.setTitle(R.string.about_title)
|
||||||
|
.setIcon(R.drawable.ic_stat_about)
|
||||||
|
.setNeutralButton(R.string.close, new OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -179,4 +213,12 @@ public class IITC_Mobile extends Activity {
|
|||||||
else
|
else
|
||||||
return (url + "?vp=m");
|
return (url + "?vp=m");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadUrl(String url) {
|
||||||
|
url = addUrlParam(url);
|
||||||
|
Log.d("iitcm", "injecting js...");
|
||||||
|
injectJS();
|
||||||
|
Log.d("iitcm", "loading url: " + url);
|
||||||
|
iitc_view.loadUrl(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user