Search in sources :

Example 6 with Theme

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ImageButton(android.widget.ImageButton) SuppressLint(android.annotation.SuppressLint) Theme(us.koller.cameraroll.themes.Theme) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) NonNull(android.support.annotation.NonNull)

Aggregations

Theme (us.koller.cameraroll.themes.Theme)6 Settings (us.koller.cameraroll.data.Settings)4 TextView (android.widget.TextView)3 Context (android.content.Context)2 NonNull (android.support.annotation.NonNull)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 ImageButton (android.widget.ImageButton)2 SuppressLint (android.annotation.SuppressLint)1 AlertDialog (android.support.v7.app.AlertDialog)1 ImageView (android.widget.ImageView)1 NestedRecyclerViewAlbumHolder (us.koller.cameraroll.adapter.main.viewHolder.NestedRecyclerViewAlbumHolder)1