mobile: moved about to settings activity
This commit is contained in:
@ -10,11 +10,6 @@
|
||||
android:showAsAction="never"
|
||||
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"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
|
@ -11,11 +11,11 @@
|
||||
<string name="close">close</string>
|
||||
<string name="build_version">Build Version</string>
|
||||
<string name="iitc_version">IITC Version</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
<string name="action_about">About</string>
|
||||
<string name="about_title">About</string>
|
||||
<string name="pref_about_title">About IITC Mobile</string>
|
||||
<!-- Use CDATA to prevent android from parsin html tags....we are doing this with Html.fromHtml() -->
|
||||
<string name="about_msg">
|
||||
<string name="pref_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>
|
||||
@ -31,6 +31,7 @@
|
||||
<a href="https://github.com/breunigs/ingress-intel-total-conversion">https://github.com/breunigs/ingress-intel-total-conversion</a>]]>
|
||||
</string>
|
||||
|
||||
<string name="pref_ui_cat">UI</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_developer_options">Developer options</string>
|
||||
|
@ -1,10 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<com.cradle.iitc_mobile.IITC_AboutDialogPreference
|
||||
android:key="pref_about"
|
||||
android:title="@string/pref_about_title"
|
||||
android:dialogIcon="@android:drawable/ic_dialog_info"
|
||||
android:negativeButtonText=""
|
||||
android:positiveButtonText=""
|
||||
android:dialogTitle="@string/pref_about_title"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_about_cat"
|
||||
android:title="@string/pref_ui_cat">
|
||||
<CheckBoxPreference
|
||||
android:key="pref_force_desktop"
|
||||
android:title="@string/pref_force_desktop"
|
||||
android:summary="@string/pref_force_desktop_sum"
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_developer_options"
|
||||
@ -28,4 +41,5 @@
|
||||
android:enabled="false"
|
||||
android:selectable="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -0,0 +1,46 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.preference.DialogPreference;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class IITC_AboutDialogPreference extends DialogPreference{
|
||||
|
||||
private Context context;
|
||||
|
||||
public IITC_AboutDialogPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
@Override
|
||||
protected void onPrepareDialogBuilder(Builder builder) {
|
||||
final TextView message = new TextView(context);
|
||||
String about_msg = context.getText(R.string.pref_about_msg).toString();
|
||||
message.setText(Html.fromHtml(about_msg));
|
||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
builder.setView(message)
|
||||
.setTitle(R.string.about)
|
||||
.setIcon(R.drawable.ic_stat_about)
|
||||
.setNeutralButton(R.string.close, new OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
super.onPrepareDialogBuilder(builder);
|
||||
}
|
||||
|
||||
}
|
@ -13,20 +13,14 @@ import android.os.Handler;
|
||||
import android.os.StrictMode;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.res.Configuration;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class IITC_Mobile extends Activity {
|
||||
@ -165,30 +159,6 @@ public class IITC_Mobile extends Activity {
|
||||
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
|
||||
startActivity(intent);
|
||||
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:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
Reference in New Issue
Block a user