Browse Source

Merge pull request #88 from DF1E/master

merge commits from https://github.com/aNNiMON/Lightning-Browser
master
Anthony Restaino 11 years ago
parent
commit
e41b65c40d
  1. 29
      res/values/arrays.xml
  2. 8
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  3. 60
      src/acr/browser/lightning/LicenseActivity.java
  4. 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

60
src/acr/browser/lightning/LicenseActivity.java

@ -9,15 +9,13 @@ import android.net.Uri; @@ -9,15 +9,13 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
/*
*NOTE: This activity must not be removed in order to comply with the Mozilla Public License v. 2.0
*under which this code is licensed. Unless you plan on providing other attribution in the app to
*the original source in another visible way, it is advised against the removal of this Activity.
*/
public class LicenseActivity extends Activity {
public class LicenseActivity extends Activity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -25,41 +23,29 @@ public class LicenseActivity extends Activity { @@ -25,41 +23,29 @@ public class LicenseActivity extends Activity {
setContentView(R.layout.license_activity);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
LinearLayout thunder = (LinearLayout) findViewById(R.id.browserLicense);
LinearLayout aosp = (LinearLayout) findViewById(R.id.licenseAOSP);
LinearLayout hosts = (LinearLayout) findViewById(R.id.licenseHosts);
thunder.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("http://www.mozilla.org/MPL/2.0/")));
finish();
}
});
aosp.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("http://www.apache.org/licenses/LICENSE-2.0")));
finish();
}
});
hosts.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("http://hosts-file.net/")));
finish();
}
});
findViewById(R.id.browserLicense).setOnClickListener(this);
findViewById(R.id.licenseAOSP).setOnClickListener(this);
findViewById(R.id.licenseHosts).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.browserLicense:
actionView("http://www.mozilla.org/MPL/2.0/");
break;
case R.id.licenseAOSP:
actionView("http://www.apache.org/licenses/LICENSE-2.0");
break;
case R.id.licenseHosts:
actionView("http://hosts-file.net/");
break;
}
}
private void actionView(String url) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
finish();
}
@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