Java Code Examples for android.app.UiModeManager#getNightMode()

The following examples show how to use android.app.UiModeManager#getNightMode() . 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: TopicSearchFragment.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    int layoutId;

    UiModeManager uiModeManager = (UiModeManager) getContext().getSystemService(Context.UI_MODE_SERVICE);
    if (DeviceUtils.isGreaterEqual_9_0() && uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
        layoutId = R.layout.fragment_topic_list_night;
    } else {
        layoutId = R.layout.fragment_topic_list;
    }
    return inflater.inflate(layoutId, container, false);
}
 
Example 2
Source File: PhoneConfiguration.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 4 votes vote down vote up
public boolean isBetaFixNightTheme() {
    UiModeManager uiModeManager = (UiModeManager) ContextUtils.getContext().getSystemService(Context.UI_MODE_SERVICE);
    return (PreferenceUtils.getData(PreferenceKey.KEY_BETA_FIX_NIGHT_THEME, false) || uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES)
            && DeviceUtils.isGreaterEqual_9_0();
}