Browse Source

Add array resources

master
Victor 11 years ago committed by DF1E
parent
commit
ecdef5d294
  1. 29
      res/values/arrays.xml
  2. 8
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  3. 19
      src/acr/browser/lightning/SettingsActivity.java

29
res/values/arrays.xml

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="user_agent">
<item>@string/agent_default</item>
<item>@string/agent_desktop</item>
<item>@string/agent_mobile</item>
<item>@string/agent_custom</item>
</string-array>
<string-array name="download_folder">
<item>@string/agent_default</item>
<item>@string/agent_custom</item>
</string-array>
<string-array name="homepage">
<item>@string/action_homepage</item>
<item>@string/action_blank</item>
<item>@string/action_bookmarks</item>
<item>@string/action_webpage</item>
</string-array>
<string-array name="text_size">
<item>@string/size_largest</item>
<item>@string/size_large</item>
<item>@string/size_normal</item>
<item>@string/size_small</item>
<item>@string/size_smallest</item>
</string-array>
</resources>

8
src/acr/browser/lightning/AdvancedSettingsActivity.java

@ -712,16 +712,10 @@ public class AdvancedSettingsActivity extends Activity { @@ -712,16 +712,10 @@ public class AdvancedSettingsActivity extends Activity {
AdvancedSettingsActivity.this);
picker.setTitle(getResources().getString(
R.string.title_text_size));
CharSequence[] chars = {
getResources().getString(R.string.size_largest),
getResources().getString(R.string.size_large),
getResources().getString(R.string.size_normal),
getResources().getString(R.string.size_small),
getResources().getString(R.string.size_smallest) };
int n = mPreferences.getInt(PreferenceConstants.TEXT_SIZE, 3);
picker.setSingleChoiceItems(chars, n - 1,
picker.setSingleChoiceItems(R.array.text_size, n - 1,
new DialogInterface.OnClickListener() {
@Override

19
src/acr/browser/lightning/SettingsActivity.java

@ -593,13 +593,8 @@ public class SettingsActivity extends Activity { @@ -593,13 +593,8 @@ public class SettingsActivity extends Activity {
mActivity);
agentPicker.setTitle(getResources().getString(
R.string.title_user_agent));
CharSequence[] chars = {
getResources().getString(R.string.agent_default),
getResources().getString(R.string.agent_desktop),
getResources().getString(R.string.agent_mobile),
getResources().getString(R.string.agent_custom) };
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1);
agentPicker.setSingleChoiceItems(chars, mAgentChoice - 1,
agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1,
new DialogInterface.OnClickListener() {
@Override
@ -689,9 +684,6 @@ public class SettingsActivity extends Activity { @@ -689,9 +684,6 @@ public class SettingsActivity extends Activity {
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
picker.setTitle(getResources().getString(
R.string.title_download_location));
CharSequence[] chars = {
getResources().getString(R.string.agent_default),
getResources().getString(R.string.agent_custom) };
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY,
Environment.DIRECTORY_DOWNLOADS);
int n = -1;
@ -701,7 +693,7 @@ public class SettingsActivity extends Activity { @@ -701,7 +693,7 @@ public class SettingsActivity extends Activity {
n = 2;
}
picker.setSingleChoiceItems(chars, n - 1,
picker.setSingleChoiceItems(R.array.download_folder, n - 1,
new DialogInterface.OnClickListener() {
@Override
@ -828,11 +820,6 @@ public class SettingsActivity extends Activity { @@ -828,11 +820,6 @@ public class SettingsActivity extends Activity {
public void onClick(View v) {
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
picker.setTitle(getResources().getString(R.string.home));
CharSequence[] chars = {
getResources().getString(R.string.action_homepage),
getResources().getString(R.string.action_blank),
getResources().getString(R.string.action_bookmarks),
getResources().getString(R.string.action_webpage) };
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE);
int n = -1;
if (mHomepage.contains("about:home")) {
@ -845,7 +832,7 @@ public class SettingsActivity extends Activity { @@ -845,7 +832,7 @@ public class SettingsActivity extends Activity {
n = 4;
}
picker.setSingleChoiceItems(chars, n - 1,
picker.setSingleChoiceItems(R.array.homepage, n - 1,
new DialogInterface.OnClickListener() {
@Override

Loading…
Cancel
Save