org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver Java Examples

The following examples show how to use org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LayoutManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the Layout for the state of the {@link TabModelSelector} after initialization.
 * If the TabModelSelector is not yet initialized when this function is called, a
 * {@link TabModelSelectorObserver} is created to listen for when it is ready.
 */
private void updateLayoutForTabModelSelector() {
    if (mTabModelSelector.isTabStateInitialized() && getActiveLayout() != null) {
        getActiveLayout().onTabStateInitialized();
    } else {
        mTabModelSelector.addObserver(new EmptyTabModelSelectorObserver() {
            @Override
            public void onTabStateInitialized() {
                if (getActiveLayout() != null) getActiveLayout().onTabStateInitialized();

                final EmptyTabModelSelectorObserver observer = this;
                new Handler().post(new Runnable() {
                    @Override
                    public void run() {
                        mTabModelSelector.removeObserver(observer);
                    }
                });
            }
        });
    }
}
 
Example #2
Source File: LayoutManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the Layout for the state of the {@link TabModelSelector} after initialization.
 * If the TabModelSelector is not yet initialized when this function is called, a
 * {@link TabModelSelectorObserver} is created to listen for when it is ready.
 */
private void updateLayoutForTabModelSelector() {
    if (mTabModelSelector.isTabStateInitialized() && getActiveLayout() != null) {
        getActiveLayout().onTabStateInitialized();
    } else {
        mTabModelSelector.addObserver(new EmptyTabModelSelectorObserver() {
            @Override
            public void onTabStateInitialized() {
                if (getActiveLayout() != null) getActiveLayout().onTabStateInitialized();

                final EmptyTabModelSelectorObserver observer = this;
                new Handler().post(new Runnable() {
                    @Override
                    public void run() {
                        mTabModelSelector.removeObserver(observer);
                    }
                });
            }
        });
    }
}
 
Example #3
Source File: LayoutManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the Layout for the state of the {@link TabModelSelector} after initialization.
 * If the TabModelSelector is not yet initialized when this function is called, a
 * {@link TabModelSelectorObserver} is created to listen for when it is ready.
 */
private void updateLayoutForTabModelSelector() {
    if (mTabModelSelector.isTabStateInitialized() && getActiveLayout() != null) {
        getActiveLayout().onTabStateInitialized();
    } else {
        mTabModelSelector.addObserver(new EmptyTabModelSelectorObserver() {
            @Override
            public void onTabStateInitialized() {
                if (getActiveLayout() != null) getActiveLayout().onTabStateInitialized();

                final EmptyTabModelSelectorObserver observer = this;
                new Handler().post(new Runnable() {
                    @Override
                    public void run() {
                        mTabModelSelector.removeObserver(observer);
                    }
                });
            }
        });
    }
}
 
Example #4
Source File: BottomSheet.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * @param tabModelSelector A TabModelSelector for getting the current tab and activity.
 */
public void setTabModelSelector(TabModelSelector tabModelSelector) {
    mTabModelSelector = tabModelSelector;

    if (mHasRootLayoutOccurred && mTabModelSelector.isTabStateInitialized()) {
        showHelpBubbleIfNecessary();
    } else if (!mTabModelSelector.isTabStateInitialized()) {
        mTabModelSelector.addObserver(new EmptyTabModelSelectorObserver() {
            @Override
            public void onTabStateInitialized() {
                if (mHasRootLayoutOccurred) showHelpBubbleIfNecessary();
                mTabModelSelector.removeObserver(this);
            }
        });
    }

    mNtpController.setTabModelSelector(tabModelSelector);
}
 
Example #5
Source File: AssistStatusHandler.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Builds an assist status handler for the specified activity.
 * @param activity The activity whose assist status should be updated.
 */
public AssistStatusHandler(Activity activity) {
    mActivity = activity;

    mSelectorObserver = new EmptyTabModelSelectorObserver() {
        @Override
        public void onChange() {
            updateAssistState();
        }
    };
}
 
Example #6
Source File: AssistStatusHandler.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Builds an assist status handler for the specified activity.
 * @param activity The activity whose assist status should be updated.
 */
public AssistStatusHandler(Activity activity) {
    mActivity = activity;

    mSelectorObserver = new EmptyTabModelSelectorObserver() {
        @Override
        public void onChange() {
            updateAssistState();
        }
    };
}
 
Example #7
Source File: AssistStatusHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Builds an assist status handler for the specified activity.
 * @param activity The activity whose assist status should be updated.
 */
public AssistStatusHandler(Activity activity) {
    mActivity = activity;

    mSelectorObserver = new EmptyTabModelSelectorObserver() {
        @Override
        public void onChange() {
            updateAssistState();
        }
    };
}