Java Code Examples for com.afollestad.materialdialogs.color.ColorChooserDialog#getTitle()

The following examples show how to use com.afollestad.materialdialogs.color.ColorChooserDialog#getTitle() . 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: SettingsActivity.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
                Arrays.sort(NonProAllowedColors.PRIMARY_COLORS);
                if (Arrays.binarySearch(NonProAllowedColors.PRIMARY_COLORS, selectedColor) < 0) {
            }
            ThemeStore.editTheme(this)
                    .primaryColor(selectedColor)
                    .commit();
            break;
        case R.string.accent_color:
                Arrays.sort(NonProAllowedColors.ACCENT_COLORS);
                if (Arrays.binarySearch(NonProAllowedColors.ACCENT_COLORS, selectedColor) < 0) {
                }
            ThemeStore.editTheme(this)
                    .accentColor(selectedColor)
                    .commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example 2
Source File: SettingsActivity.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            ThemeStore.editTheme(this)
                    .primaryColor(selectedColor)
                    .commit();
            break;
        case R.string.accent_color:
            ThemeStore.editTheme(this)
                    .accentColor(selectedColor)
                    .commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example 3
Source File: SettingsActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            ThemeStore.editTheme(this).primaryColor(selectedColor).commit();
            break;
        case R.string.accent_color:
            ThemeStore.editTheme(this).accentColor(selectedColor).commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example 4
Source File: SettingsActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            ThemeStore.editTheme(this)
                    .primaryColor(selectedColor)
                    .commit();
            break;
        case R.string.accent_color:
            ThemeStore.editTheme(this)
                    .accentColor(selectedColor)
                    .commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example 5
Source File: SettingsFragment.java    From Pasta-Music with Apache License 2.0 6 votes vote down vote up
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            if (PreferenceUtils.getPrimaryColor(getContext()) == selectedColor) return;
            prefs.edit().putInt(PreferenceUtils.PRIMARY, selectedColor).apply();
            primary.transition(new ColorDrawable(selectedColor));
            break;
        case R.string.accent_color:
            if (PreferenceUtils.getAccentColor(getContext()) == selectedColor) return;
            prefs.edit().putInt(PreferenceUtils.ACCENT, selectedColor).apply();
            accent.transition(new ColorDrawable(selectedColor));
            break;
        default:
            return;
    }
    pasta.showToast(getString(R.string.restart_msg));
}
 
Example 6
Source File: PrefsSettings.java    From Calculator with Apache License 2.0 5 votes vote down vote up
@Override
public void onColorSelection(ColorChooserDialog dialog, int color) {
    int title = dialog.getTitle();
    if (title == R.string.actionbr) {
        actionbar = color;
    } else if (title == R.string.navbr) {
        navbar = color;
    } else if (title == R.string.txt) {
        text = color;
    }
    refresh();
}
 
Example 7
Source File: SettingsActivity.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            if (!App.isProVersion()) {
                Arrays.sort(NonProAllowedColors.PRIMARY_COLORS);
                if (Arrays.binarySearch(NonProAllowedColors.PRIMARY_COLORS, selectedColor) < 0) {
                    // color wasn't found
                    Toast.makeText(this, R.string.only_the_first_5_colors_available, Toast.LENGTH_LONG).show();
                    startActivity(new Intent(this, PurchaseActivity.class));
                    return;
                }
            }
            ThemeStore.editTheme(this)
                    .primaryColor(selectedColor)
                    .commit();
            break;
        case R.string.accent_color:
            if (!App.isProVersion()) {
                Arrays.sort(NonProAllowedColors.ACCENT_COLORS);
                if (Arrays.binarySearch(NonProAllowedColors.ACCENT_COLORS, selectedColor) < 0) {
                    // color wasn't found
                    Toast.makeText(this, R.string.only_the_first_5_colors_available, Toast.LENGTH_LONG).show();
                    startActivity(new Intent(this, PurchaseActivity.class));
                    return;
                }
            }
            ThemeStore.editTheme(this)
                    .accentColor(selectedColor)
                    .commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example 8
Source File: ScrollingActivity.java    From recycler-fast-scroll with Apache License 2.0 5 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog colorChooserDialog, int color) {
    switch (colorChooserDialog.getTitle()) {
        case R.string.handle_normal_color:
            mRecyclerFastScroller.setHandleNormalColor(color);
            break;
        case R.string.handle_pressed_color:
            mRecyclerFastScroller.setHandlePressedColor(color);
            break;
        case R.string.scrollbar_color:
            mRecyclerFastScroller.setBarColor(color);
            break;
    }
}