Localizing log tags
This commit is contained in:
parent
5af0f5f0c1
commit
7fa3315662
@ -187,8 +187,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
private String mUntitledTitle;
|
||||
private String mCameraPhotoPath;
|
||||
|
||||
private final Handler mDrawerHandler = new Handler();
|
||||
|
||||
// The singleton BookmarkManager
|
||||
@Inject BookmarkManager mBookmarkManager;
|
||||
|
||||
@ -991,7 +989,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
// Use a delayed handler to make the transition smooth
|
||||
// otherwise it will get caught up with the showTab code
|
||||
// and cause a janky motion
|
||||
mDrawerHandler.postDelayed(new Runnable() {
|
||||
Handlers.MAIN.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerLayout.closeDrawers();
|
||||
@ -1030,14 +1028,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
// Use a delayed handler to make the transition smooth
|
||||
// otherwise it will get caught up with the showTab code
|
||||
// and cause a janky motion
|
||||
mDrawerHandler.postDelayed(new Runnable() {
|
||||
Handlers.MAIN.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerLayout.closeDrawers();
|
||||
}
|
||||
}, 200);
|
||||
|
||||
// mDrawerHandler.postDelayed(new Runnable() {
|
||||
// Handlers.MAIN.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Remove browser frame background to reduce overdraw
|
||||
@ -1114,7 +1112,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
mPresenter.loadUrlInCurrentView(item.getUrl());
|
||||
// keep any jank from happening when the drawer is closed after the
|
||||
// URL starts to load
|
||||
mDrawerHandler.postDelayed(new Runnable() {
|
||||
Handlers.MAIN.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
closeDrawers(null);
|
||||
@ -1311,7 +1309,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
protected void onDestroy() {
|
||||
Log.d(TAG, "onDestroy");
|
||||
|
||||
mDrawerHandler.removeCallbacksAndMessages(null);
|
||||
Handlers.MAIN.removeCallbacksAndMessages(null);
|
||||
|
||||
mPresenter.shutdown();
|
||||
|
||||
|
@ -475,7 +475,7 @@ public class TabsManager {
|
||||
*/
|
||||
public void saveState() {
|
||||
Bundle outState = new Bundle(ClassLoader.getSystemClassLoader());
|
||||
Log.d(Constants.TAG, "Saving tab state");
|
||||
Log.d(TAG, "Saving tab state");
|
||||
for (int n = 0; n < mTabList.size(); n++) {
|
||||
LightningView tab = mTabList.get(n);
|
||||
if (TextUtils.isEmpty(tab.getUrl())) {
|
||||
@ -515,7 +515,7 @@ public class TabsManager {
|
||||
public void onSubscribe(@NonNull StreamSubscriber<Bundle> subscriber) {
|
||||
Bundle savedState = FileUtils.readBundleFromStorage(mApp, BUNDLE_STORAGE);
|
||||
if (savedState != null) {
|
||||
Log.d(Constants.TAG, "Restoring previous WebView state now");
|
||||
Log.d(TAG, "Restoring previous WebView state now");
|
||||
for (String key : savedState.keySet()) {
|
||||
if (key.startsWith(BUNDLE_KEY)) {
|
||||
subscriber.onNext(savedState.getBundle(key));
|
||||
|
@ -67,13 +67,10 @@ public final class Constants {
|
||||
public static final String ABOUT = "about:";
|
||||
public static final String FOLDER = "folder://";
|
||||
|
||||
// Application log tag
|
||||
public static final String TAG = "Lightning";
|
||||
|
||||
// These should match the order of @array/proxy_choices_array
|
||||
@IntDef({NO_PROXY, PROXY_ORBOT, PROXY_I2P, PROXY_MANUAL})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface PROXY {}
|
||||
public @interface Proxy {}
|
||||
|
||||
public static final int NO_PROXY = 0;
|
||||
public static final int PROXY_ORBOT = 1;
|
||||
|
@ -25,6 +25,8 @@ import javax.inject.Inject;
|
||||
|
||||
public class LightningDownloadListener implements DownloadListener {
|
||||
|
||||
private static final String TAG = "LightningDownloader";
|
||||
|
||||
private final Activity mActivity;
|
||||
|
||||
@Inject PreferenceManager mPreferenceManager;
|
||||
@ -65,7 +67,7 @@ public class LightningDownloadListener implements DownloadListener {
|
||||
.setNegativeButton(mActivity.getResources().getString(R.string.action_cancel),
|
||||
dialogClickListener).show();
|
||||
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||
Log.i(Constants.TAG, "Downloading: " + fileName);
|
||||
Log.i(TAG, "Downloading: " + fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +41,7 @@ import acr.browser.lightning.database.BookmarkLocalSync;
|
||||
import acr.browser.lightning.database.BookmarkLocalSync.Source;
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
|
||||
import com.anthonycr.bonsai.Schedulers;
|
||||
|
||||
import acr.browser.lightning.dialog.BrowserDialog;
|
||||
@ -49,6 +50,8 @@ import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class BookmarkSettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {
|
||||
|
||||
private static final String TAG = "BookmarkSettingsFrag";
|
||||
|
||||
private static final String SETTINGS_EXPORT = "export_bookmark";
|
||||
private static final String SETTINGS_IMPORT = "import_bookmark";
|
||||
private static final String SETTINGS_IMPORT_BROWSER = "import_browser";
|
||||
@ -80,7 +83,7 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
List<HistoryItem> list;
|
||||
Log.d(Constants.TAG, "Loading bookmarks from: " + mSource.name());
|
||||
Log.d(TAG, "Loading bookmarks from: " + mSource.name());
|
||||
switch (mSource) {
|
||||
case STOCK:
|
||||
list = getSync().getBookmarksFromStockBrowser();
|
||||
@ -385,7 +388,7 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
||||
}
|
||||
|
||||
private void createDialog() {
|
||||
if(mActivity == null){
|
||||
if (mActivity == null) {
|
||||
return;
|
||||
}
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
|
@ -230,7 +230,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
BrowserDialog.setDialogSize(mActivity, dialog);
|
||||
}
|
||||
|
||||
private void setProxyChoice(@Constants.PROXY int choice) {
|
||||
private void setProxyChoice(@Constants.Proxy int choice) {
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
choice = ProxyUtils.setProxyChoice(choice, mActivity);
|
||||
|
@ -251,9 +251,9 @@ public class PreferenceManager {
|
||||
return mPrefs.getBoolean(Name.USE_PROXY, false);
|
||||
}
|
||||
|
||||
@Constants.PROXY
|
||||
@Constants.Proxy
|
||||
public int getProxyChoice() {
|
||||
@Constants.PROXY int proxy = mPrefs.getInt(Name.PROXY_CHOICE, Constants.NO_PROXY);
|
||||
@Constants.Proxy int proxy = mPrefs.getInt(Name.PROXY_CHOICE, Constants.NO_PROXY);
|
||||
switch (proxy) {
|
||||
case Constants.NO_PROXY:
|
||||
case Constants.PROXY_ORBOT:
|
||||
@ -473,7 +473,7 @@ public class PreferenceManager {
|
||||
*
|
||||
* @param choice the proxy to use.
|
||||
*/
|
||||
public void setProxyChoice(@Constants.PROXY int choice) {
|
||||
public void setProxyChoice(@Constants.Proxy int choice) {
|
||||
putBoolean(Name.USE_PROXY, choice != Constants.NO_PROXY);
|
||||
putInt(Name.PROXY_CHOICE, choice);
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ import acr.browser.lightning.constant.Constants;
|
||||
*/
|
||||
public class Converter {
|
||||
|
||||
private static final String TAG = "Converter";
|
||||
|
||||
private final static String UTF8 = "UTF-8";
|
||||
private final static String ISO = "ISO-8859-1";
|
||||
private final static int K2 = 2048;
|
||||
@ -118,20 +120,20 @@ public class Converter {
|
||||
if (tmpEnc != null)
|
||||
encoding = tmpEnc;
|
||||
else {
|
||||
Log.d(Constants.TAG, "no charset found in first stage");
|
||||
Log.d(TAG, "no charset found in first stage");
|
||||
// detect with the help of xml beginning ala
|
||||
// encoding="charset"
|
||||
tmpEnc = detectCharset("encoding=", output, in, encoding);
|
||||
if (tmpEnc != null)
|
||||
encoding = tmpEnc;
|
||||
else
|
||||
Log.d(Constants.TAG, "no charset found in second stage");
|
||||
Log.d(TAG, "no charset found in second stage");
|
||||
}
|
||||
|
||||
if (!Charset.isSupported(encoding))
|
||||
throw new UnsupportedEncodingException(encoding);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.d(Constants.TAG,
|
||||
Log.d(TAG,
|
||||
"Using default encoding:" + UTF8 + " problem:" + e.getMessage()
|
||||
+ " encoding:" + encoding + ' ' + url);
|
||||
encoding = UTF8;
|
||||
@ -146,7 +148,7 @@ public class Converter {
|
||||
byte[] arr = new byte[K2];
|
||||
while (true) {
|
||||
if (bytesRead >= maxBytes) {
|
||||
Log.d(Constants.TAG, "Maxbyte of " + maxBytes
|
||||
Log.d(TAG, "Maxbyte of " + maxBytes
|
||||
+ " exceeded! Maybe html is now broken but try it nevertheless. Url: "
|
||||
+ url);
|
||||
break;
|
||||
@ -161,7 +163,7 @@ public class Converter {
|
||||
|
||||
return output.toString(encoding);
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, e.toString() + " url:" + url);
|
||||
Log.e(TAG, e.toString() + " url:" + url);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
@ -236,7 +238,7 @@ public class Converter {
|
||||
bos.reset();
|
||||
return tmpEnc;
|
||||
} catch (IOException ex) {
|
||||
Log.e(Constants.TAG, "Couldn't reset stream to re-read with new encoding "
|
||||
Log.e(TAG, "Couldn't reset stream to re-read with new encoding "
|
||||
+ tmpEnc + ' ' + ex.toString());
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import acr.browser.lightning.constant.Constants;
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
private static final String TAG = "FileUtils";
|
||||
|
||||
/**
|
||||
* Writes a bundle to persistent storage in the files directory
|
||||
* using the specified file name. This method is a blocking
|
||||
@ -51,7 +53,7 @@ public class FileUtils {
|
||||
outputStream.flush();
|
||||
parcel.recycle();
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "Unable to write bundle to storage");
|
||||
Log.e(TAG, "Unable to write bundle to storage");
|
||||
} finally {
|
||||
Utils.close(outputStream);
|
||||
}
|
||||
@ -103,7 +105,7 @@ public class FileUtils {
|
||||
parcel.recycle();
|
||||
return out;
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(Constants.TAG, "Unable to read bundle from storage");
|
||||
Log.e(TAG, "Unable to read bundle from storage");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@ -131,7 +133,7 @@ public class FileUtils {
|
||||
throwable.printStackTrace(new PrintStream(outputStream));
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "Unable to write bundle to storage");
|
||||
Log.e(TAG, "Unable to write bundle to storage");
|
||||
} finally {
|
||||
Utils.close(outputStream);
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ import info.guardianproject.netcipher.webkit.WebkitProxy;
|
||||
|
||||
@Singleton
|
||||
public class ProxyUtils {
|
||||
|
||||
private static final String TAG = "ProxyUtils";
|
||||
|
||||
// Helper
|
||||
private static boolean mI2PHelperBound;
|
||||
private static boolean mI2PProxyInitialized;
|
||||
@ -141,7 +144,7 @@ public class ProxyUtils {
|
||||
try {
|
||||
WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
|
||||
} catch (Exception e) {
|
||||
Log.d(Constants.TAG, "error enabling web proxying", e);
|
||||
Log.d(TAG, "error enabling web proxying", e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -193,7 +196,7 @@ public class ProxyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Constants.PROXY
|
||||
@Constants.Proxy
|
||||
public static int setProxyChoice(int choice, @NonNull Activity activity) {
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
|
@ -80,7 +80,7 @@ public final class Utils {
|
||||
public void onGranted() {
|
||||
String fileName = URLUtil.guessFileName(url, null, null);
|
||||
DownloadHandler.onDownloadStart(activity, manager, url, userAgent, contentDisposition, null);
|
||||
Log.i(Constants.TAG, "Downloading: " + fileName);
|
||||
Log.i(TAG, "Downloading: " + fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -418,7 +418,7 @@ public final class Utils {
|
||||
if (TextUtils.isEmpty(item.getUrl())) {
|
||||
return;
|
||||
}
|
||||
Log.d(Constants.TAG, "Creating shortcut: " + item.getTitle() + ' ' + item.getUrl());
|
||||
Log.d(TAG, "Creating shortcut: " + item.getTitle() + ' ' + item.getUrl());
|
||||
Intent shortcutIntent = new Intent(activity, MainActivity.class);
|
||||
shortcutIntent.setData(Uri.parse(item.getUrl()));
|
||||
|
||||
|
@ -48,6 +48,8 @@ import acr.browser.lightning.utils.Utils;
|
||||
|
||||
public class LightningWebClient extends WebViewClient {
|
||||
|
||||
private static final String TAG = "LightningWebClient";
|
||||
|
||||
@NonNull private final Activity mActivity;
|
||||
@NonNull private final LightningView mLightningView;
|
||||
@NonNull private final UIController mUIController;
|
||||
@ -149,7 +151,7 @@ public class LightningWebClient extends WebViewClient {
|
||||
String user = name.getText().toString();
|
||||
String pass = password.getText().toString();
|
||||
handler.proceed(user.trim(), pass.trim());
|
||||
Log.d(Constants.TAG, "Request Login");
|
||||
Log.d(TAG, "Request Login");
|
||||
|
||||
}
|
||||
})
|
||||
@ -364,7 +366,7 @@ public class LightningWebClient extends WebViewClient {
|
||||
try {
|
||||
mActivity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(Constants.TAG, "ActivityNotFoundException");
|
||||
Log.e(TAG, "ActivityNotFoundException");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user