Move activity labels to strings.xml (and some code formatting)

This commit is contained in:
fkloft
2013-09-18 12:59:40 +02:00
parent 77a773b9cd
commit cdc98de350
4 changed files with 79 additions and 79 deletions

View File

@ -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="47" android:versionCode="47"
android:versionName="0.6.3"> android:versionName="0.6.3">
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14"
@ -22,10 +22,10 @@
android:uiOptions="splitActionBarWhenNarrow"> android:uiOptions="splitActionBarWhenNarrow">
<activity <activity
android:name="com.cradle.iitc_mobile.IITC_Mobile" android:name="com.cradle.iitc_mobile.IITC_Mobile"
android:theme="@style/AppBaseTheme" android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"> android:theme="@style/AppBaseTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
@ -37,7 +37,7 @@
<!-- Receives the search request. --> <!-- Receives the search request. -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH"/> <action android:name="android.intent.action.SEARCH"/>
<!-- No category needed, because the Intent will specify this class component--> <!-- No category needed, because the Intent will specify this class component -->
</intent-filter> </intent-filter>
<!-- Handles the implicit intent to VIEW the www.ingress.com/intel URI --> <!-- Handles the implicit intent to VIEW the www.ingress.com/intel URI -->
@ -49,12 +49,12 @@
<data <data
android:host="www.ingress.com" android:host="www.ingress.com"
android:scheme="https" android:pathPrefix="/intel"
android:pathPrefix="/intel"/> android:scheme="https"/>
<data <data
android:host="www.ingress.com" android:host="www.ingress.com"
android:scheme="http" android:pathPrefix="/intel"
android:pathPrefix="/intel"/> android:scheme="http"/>
</intent-filter> </intent-filter>
<!-- Handles geo: URIs --> <!-- Handles geo: URIs -->
@ -68,24 +68,24 @@
</intent-filter> </intent-filter>
<!-- Points to searchable meta data. --> <!-- Points to searchable meta data. -->
<meta-data android:name="android.app.searchable" <meta-data
android:resource="@xml/searchable" /> android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity> </activity>
<activity <activity
android:name=".IITC_PreferenceActivity" android:name=".IITC_PreferenceActivity"
android:theme="@style/AppBaseTheme" android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:label="@string/app_name" android:label="@string/activity_settings"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"/> android:theme="@style/AppBaseTheme"/>
<activity <activity
android:name=".IITC_PluginPreferenceActivity" android:name=".IITC_PluginPreferenceActivity"
android:theme="@style/AppBaseTheme" android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:label="@string/app_name" android:label="@string/activity_plugins"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"/> android:theme="@style/AppBaseTheme"/>
<activity <activity
android:name=".share.ShareActivity" android:name=".share.ShareActivity"
android:label="@string/app_name" android:label="@string/activity_share"
android:noHistory="true" android:noHistory="true"
android:parentActivityName="com.cradle.iitc_mobile.IITC_Mobile" android:parentActivityName="com.cradle.iitc_mobile.IITC_Mobile"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"> android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
@ -100,7 +100,7 @@
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:exported="false" android:exported="false"
android:icon="@drawable/copy" android:icon="@drawable/copy"
android:label="Copy to clipboard" android:label="@string/activity_share_to_clipboard"
android:noHistory="false"> android:noHistory="false">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND"/> <action android:name="android.intent.action.SEND"/>

View File

