Search in sources :

Example 6 with MainActivity

use of net.sourceforge.opencamera.MainActivity in project OpenCamera by ageback.

the class PopupView method showInfoDialog.

private void showInfoDialog(int title_id, int info_id, final String info_preference_key) {
    final MainActivity main_activity = (MainActivity) this.getContext();
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(PopupView.this.getContext());
    alertDialog.setTitle(title_id);
    alertDialog.setMessage(info_id);
    alertDialog.setPositiveButton(android.R.string.ok, null);
    alertDialog.setNegativeButton(R.string.dont_show_again, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (MyDebug.LOG)
                Log.d(TAG, "user clicked dont_show_again for info dialog");
            final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(main_activity);
            SharedPreferences.Editor editor = sharedPreferences.edit();
            editor.putBoolean(info_preference_key, true);
            editor.apply();
        }
    });
    main_activity.showPreview(false);
    main_activity.setWindowFlagsForSettings();
    AlertDialog alert = alertDialog.create();
    // AlertDialog.Builder.setOnDismissListener() requires API level 17, so do it this way instead
    alert.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface arg0) {
            if (MyDebug.LOG)
                Log.d(TAG, "info dialog dismissed");
            main_activity.setWindowFlagsForCamera();
            main_activity.showPreview(true);
        }
    });
    main_activity.showAlert(alert);
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) SharedPreferences(android.content.SharedPreferences) MainActivity(net.sourceforge.opencamera.MainActivity)

Example 7 with MainActivity

use of net.sourceforge.opencamera.MainActivity in project OpenCamera by ageback.

the class PopupView method addButtonOptionsToPopup.

private void addButtonOptionsToPopup(List<String> supported_options, int icons_id, int values_id, String prefix_string, String current_value, String test_key, final ButtonOptionsPopupListener listener) {
    if (MyDebug.LOG)
        Log.d(TAG, "addButtonOptionsToPopup");
    MainActivity main_activity = (MainActivity) this.getContext();
    createButtonOptions(this, this.getContext(), total_width_dp, main_activity.getMainUI().getTestUIButtonsMap(), supported_options, icons_id, values_id, prefix_string, true, current_value, test_key, listener);
}
Also used : MainActivity(net.sourceforge.opencamera.MainActivity)

Aggregations

MainActivity (net.sourceforge.opencamera.MainActivity)7 View (android.view.View)4 HorizontalScrollView (android.widget.HorizontalScrollView)4 RadioButton (android.widget.RadioButton)4 ScrollView (android.widget.ScrollView)4 TextView (android.widget.TextView)4 SharedPreferences (android.content.SharedPreferences)3 Button (android.widget.Button)3 CompoundButton (android.widget.CompoundButton)3 ImageButton (android.widget.ImageButton)3 ViewGroup (android.view.ViewGroup)2 OnGlobalLayoutListener (android.view.ViewTreeObserver.OnGlobalLayoutListener)2 LinearLayout (android.widget.LinearLayout)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Bitmap (android.graphics.Bitmap)1 RadioGroup (android.widget.RadioGroup)1 ArrayList (java.util.ArrayList)1 Preview (net.sourceforge.opencamera.Preview.Preview)1