use of us.koller.cameraroll.themes.Theme in project Camera-Roll-Android-App by kollerlukas.
the class ColumnCountPreferenceDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// get initial value from pref
if (preference instanceof ColumnCountPreference) {
columnCount = ((ColumnCountPreference) preference).getColumnCount();
if (columnCount == 0) {
columnCount = Settings.DEFAULT_COLUMN_COUNT;
}
}
@SuppressLint("InflateParams") View view = LayoutInflater.from(getContext()).inflate(R.layout.pref_dialog_column_count, null);
final TextView textView = view.findViewById(R.id.column_count);
textView.setText(String.valueOf(columnCount));
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view.getId() == R.id.minus) {
if (columnCount > 1) {
columnCount--;
}
} else {
columnCount++;
}
textView.setText(String.valueOf(columnCount));
}
};
Theme theme = Settings.getInstance(getContext()).getThemeInstance(getContext());
int textColorSec = theme.getTextColorSecondary(getContext());
ImageButton minus = view.findViewById(R.id.minus);
minus.setColorFilter(textColorSec);
minus.setOnClickListener(onClickListener);
ImageButton plus = view.findViewById(R.id.plus);
plus.setColorFilter(textColorSec);
plus.setOnClickListener(onClickListener);
return new AlertDialog.Builder(getContext()).setTitle(R.string.column_count).setView(view).setPositiveButton(R.string.ok, this).setNegativeButton(R.string.cancel, null).create();
}
Aggregations