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

Commit 71ec600a authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Profiles: Better layout/sizing of the app list icons and text" into ics

parents fe0b7208 326fdc23
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -29,24 +29,23 @@
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="6dip"
        android:layout_marginRight="6dip"
        android:layout_margin="4dip"
        android:maxWidth="36dip"
        android:maxHeight="36dip"
        android:adjustViewBounds="true"
        android:layout_gravity="center" />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_marginLeft="2dip"
        android:layout_marginRight="6dip"
        android:layout_marginTop="6dip"
        android:layout_marginBottom="6dip"
        android:layout_margin="4dip"
        android:layout_weight="1">

        <TextView android:id="@+android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal" />

+5 −8
Original line number Diff line number Diff line
@@ -86,6 +86,8 @@ public class AppGroupConfig extends SettingsPreferenceFragment

    private static final int MENU_ADD = Menu.FIRST + 1;

    PackageAdaptor mAppAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -95,11 +97,11 @@ public class AppGroupConfig extends SettingsPreferenceFragment

        final Bundle args = getArguments();
        if (args != null) {
            Log.d(TAG, "AppGroupConfig has valid arguments passed");

            mNotificationGroup = (NotificationGroup) args.getParcelable("NotificationGroup");
            mPackageManager = getPackageManager();
            mInstalledPackages = mPackageManager.getInstalledPackages(0);
            mAppAdapter = new PackageAdaptor(mInstalledPackages);
            mAppAdapter.update();

            updatePackages();

@@ -253,9 +255,7 @@ public class AppGroupConfig extends SettingsPreferenceFragment
        switch (id) {
            case DIALOG_APPS:
                final ListView list = new ListView(getActivity());
                PackageAdaptor adapter = new PackageAdaptor(mInstalledPackages);
                list.setAdapter(adapter);
                adapter.update();
                list.setAdapter(mAppAdapter);
                builder.setTitle(R.string.profile_choose_app);
                builder.setView(list);
                dialog = builder.create();
@@ -422,9 +422,6 @@ public class AppGroupConfig extends SettingsPreferenceFragment
            if (holder.icon != null) {
                Drawable loadIcon = applicationInfo.icon;
                holder.icon.setImageDrawable(loadIcon);
                holder.icon.setAdjustViewBounds(true);
                holder.icon.setMaxHeight(72);
                holder.icon.setMaxWidth(72);
            }
            return convertView;
        }
+7 −4
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ public class ApplicationItemPreference extends Preference {

    public ApplicationItemPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        Log.d(TAG, "ApplicationItemPreference: entered");
        setLayoutResource(R.layout.preference_icon);
        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.IconPreferenceScreen, defStyle, 0);
@@ -52,12 +51,16 @@ public class ApplicationItemPreference extends Preference {
    @Override
    public void onBindView(View view) {
        super.onBindView(view);
        Log.d(TAG, "onBindView: entered");

        float valueDips = 36.0f;
        final float scale = getContext().getResources().getDisplayMetrics().density;
        int valuePixels = (int) (valueDips * scale + 0.5f);

        ImageView imageView = (ImageView) view.findViewById(R.id.icon);
        if (imageView != null && mIcon != null) {
            imageView.setAdjustViewBounds(true);
            imageView.setMaxHeight(64);
            imageView.setMaxWidth(64);
            imageView.setMaxHeight(valuePixels);
            imageView.setMaxWidth(valuePixels);
            imageView.setImageDrawable(mIcon);
        }
    }