Fixed bug with recyclerview
This commit is contained in:
parent
b85ad208de
commit
256b003c5d
@ -908,6 +908,12 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
mTabsView.tabChanged(position);
|
mTabsView.tabChanged(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyTabViewInitialized() {
|
||||||
|
Log.d(TAG, "Notify Tabs Initialized");
|
||||||
|
mTabsView.tabsInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tabChanged(LightningView tab) {
|
public void tabChanged(LightningView tab) {
|
||||||
mPresenter.tabChangeOccurred(tab);
|
mPresenter.tabChangeOccurred(tab);
|
||||||
|
@ -484,7 +484,7 @@ public class TabsManager {
|
|||||||
* @return Return the index of the current tab, or -1 if the
|
* @return Return the index of the current tab, or -1 if the
|
||||||
* current tab is null.
|
* current tab is null.
|
||||||
*/
|
*/
|
||||||
public int indexOfCurrentTab() {
|
public synchronized int indexOfCurrentTab() {
|
||||||
return mTabList.indexOf(mCurrentTab);
|
return mTabList.indexOf(mCurrentTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ public class TabsManager {
|
|||||||
*
|
*
|
||||||
* @return Return the index of the tab, or -1 if the tab isn't in the list.
|
* @return Return the index of the tab, or -1 if the tab isn't in the list.
|
||||||
*/
|
*/
|
||||||
public int indexOfTab(LightningView tab) {
|
public synchronized int indexOfTab(LightningView tab) {
|
||||||
return mTabList.indexOf(tab);
|
return mTabList.indexOf(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.anthonycr.bonsai.Schedulers;
|
||||||
import com.squareup.otto.Bus;
|
import com.squareup.otto.Bus;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -63,13 +64,14 @@ public class BrowserPresenter {
|
|||||||
*/
|
*/
|
||||||
public void setupTabs(@Nullable Intent intent) {
|
public void setupTabs(@Nullable Intent intent) {
|
||||||
mTabsModel.initializeTabs((Activity) mView, intent, mIsIncognito)
|
mTabsModel.initializeTabs((Activity) mView, intent, mIsIncognito)
|
||||||
|
.subscribeOn(Schedulers.main())
|
||||||
.subscribe(new OnSubscribe<Void>() {
|
.subscribe(new OnSubscribe<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
// At this point we always have at least a tab in the tab manager
|
// At this point we always have at least a tab in the tab manager
|
||||||
tabChanged(mTabsModel.last());
|
mView.notifyTabViewInitialized();
|
||||||
mView.notifyTabViewAdded();
|
|
||||||
mView.updateTabNumber(mTabsModel.size());
|
mView.updateTabNumber(mTabsModel.size());
|
||||||
|
tabChanged(mTabsModel.last());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -35,4 +35,6 @@ public interface BrowserView {
|
|||||||
|
|
||||||
void notifyTabViewChanged(int position);
|
void notifyTabViewChanged(int position);
|
||||||
|
|
||||||
|
void notifyTabViewInitialized();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,5 @@ public interface TabsView {
|
|||||||
|
|
||||||
void tabChanged(int position);
|
void tabChanged(int position);
|
||||||
|
|
||||||
|
void tabsInitialized();
|
||||||
}
|
}
|
||||||
|
@ -98,8 +98,8 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
|||||||
mColorMode = mPreferences.getColorModeEnabled();
|
mColorMode = mPreferences.getColorModeEnabled();
|
||||||
mColorMode &= !mDarkTheme;
|
mColorMode &= !mDarkTheme;
|
||||||
mIconColor = mDarkTheme ?
|
mIconColor = mDarkTheme ?
|
||||||
ThemeUtils.getIconDarkThemeColor(context) :
|
ThemeUtils.getIconDarkThemeColor(context) :
|
||||||
ThemeUtils.getIconLightThemeColor(context);
|
ThemeUtils.getIconLightThemeColor(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -184,6 +184,13 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
|||||||
mBus.unregister(this);
|
mBus.unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tabsInitialized() {
|
||||||
|
if (mTabsAdapter != null) {
|
||||||
|
mTabsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void reinitializePreferences() {
|
public void reinitializePreferences() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity == null) {
|
if (activity == null) {
|
||||||
@ -193,8 +200,8 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
|||||||
mColorMode = mPreferences.getColorModeEnabled();
|
mColorMode = mPreferences.getColorModeEnabled();
|
||||||
mColorMode &= !mDarkTheme;
|
mColorMode &= !mDarkTheme;
|
||||||
mIconColor = mDarkTheme ?
|
mIconColor = mDarkTheme ?
|
||||||
ThemeUtils.getIconDarkThemeColor(activity) :
|
ThemeUtils.getIconDarkThemeColor(activity) :
|
||||||
ThemeUtils.getIconLightThemeColor(activity);
|
ThemeUtils.getIconLightThemeColor(activity);
|
||||||
if (mTabsAdapter != null) {
|
if (mTabsAdapter != null) {
|
||||||
mTabsAdapter.notifyDataSetChanged();
|
mTabsAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@ -356,7 +363,7 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
|||||||
|
|
||||||
public Bitmap getDesaturatedBitmap(@NonNull Bitmap favicon) {
|
public Bitmap getDesaturatedBitmap(@NonNull Bitmap favicon) {
|
||||||
Bitmap grayscaleBitmap = Bitmap.createBitmap(favicon.getWidth(),
|
Bitmap grayscaleBitmap = Bitmap.createBitmap(favicon.getWidth(),
|
||||||
favicon.getHeight(), Bitmap.Config.ARGB_8888);
|
favicon.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
Canvas c = new Canvas(grayscaleBitmap);
|
Canvas c = new Canvas(grayscaleBitmap);
|
||||||
if (mColorMatrix == null || mFilter == null || mPaint == null) {
|
if (mColorMatrix == null || mFilter == null || mPaint == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user