Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bda577b authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽 Committed by Mohammed Althaf T
Browse files

168-Fix_popup_icon_size_issue

parent 9445a17d
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -1324,7 +1324,7 @@ public class PopupView extends LinearLayout {
                actual_max_per_row = Math.min(actual_max_per_row, max_buttons_per_row);
            int button_width_dp = total_width_dp/actual_max_per_row;
            boolean use_scrollview = false;
            final int min_button_width_dp = 48; // needs to be at least 48dp to avoid Google Play pre-launch accessibility report warnings
            final int min_button_width_dp = 24; // needs to be at least 48dp to avoid Google Play pre-launch accessibility report warnings
            if( button_width_dp < min_button_width_dp && max_buttons_per_row == 0 ) {
                button_width_dp = min_button_width_dp;
                use_scrollview = true;
@@ -1350,6 +1350,13 @@ public class PopupView extends LinearLayout {
            if( MyDebug.LOG )
                Log.d(TAG, "addButtonOptionsToPopup time 2.05: " + (System.nanoTime() - debug_time));

            int padding_dp = 0;
            if (button_width_dp > min_button_width_dp) {
                padding_dp = button_width_dp - min_button_width_dp;
                padding_dp /= 2;
            }
            final int imageButtonPadding = (int) (padding_dp * scale + 0.5f);

            for(int button_indx=0;button_indx<supported_options.size();button_indx++) {
                final String supported_option = supported_options.get(button_indx);
                if( MyDebug.LOG )
@@ -1441,8 +1448,7 @@ public class PopupView extends LinearLayout {
                        Log.d(TAG, "addButtonOptionsToPopup time 2.13: " + (System.nanoTime() - debug_time));
                    image_button.setScaleType(ScaleType.FIT_CENTER);
                    image_button.setBackgroundColor(Color.TRANSPARENT);
                    final int padding = (int) (10 * scale + 0.5f); // convert dps to pixels
                    view.setPadding(padding, padding, padding, padding);
                    view.setPadding(imageButtonPadding, imageButtonPadding, imageButtonPadding, imageButtonPadding);
                }
                else {
                    @SuppressLint("InflateParams")
@@ -1465,10 +1471,15 @@ public class PopupView extends LinearLayout {
                    Log.d(TAG, "addButtonOptionsToPopup time 2.2: " + (System.nanoTime() - debug_time));

                ViewGroup.LayoutParams params = view.getLayoutParams();
                if (resource != -1) {
                    params.width = button_width;
                    params.height = button_width;
                } else {
                    params.width = button_width;
                    // be careful of making the height too smaller, as harder to touch buttons; remember that this also affects the
                    // ISO buttons on exposure panel, and not just the main popup!
                params.height = (int) (55 * ((resource != -1) ? scale : scale_font) + 0.5f); // convert dps to pixels
                    params.height = (int) (55 * scale + 0.5f); // convert dps to pixels
                }
                view.setLayoutParams(params);

                view.setContentDescription(button_string);