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

Commit d4da0af7 authored by Kirill Rakhman's avatar Kirill Rakhman Committed by Steve Kondik
Browse files

Make preselected item clickable in intent chooser

Make the text black for consistency with the list, also replicate the
longpress behaviour from the list

Change-Id: Idcc8cce8ee20d8231232d5e57f7062efc9efd12a

ResolverActivity: fix null pointer exception

if alwaysUseOption is true but mAdapter.hasFilteredItem() is not, we try
to set a LongClickListener on a non existant view.

move the assingment of the LongClickListener down to ensure
mAdapter.hasFilteredItem() is true.

Change-Id: I04df845325a9a21f5563292e56728dcc51e91623
parent 9903390c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class ResolverActivity extends Activity {
    private boolean mSafeForwardingMode;
    private boolean mAlwaysUseOption;
    private AbsListView mAdapterView;
    private ViewGroup mFilteredItemContainer;
    private Button mAlwaysButton;
    private Button mOnceButton;
    private View mProfileView;
@@ -299,6 +300,21 @@ public class ResolverActivity extends Activity {
        }

        if (mAdapter.hasFilteredItem()) {
            mFilteredItemContainer = (ViewGroup) findViewById(R.id.filtered_item_container);
            mFilteredItemContainer.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    DisplayResolveInfo filteredItem = mAdapter.getFilteredItem();

                    if (filteredItem == null) {
                        return false;
                    }

                    showAppDetails(filteredItem.getResolveInfo());
                    return true;
                }
            });

            setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
            mOnceButton.setEnabled(true);
        }
+7 −1
Original line number Diff line number Diff line
@@ -34,9 +34,14 @@
        android:elevation="8dp" >

        <LinearLayout
            android:id="@+id/filtered_item_container"
            android:layout_width="match_parent"
            android:layout_height="64dp"
            android:orientation="horizontal" >
            android:orientation="horizontal"
            android:onClick="onButtonClick"
            android:clickable="true"
            android:background="?android:selectableItemBackground"
            >

            <ImageView android:id="@+id/icon"
                       android:layout_width="24dp"
@@ -52,6 +57,7 @@
                      android:layout_height="?android:attr/listPreferredItemHeight"
                      android:layout_marginStart="16dp"
                      android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textColor="?attr/textColorPrimary"
                      android:gravity="start|center_vertical"
                      android:paddingEnd="16dp" />
            <LinearLayout android:id="@+id/profile_button"
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@
  <java-symbol type="id" name="profile_badge_line2" />
  <java-symbol type="id" name="profile_badge_line3" />
  <java-symbol type="id" name="transitionPosition" />
  <java-symbol type="id" name="filtered_item_container" />

  <java-symbol type="attr" name="actionModeShareDrawable" />
  <java-symbol type="attr" name="alertDialogCenterButtons" />