use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method multiColumnsDialog.
private void multiColumnsDialog() {
AlertDialog.Builder multiColumnDialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_multi_column, null);
((TextView) dialogLayout.findViewById(R.id.folders_title)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.media_title)).setTextColor(getTextColor());
((CardView) dialogLayout.findViewById(R.id.multi_column_card)).setCardBackgroundColor(getCardBackgroundColor());
dialogLayout.findViewById(R.id.multi_column_title).setBackgroundColor(getPrimaryColor());
final TextView nColFolders = (TextView) dialogLayout.findViewById(R.id.n_columns_folders);
final TextView nColMedia = (TextView) dialogLayout.findViewById(R.id.n_columns_media);
nColFolders.setTextColor(getSubTextColor());
nColMedia.setTextColor(getSubTextColor());
SeekBar barFolders = (SeekBar) dialogLayout.findViewById(R.id.seek_bar_n_columns_folders);
SeekBar barMedia = (SeekBar) dialogLayout.findViewById(R.id.seek_bar_n_columns_media);
themeSeekBar(barFolders);
themeSeekBar(barMedia);
nColFolders.setText(String.valueOf(SP.getInt("n_columns_folders", 2)));
nColMedia.setText(String.valueOf(SP.getInt("n_columns_media", 3)));
barFolders.setProgress(SP.getInt("n_columns_folders", 2) - 1);
barMedia.setProgress(SP.getInt("n_columns_media", 3) - 1);
barFolders.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
nColFolders.setText(String.valueOf(i + 1));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
barMedia.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
nColMedia.setText(String.valueOf(i + 1));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
multiColumnDialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int nFolders = Integer.parseInt(nColFolders.getText().toString());
int nMedia = Integer.parseInt(nColMedia.getText().toString());
SP.putInt("n_columns_folders", nFolders);
SP.putInt("n_columns_media", nMedia);
}
});
multiColumnDialogBuilder.setNegativeButton(getString(R.string.cancel).toUpperCase(), null);
multiColumnDialogBuilder.setView(dialogLayout);
multiColumnDialogBuilder.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method mapProviderDialog.
private void mapProviderDialog() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_map_provider, null);
TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.title);
((CardView) dialogLayout.findViewById(R.id.dialog_chose_provider_title)).setCardBackgroundColor(getCardBackgroundColor());
dialogTitle.setBackgroundColor(getPrimaryColor());
final RadioGroup mapProvider = (RadioGroup) dialogLayout.findViewById(R.id.radio_group_maps_provider);
RadioButton radioGoogleMaps = (RadioButton) dialogLayout.findViewById(R.id.radio_google_maps);
RadioButton radioMapBoxStreets = (RadioButton) dialogLayout.findViewById(R.id.radio_mapb_streets);
RadioButton radioMapBoxDark = (RadioButton) dialogLayout.findViewById(R.id.radio_mapb_dark);
RadioButton radioMapBoxLight = (RadioButton) dialogLayout.findViewById(R.id.radio_mapb_light);
RadioButton radioTyler = (RadioButton) dialogLayout.findViewById(R.id.radio_osm_tyler);
setRadioTextButtonColor(radioGoogleMaps, getSubTextColor());
setRadioTextButtonColor(radioMapBoxStreets, getSubTextColor());
setRadioTextButtonColor(radioMapBoxDark, getSubTextColor());
setRadioTextButtonColor(radioMapBoxLight, getSubTextColor());
setRadioTextButtonColor(radioTyler, getSubTextColor());
((TextView) dialogLayout.findViewById(R.id.header_proprietary_maps)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.header_free_maps)).setTextColor(getTextColor());
switch(StaticMapProvider.fromValue(SP.getInt(getString(R.string.preference_map_provider), StaticMapProvider.GOOGLE_MAPS.getValue()))) {
case GOOGLE_MAPS:
default:
radioGoogleMaps.setChecked(true);
break;
case MAP_BOX:
radioMapBoxStreets.setChecked(true);
break;
case MAP_BOX_DARK:
radioMapBoxDark.setChecked(true);
break;
case MAP_BOX_LIGHT:
radioMapBoxLight.setChecked(true);
break;
case TYLER:
radioTyler.setChecked(true);
break;
}
dialogBuilder.setNegativeButton(getString(R.string.cancel).toUpperCase(), null);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(mapProvider.getCheckedRadioButtonId()) {
case R.id.radio_google_maps:
default:
SP.putInt(getString(R.string.preference_map_provider), StaticMapProvider.GOOGLE_MAPS.getValue());
break;
case R.id.radio_mapb_streets:
SP.putInt(getString(R.string.preference_map_provider), StaticMapProvider.MAP_BOX.getValue());
break;
case R.id.radio_osm_tyler:
SP.putInt(getString(R.string.preference_map_provider), StaticMapProvider.TYLER.getValue());
break;
case R.id.radio_mapb_dark:
SP.putInt(getString(R.string.preference_map_provider), StaticMapProvider.MAP_BOX_DARK.getValue());
break;
case R.id.radio_mapb_light:
SP.putInt(getString(R.string.preference_map_provider), StaticMapProvider.MAP_BOX_LIGHT.getValue());
break;
}
}
});
dialogBuilder.setView(dialogLayout);
dialogBuilder.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method baseThemeDialog.
private void baseThemeDialog() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
final View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_basic_theme, null);
final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.basic_theme_title);
final CardView dialogCardView = (CardView) dialogLayout.findViewById(R.id.basic_theme_card);
final IconicsImageView whiteSelect = (IconicsImageView) dialogLayout.findViewById(R.id.white_basic_theme_select);
final IconicsImageView darkSelect = (IconicsImageView) dialogLayout.findViewById(R.id.dark_basic_theme_select);
final IconicsImageView darkAmoledSelect = (IconicsImageView) dialogLayout.findViewById(R.id.dark_amoled_basic_theme_select);
switch(getBaseTheme()) {
case LIGHT_THEME:
whiteSelect.setVisibility(View.VISIBLE);
darkSelect.setVisibility(View.GONE);
darkAmoledSelect.setVisibility(View.GONE);
break;
case DARK_THEME:
whiteSelect.setVisibility(View.GONE);
darkSelect.setVisibility(View.VISIBLE);
darkAmoledSelect.setVisibility(View.GONE);
break;
case AMOLED_THEME:
whiteSelect.setVisibility(View.GONE);
darkSelect.setVisibility(View.GONE);
darkAmoledSelect.setVisibility(View.VISIBLE);
break;
}
/** SET OBJ THEME **/
dialogTitle.setBackgroundColor(getPrimaryColor());
dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
dialogLayout.findViewById(R.id.ll_white_basic_theme).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
whiteSelect.setVisibility(View.VISIBLE);
darkSelect.setVisibility(View.GONE);
darkAmoledSelect.setVisibility(View.GONE);
setBaseTheme(LIGHT_THEME, false);
//dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
//setTheme();
}
});
dialogLayout.findViewById(R.id.ll_dark_basic_theme).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
whiteSelect.setVisibility(View.GONE);
darkSelect.setVisibility(View.VISIBLE);
darkAmoledSelect.setVisibility(View.GONE);
setBaseTheme(DARK_THEME, false);
//dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
//setTheme();
}
});
dialogLayout.findViewById(R.id.ll_dark_amoled_basic_theme).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
whiteSelect.setVisibility(View.GONE);
darkSelect.setVisibility(View.GONE);
darkAmoledSelect.setVisibility(View.VISIBLE);
setBaseTheme(AMOLED_THEME, false);
//dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
//setTheme();
}
});
dialogBuilder.setView(dialogLayout);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SP.putInt(getString(org.horaapps.leafpic.R.string.preference_base_theme), getBaseTheme());
setTheme();
}
});
dialogBuilder.setNegativeButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setBaseTheme(ThemeHelper.getBaseTheme(getApplicationContext()), false);
setTheme();
}
});
dialogBuilder.setView(dialogLayout);
dialogBuilder.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method primaryColorPiker.
private void primaryColorPiker() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
final View dialogLayout = getLayoutInflater().inflate(R.layout.color_piker_primary, null);
final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary);
final LineColorPicker colorPicker2 = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary_2);
final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.cp_primary_title);
CardView dialogCardView = (CardView) dialogLayout.findViewById(R.id.cp_primary_card);
dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
colorPicker.setColors(ColorPalette.getBaseColors(getApplicationContext()));
for (int i : colorPicker.getColors()) for (int i2 : ColorPalette.getColors(getBaseContext(), i)) if (i2 == getPrimaryColor()) {
colorPicker.setSelectedColor(i);
colorPicker2.setColors(ColorPalette.getColors(getBaseContext(), i));
colorPicker2.setSelectedColor(i2);
break;
}
dialogTitle.setBackgroundColor(getPrimaryColor());
colorPicker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int c) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isTranslucentStatusBar()) {
getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
} else
getWindow().setStatusBarColor(c);
}
toolbar.setBackgroundColor(c);
dialogTitle.setBackgroundColor(c);
colorPicker2.setColors(ColorPalette.getColors(getApplicationContext(), colorPicker.getColor()));
colorPicker2.setSelectedColor(colorPicker.getColor());
}
});
colorPicker2.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int c) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isTranslucentStatusBar()) {
getWindow().setStatusBarColor(ColorPalette.getObscuredColor(c));
} else
getWindow().setStatusBarColor(c);
if (isNavigationBarColored())
getWindow().setNavigationBarColor(c);
else
getWindow().setNavigationBarColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
}
toolbar.setBackgroundColor(c);
dialogTitle.setBackgroundColor(c);
}
});
dialogBuilder.setView(dialogLayout);
dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isTranslucentStatusBar()) {
getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
} else
getWindow().setStatusBarColor(getPrimaryColor());
}
toolbar.setBackgroundColor(getPrimaryColor());
dialog.cancel();
}
});
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SP.putInt(getString(R.string.preference_primary_color), colorPicker2.getColor());
updateTheme();
setNavBarColor();
setScrollViewColor(scr);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isTranslucentStatusBar()) {
getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
} else {
getWindow().setStatusBarColor(getPrimaryColor());
}
}
}
});
dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isTranslucentStatusBar()) {
getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
} else
getWindow().setStatusBarColor(getPrimaryColor());
if (isNavigationBarColored())
getWindow().setNavigationBarColor(getPrimaryColor());
else
getWindow().setNavigationBarColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
}
toolbar.setBackgroundColor(getPrimaryColor());
}
});
dialogBuilder.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method accentColorPiker.
private void accentColorPiker() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
final View dialogLayout = getLayoutInflater().inflate(R.layout.color_piker_accent, null);
final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_accent);
final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.cp_accent_title);
CardView cv = (CardView) dialogLayout.findViewById(R.id.cp_accent_card);
cv.setCardBackgroundColor(getCardBackgroundColor());
colorPicker.setColors(ColorPalette.getAccentColors(getApplicationContext()));
colorPicker.setSelectedColor(getAccentColor());
dialogTitle.setBackgroundColor(getAccentColor());
colorPicker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int c) {
dialogTitle.setBackgroundColor(c);
updateViewswithAccentColor(colorPicker.getColor());
}
});
dialogBuilder.setView(dialogLayout);
dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
updateViewswithAccentColor(getAccentColor());
}
});
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SP.putInt(getString(R.string.preference_accent_color), colorPicker.getColor());
updateTheme();
updateViewswithAccentColor(getAccentColor());
}
});
dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
updateViewswithAccentColor(getAccentColor());
}
});
dialogBuilder.show();
}
Aggregations