@ -2,6 +2,10 @@
<resources> <resources>
<string name="app_name">IITC Mobile</string> <string name="app_name">IITC Mobile</string>
<string name="activity_settings">IITC Mobile Settings</string>
<string name="activity_plugins">IITC Plugins</string>
<string name="activity_share">Share using…</string>
<string name="activity_share_to_clipboard">Copy to clipboard</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="reload">Reload IITC</string> <string name="reload">Reload IITC</string>
<string name="version">Print Version</string> <string name="version">Print Version</string>
@ -17,7 +21,7 @@
<string name="pref_about_title">About IITC Mobile</string> <string name="pref_about_title">About IITC Mobile</string>
<!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() --> <!-- Use CDATA to prevent android from parsing html tags....we are doing this with Html.fromHtml() -->
<string name="pref_about_msg"> <string name="pref_about_msg">
<![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br> <![CDATA[<big><b>Ingress Intel Total Conversion Mobile</b></big><br><br>
<b>by <a href="https://github.com/leCradle">cradle</a> and contributors</b><br><br> <b>by <a href="https://github.com/leCradle">cradle</a> and contributors</b><br><br>
<b>Icon by <a href="http://www.ludolab.net">Giuseppe Lucido</a></b><br><br> <b>Icon by <a href="http://www.ludolab.net">Giuseppe Lucido</a></b><br><br>
IITC Mobile is an optimized mobile browser for the IITC Mobile is an optimized mobile browser for the
@ -67,9 +71,9 @@
<string name="pref_press_twice_to_exit">Press back button twice to exit</string> <string name="pref_press_twice_to_exit">Press back button twice to exit</string>
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string> <string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
<string name="pref_developer_options">Developer options</string> <string name="pref_developer_options">Developer options</string>
<string name="pref_enable_dev_mode">Enable developer mode</string> <string name="pref_enable_dev_mode">Enable developer mode</string>
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device. <string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string> Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string>
<string name="pref_advanced_menu">Display advanced menu</string> <string name="pref_advanced_menu">Display advanced menu</string>
<string name="pref_advanced_menu_sum">In addition to the default IITC buttons the advanced menu <string name="pref_advanced_menu_sum">In addition to the default IITC buttons the advanced menu
contains a debug pane plus an option to clear cookies</string> contains a debug pane plus an option to clear cookies</string>
@ -99,4 +103,5 @@
<string name="base_layers">Base Layers</string> <string name="base_layers">Base Layers</string>
<string name="overlay_layers">Overlay Layers</string> <string name="overlay_layers">Overlay Layers</string>
<string name="toggle_layer_selection">Deselect/Select all</string> <string name="toggle_layer_selection">Deselect/Select all</string>
</resources> </resources>

View File

@ -1,6 +1,14 @@
package com.cradle.iitc_mobile; package com.cradle.iitc_mobile;
import android.app.ActionBar; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import android.content.Context; import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.os.Bundle; import android.os.Bundle;
@ -16,15 +24,6 @@ import android.widget.ArrayAdapter;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.TextView; import android.widget.TextView;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class IITC_PluginPreferenceActivity extends PreferenceActivity { public class IITC_PluginPreferenceActivity extends PreferenceActivity {
private List<Header> mHeaders; private List<Header> mHeaders;
@ -43,9 +42,8 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
@Override @Override
public void onBuildHeaders(List<Header> target) { public void onBuildHeaders(List<Header> target) {
ActionBar bar = getActionBar(); getActionBar().setDisplayHomeAsUpEnabled(true);
bar.setTitle("IITC Plugins");
bar.setDisplayHomeAsUpEnabled(true);
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,8 +60,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
// exit settings when home button (iitc icon) is pressed case android.R.id.home: // exit settings when home button (iitc icon) is pressed
case android.R.id.home:
onBackPressed(); onBackPressed();
return true; return true;
default: default:
@ -157,8 +154,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
} }
} }
void addPluginPreference(String src, String plugin_key, void addPluginPreference(String src, String plugin_key, boolean user) {
boolean user) {
// now parse plugin name, description and category // now parse plugin name, description and category
String header = src.substring(src.indexOf("==UserScript=="), String header = src.substring(src.indexOf("==UserScript=="),
@ -306,20 +302,20 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
if (convertView == null) { if (convertView == null) {
holder = new HeaderViewHolder(); holder = new HeaderViewHolder();
switch (headerType) { switch (headerType) {
case HEADER_TYPE_CATEGORY: case HEADER_TYPE_CATEGORY:
view = new TextView(getContext(), null, view = new TextView(getContext(), null,
android.R.attr.listSeparatorTextViewStyle); android.R.attr.listSeparatorTextViewStyle);
holder.title = (TextView) view; holder.title = (TextView) view;
break; break;
case HEADER_TYPE_NORMAL: case HEADER_TYPE_NORMAL:
view = mInflater.inflate(R.layout.preference_header_item, view = mInflater.inflate(R.layout.preference_header_item,
parent, false); parent, false);
holder.title = (TextView) view holder.title = (TextView) view
.findViewById(R.id.plug_pref_title); .findViewById(R.id.plug_pref_title);
holder.summary = (TextView) view holder.summary = (TextView) view
.findViewById(R.id.plug_pref_summary); .findViewById(R.id.plug_pref_summary);
break; break;
} }
view.setTag(holder); view.setTag(holder);
} else { } else {
@ -330,22 +326,22 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
// All view fields must be updated every time, because the view may // All view fields must be updated every time, because the view may
// be recycled // be recycled
switch (headerType) { switch (headerType) {
case HEADER_TYPE_CATEGORY: case HEADER_TYPE_CATEGORY:
holder.title.setText(header.getTitle(getContext() holder.title.setText(header.getTitle(getContext()
.getResources())); .getResources()));
break; break;
case HEADER_TYPE_NORMAL: case HEADER_TYPE_NORMAL:
holder.title.setText(header.getTitle(getContext() holder.title.setText(header.getTitle(getContext()
.getResources())); .getResources()));
CharSequence summary = header.getSummary(getContext() CharSequence summary = header.getSummary(getContext()
.getResources()); .getResources());
if (!TextUtils.isEmpty(summary)) { if (!TextUtils.isEmpty(summary)) {
holder.summary.setVisibility(View.VISIBLE); holder.summary.setVisibility(View.VISIBLE);
holder.summary.setText(summary); holder.summary.setText(summary);
} else { } else {
holder.summary.setVisibility(View.GONE); holder.summary.setVisibility(View.GONE);
} }
break; break;
} }
return view; return view;

View File

@ -14,8 +14,6 @@ public class IITC_PreferenceActivity extends Activity {
MainSettings settings = new MainSettings(); MainSettings settings = new MainSettings();
// set action bar title
getActionBar().setTitle("IITC Mobile Settings");
getActionBar().setHomeButtonEnabled(true); getActionBar().setHomeButtonEnabled(true);
// iitc version // iitc version
@ -23,15 +21,16 @@ public class IITC_PreferenceActivity extends Activity {
settings.setArguments(bundle); settings.setArguments(bundle);
// Display the fragment as the main content. // Display the fragment as the main content.
getFragmentManager().beginTransaction() getFragmentManager()
.replace(android.R.id.content, settings).commit(); .beginTransaction()
.replace(android.R.id.content, settings)
.commit();
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
// exit settings when home button (iitc icon) is pressed case android.R.id.home: // exit settings when home button (iitc icon) is pressed
case android.R.id.home:
onBackPressed(); onBackPressed();
return true; return true;
default: default: