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

View File

@ -2,6 +2,10 @@
<resources>
<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="reload">Reload IITC</string>
<string name="version">Print Version</string>
@ -17,7 +21,7 @@
<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() -->
<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>Icon by <a href="http://www.ludolab.net">Giuseppe Lucido</a></b><br><br>
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_sum">Avoids accidental exits</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_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>
<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.
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_sum">In addition to the default IITC buttons the advanced menu
contains a debug pane plus an option to clear cookies</string>
@ -99,4 +103,5 @@
<string name="base_layers">Base Layers</string>
<string name="overlay_layers">Overlay Layers</string>
<string name="toggle_layer_selection">Deselect/Select all</string>
</resources>
</resources>

View File

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

View File

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