Fixed null pointer exception, fixed threading bug on ICS, upgraded leak canary version
This commit is contained in:
parent
008e61b5a8
commit
984aa133ec
@ -101,7 +101,7 @@ dependencies {
|
|||||||
compile project(':libnetcipher')
|
compile project(':libnetcipher')
|
||||||
|
|
||||||
// memory leak analysis
|
// memory leak analysis
|
||||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
|
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
|
||||||
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
|
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
|
||||||
provided 'javax.annotation:jsr250-api:1.0'
|
provided 'javax.annotation:jsr250-api:1.0'
|
||||||
}
|
}
|
@ -1752,6 +1752,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
}
|
}
|
||||||
mCustomViewCallback = null;
|
mCustomViewCallback = null;
|
||||||
setRequestedOrientation(mOriginalOrientation);
|
setRequestedOrientation(mOriginalOrientation);
|
||||||
|
setTabHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VideoCompletionListener implements MediaPlayer.OnCompletionListener,
|
private class VideoCompletionListener implements MediaPlayer.OnCompletionListener,
|
||||||
@ -1795,8 +1796,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
View decor = window.getDecorView();
|
View decor = window.getDecorView();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
||||||
if (immersive) {
|
if (immersive) {
|
||||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
@ -1804,7 +1803,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
|
} else {
|
||||||
|
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||||
}
|
}
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
} else {
|
} else {
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package acr.browser.lightning.async;
|
package acr.browser.lightning.async;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
@ -141,10 +142,20 @@ public class ImageDownloadTask extends AsyncTask<Void, Void, Bitmap> {
|
|||||||
super.onPostExecute(bitmap);
|
super.onPostExecute(bitmap);
|
||||||
AsyncExecutor.getInstance().notifyThreadFinish();
|
AsyncExecutor.getInstance().notifyThreadFinish();
|
||||||
final Bitmap fav = Utils.padFavicon(bitmap);
|
final Bitmap fav = Utils.padFavicon(bitmap);
|
||||||
ImageView view = mFaviconImage.get();
|
final ImageView view = mFaviconImage.get();
|
||||||
if (view != null && view.getTag().equals(mWeb.getUrl().hashCode())) {
|
if (view != null && view.getTag().equals(mWeb.getUrl().hashCode())) {
|
||||||
|
Context context = view.getContext();
|
||||||
|
if (context instanceof Activity) {
|
||||||
|
((Activity) context).runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
view.setImageBitmap(fav);
|
view.setImageBitmap(fav);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
view.setImageBitmap(fav);
|
||||||
|
}
|
||||||
|
}
|
||||||
mWeb.setBitmap(fav);
|
mWeb.setBitmap(fav);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
|||||||
public void onSubscribe(@NonNull Subscriber<BookmarkViewAdapter> subscriber) {
|
public void onSubscribe(@NonNull Subscriber<BookmarkViewAdapter> subscriber) {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
mBookmarkAdapter = new BookmarkViewAdapter(getContext(), mBookmarks);
|
mBookmarkAdapter = new BookmarkViewAdapter(context, mBookmarks);
|
||||||
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false);
|
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), false);
|
||||||
subscriber.onNext(mBookmarkAdapter);
|
subscriber.onNext(mBookmarkAdapter);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
|
|||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
cacheFile.setLastModified(System.currentTimeMillis());
|
cacheFile.setLastModified(System.currentTimeMillis());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
Log.w(TAG, "Problem getting search suggestions", e);
|
||||||
} finally {
|
} finally {
|
||||||
Utils.close(in);
|
Utils.close(in);
|
||||||
Utils.close(fos);
|
Utils.close(fos);
|
||||||
|
@ -64,8 +64,8 @@ class LightningChromeClient extends WebChromeClient {
|
|||||||
*
|
*
|
||||||
* @param icon the icon to cache
|
* @param icon the icon to cache
|
||||||
*/
|
*/
|
||||||
private static void cacheFavicon(final String url, @Nullable final Bitmap icon, @NonNull final Context context) {
|
private static void cacheFavicon(@Nullable final String url, @Nullable final Bitmap icon, @NonNull final Context context) {
|
||||||
if (icon == null) return;
|
if (icon == null || url == null) return;
|
||||||
final Uri uri = Uri.parse(url);
|
final Uri uri = Uri.parse(url);
|
||||||
if (uri.getHost() == null) {
|
if (uri.getHost() == null) {
|
||||||
return;
|
return;
|
||||||
@ -82,7 +82,7 @@ class LightningChromeClient extends WebChromeClient {
|
|||||||
mLightningView.getTitleInfo().setTitle(mActivity.getString(R.string.untitled));
|
mLightningView.getTitleInfo().setTitle(mActivity.getString(R.string.untitled));
|
||||||
}
|
}
|
||||||
mUIController.tabChanged(mLightningView);
|
mUIController.tabChanged(mLightningView);
|
||||||
if (view != null) {
|
if (view != null && view.getUrl() != null) {
|
||||||
mUIController.updateHistory(title, view.getUrl());
|
mUIController.updateHistory(title, view.getUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user