Browse Source

Fixed some URL launching and the log tag

master
Anthony Restaino 11 years ago
parent
commit
ec9a58795d
  1. 1
      res/values/strings.xml
  2. 2
      src/acr/browser/lightning/Constants.java
  3. 35
      src/acr/browser/lightning/LicenseActivity.java
  4. 2
      src/acr/browser/lightning/LightningDownloadListener.java
  5. 18
      src/acr/browser/lightning/SettingsActivity.java
  6. 2
      src/acr/browser/lightning/Utils.java

1
res/values/strings.xml

@ -167,4 +167,5 @@
<string name="clear_history_exit">Clear history on exit</string> <string name="clear_history_exit">Clear history on exit</string>
<string name="folder_default">Default</string> <string name="folder_default">Default</string>
<string name="folder_custom">Custom</string> <string name="folder_custom">Custom</string>
<string name="untitled">Untititled</string>
</resources> </resources>

2
src/acr/browser/lightning/Constants.java

@ -34,6 +34,6 @@ public class Constants {
public static final String HTTP = "http://"; public static final String HTTP = "http://";
public static final String HTTPS = "https://"; public static final String HTTPS = "https://";
public static final String FILE = "file://"; public static final String FILE = "file://";
public static final String LOGTAG = Constants.LOGTAG; public static final String TAG = "Lightning";
} }

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

@ -27,25 +27,26 @@ public class LicenseActivity extends Activity implements View.OnClickListener {
findViewById(R.id.licenseAOSP).setOnClickListener(this); findViewById(R.id.licenseAOSP).setOnClickListener(this);
findViewById(R.id.licenseHosts).setOnClickListener(this); findViewById(R.id.licenseHosts).setOnClickListener(this);
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.browserLicense: case R.id.browserLicense:
actionView("http://www.mozilla.org/MPL/2.0/"); actionView("http://www.mozilla.org/MPL/2.0/");
break; break;
case R.id.licenseAOSP: case R.id.licenseAOSP:
actionView("http://www.apache.org/licenses/LICENSE-2.0"); actionView("http://www.apache.org/licenses/LICENSE-2.0");
break; break;
case R.id.licenseHosts: case R.id.licenseHosts:
actionView("http://hosts-file.net/"); actionView("http://hosts-file.net/");
break; break;
} }
} }
private void actionView(String url) { private void actionView(String url) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url), this,
finish(); MainActivity.class));
finish();
} }
@Override @Override

2
src/acr/browser/lightning/LightningDownloadListener.java

@ -44,7 +44,7 @@ public class LightningDownloadListener implements DownloadListener {
dialogClickListener) dialogClickListener)
.setNegativeButton(mActivity.getResources().getString(R.string.action_cancel), dialogClickListener) .setNegativeButton(mActivity.getResources().getString(R.string.action_cancel), dialogClickListener)
.show(); .show();
Log.i(Constants.LOGTAG, "Downloading" + fileName); Log.i(Constants.TAG, "Downloading" + fileName);
} }

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

@ -206,7 +206,7 @@ public class SettingsActivity extends Activity {
// NOTE: In order to comply with the open source license, // NOTE: In order to comply with the open source license,
// it is advised that you leave this code so that the License // it is advised that you leave this code so that the License
// Activity may be viewed by the user. // Activity may be viewed by the user.
startActivity(new Intent(Constants.LICENSE_INTENT)); startActivity(new Intent(mContext, LicenseActivity.class));
} }
}); });
@ -231,7 +231,8 @@ public class SettingsActivity extends Activity {
} }
adblock.setChecked(mPreferences.getBoolean( adblock.setChecked(mPreferences.getBoolean(
PreferenceConstants.BLOCK_ADS, false)); PreferenceConstants.BLOCK_ADS, false));
orbot.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_PROXY, false)); orbot.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_PROXY,
false));
initSwitch(location, fullScreen, flash, adblock, orbot); initSwitch(location, fullScreen, flash, adblock, orbot);
clickListenerForSwitches(layoutLocation, layoutFullScreen, layoutFlash, clickListenerForSwitches(layoutLocation, layoutFullScreen, layoutFlash,
@ -427,8 +428,11 @@ public class SettingsActivity extends Activity {
public void onClick(View v) { public void onClick(View v) {
mEasterEggCounter++; mEasterEggCounter++;
if (mEasterEggCounter == 10) { if (mEasterEggCounter == 10) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("http://imgs.xkcd.com/comics/compiling.png"))); startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://imgs.xkcd.com/comics/compiling.png"),
mContext, MainActivity.class));
finish(); finish();
mEasterEggCounter = 0; mEasterEggCounter = 0;
} }
@ -972,7 +976,8 @@ public class SettingsActivity extends Activity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
startActivity(new Intent(Constants.ADVANCED_SETTINGS_INTENT)); startActivity(new Intent(mContext,
AdvancedSettingsActivity.class));
} }
}); });
@ -984,7 +989,8 @@ public class SettingsActivity extends Activity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("http://twitter.com/ACRDevelopment"))); .parse("http://twitter.com/ACRDevelopment"), mContext,
MainActivity.class));
finish(); finish();
} }

2
src/acr/browser/lightning/Utils.java

@ -30,7 +30,7 @@ public class Utils {
String fileName = URLUtil.guessFileName(url, null, String fileName = URLUtil.guessFileName(url, null,
null); null);
DownloadHandler.onDownloadStart(activity, url, userAgent, contentDisposition, null, privateBrowsing); DownloadHandler.onDownloadStart(activity, url, userAgent, contentDisposition, null, privateBrowsing);
Log.i(Constants.LOGTAG, "Downloading" + fileName); Log.i(Constants.TAG, "Downloading" + fileName);
} }
public static synchronized void addBookmark(Context context, String title, String url) { public static synchronized void addBookmark(Context context, String title, String url) {

Loading…
Cancel
Save