packages/apps/Car/LensPicker: Set LOCAL_SDK_VERSION where possible. am: 9279306a38 am: fc763a3f31
am: d28a94ac36 -s ours
Change-Id: I1b819ee59fce9813bce2d077aebc38e05db0033f
diff --git a/Android.mk b/Android.mk
index 331a4ce..6bba324 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,27 +22,23 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_USE_AAPT2 := true
+
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_RESOURCE_DIR += frameworks/support/design/res
LOCAL_PACKAGE_NAME := CarLensPickerApp
LOCAL_PRIVATE_PLATFORM_APIS := true
+LOCAL_OVERRIDES_PACKAGES += Launcher2 Launcher3
LOCAL_MODULE_TAGS := optional
include packages/apps/Car/libs/car-stream-ui-lib/car-stream-ui-lib.mk
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-design
-LOCAL_STATIC_JAVA_LIBRARIES += car-stream-lib
-
-LOCAL_AAPT_FLAGS += --extra-packages android.support.design
+LOCAL_STATIC_ANDROID_LIBRARIES += $(ANDROID_SUPPORT_CAR_TARGETS)
# Include support-v7-appcompat, if not already included
-ifeq (,$(findstring android-support-v7-appcompat,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res
-LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
+ifeq (,$(findstring android-support-v7-appcompat,$(LOCAL_STATIC_ANDROID_LIBRARIES)))
+LOCAL_STATIC_ANDROID_LIBRARIES += android-support-v7-appcompat
endif
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/res/layout/car_list_item_1_card.xml b/res/layout/car_list_item_1_card.xml
index e76cad6..8211143 100644
--- a/res/layout/car_list_item_1_card.xml
+++ b/res/layout/car_list_item_1_card.xml
@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" >
- <com.android.car.stream.ui.StreamCardView
+ <androidx.car.widget.ColumnCardView
android:id="@+id/stream_card"
android:layout_width="match_parent"
android:layout_height="@dimen/car_list_item_height"
@@ -35,7 +35,7 @@
android:id="@+id/icon"
android:layout_width="@dimen/car_list_item_icon_size"
android:layout_height="@dimen/car_list_item_icon_size"
- android:layout_marginLeft="@dimen/stream_card_keyline_1"
+ android:layout_marginLeft="@dimen/car_keyline_1"
android:scaleType="centerCrop"
android:layout_gravity="center_vertical|left" />
<TextView
@@ -43,16 +43,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
- android:layout_marginLeft="@dimen/stream_card_keyline_2"
- android:layout_marginRight="@dimen/stream_card_keyline_1"
- style="@style/CarBody1"
+ android:layout_marginLeft="@dimen/car_keyline_2"
+ android:layout_marginRight="@dimen/car_keyline_1"
+ style="@style/TextAppearance.Car.Body1"
android:singleLine="true" />
<ImageView
android:id="@+id/right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
- android:layout_marginRight="@dimen/stream_card_keyline_1"
+ android:layout_marginRight="@dimen/car_keyline_1"
android:scaleType="center" />
- </com.android.car.stream.ui.StreamCardView>
+ </androidx.car.widget.ColumnCardView>
</FrameLayout>
diff --git a/res/layout/lens_list.xml b/res/layout/lens_list.xml
index 311b9ee..f8381c7 100644
--- a/res/layout/lens_list.xml
+++ b/res/layout/lens_list.xml
@@ -22,19 +22,18 @@
android:layout_height="match_parent"
android:background="@color/car_lens_picker_bg_color"
android:clipChildren="false">
- <com.android.car.view.PagedListView
+ <androidx.car.widget.PagedListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="@dimen/lens_header_height"
- app:offsetRows="true"
- app:showDivider="false" />
+ android:layout_marginTop="@dimen/car_app_bar_height"
+ app:showPagedListViewDivider="false" />
<RelativeLayout
android:id="@+id/no_app_installed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
- android:layout_marginTop="@dimen/lens_header_height" >
+ android:layout_marginTop="@dimen/car_app_bar_height" >
<ImageView
android:id="@+id/error_icon"
android:layout_width="@dimen/lens_no_compatible_app_installed_icon_size"
@@ -53,6 +52,6 @@
android:layout_marginRight="@dimen/lens_no_compatible_app_installed_text_right_margin"
android:gravity="center"
android:textColor="@color/car_grey_100"
- style="@style/CarBody1" />
+ style="@style/TextAppearance.Car.Body1" />
</RelativeLayout>
</FrameLayout>
diff --git a/res/layout/resolver_list.xml b/res/layout/resolver_list.xml
index 9d63f3d..f071451 100644
--- a/res/layout/resolver_list.xml
+++ b/res/layout/resolver_list.xml
@@ -27,7 +27,7 @@
android:id="@+id/title_checkbox_container"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
- android:layout_height="@dimen/lens_header_height" >
+ android:layout_height="@dimen/car_app_bar_height" >
<TextView
android:id="@+id/title"
@@ -35,7 +35,7 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
- style="@style/CarBody1.Light" />
+ style="@style/TextAppearance.Car.Body1.Light" />
<CheckBox
android:id="@+id/always_checkbox"
@@ -48,22 +48,21 @@
android:checked="true"
android:paddingStart="@dimen/resolver_list_checkbox_spacing"
android:text="@string/alwaysUse"
- style="@style/CarBody1.Light" />
+ style="@style/TextAppearance.Car.Body1.Light" />
</RelativeLayout>
- <com.android.car.view.PagedListView
+ <androidx.car.widget.PagedListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="@dimen/lens_header_height"
- app:offsetRows="true"
- app:showDivider="false" />
+ android:layout_marginTop="@dimen/car_app_bar_height"
+ app:showPagedListViewDivider="false" />
<RelativeLayout
android:id="@+id/no_app_installed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
- android:layout_marginTop="@dimen/lens_header_height" >
+ android:layout_marginTop="@dimen/car_app_bar_height" >
<ImageView
android:id="@+id/error_icon"
android:layout_width="@dimen/lens_no_compatible_app_installed_icon_size"
@@ -82,6 +81,6 @@
android:layout_marginRight="@dimen/lens_no_compatible_app_installed_text_right_margin"
android:gravity="center"
android:textColor="@color/car_grey_100"
- style="@style/CarBody1" />
+ style="@style/TextAppearance.Car.Body1" />
</RelativeLayout>
</FrameLayout>
diff --git a/res/values/color.xml b/res/values/color.xml
index 6a4ef5e..e189e1a 100644
--- a/res/values/color.xml
+++ b/res/values/color.xml
@@ -20,5 +20,5 @@
<color name="car_lens_picker_bg_color">#ff11181d</color>
<!-- The ripple color for cards in the lens picker. -->
- <color name="car_lens_picker_ripple_color">@color/car_card_ripple_light_color_background</color>
+ <color name="car_lens_picker_ripple_color">@color/car_card_ripple_background</color>
</resources>
diff --git a/src/com/android/support/car/lenspicker/LensPickerActivity.java b/src/com/android/support/car/lenspicker/LensPickerActivity.java
index 19194f9..48be59e 100644
--- a/src/com/android/support/car/lenspicker/LensPickerActivity.java
+++ b/src/com/android/support/car/lenspicker/LensPickerActivity.java
@@ -27,13 +27,14 @@
import android.util.Log;
import android.view.View;
-import com.android.car.view.PagedListView;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import androidx.car.widget.DayNightStyle;
+import androidx.car.widget.PagedListView;
+
/**
* An Activity to present the user with a list of applications that can be started for a given
* facet.
@@ -60,7 +61,7 @@
mPagedListView = (PagedListView) findViewById(R.id.list_view);
// Set this to light mode, since the scroll bar buttons always appear
// on top of a dark scrim.
- mPagedListView.setLightMode();
+ mPagedListView.setDayNightStyle(DayNightStyle.FORCE_NIGHT);
findViewById(R.id.dismiss_area).setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/src/com/android/support/car/lenspicker/LensPickerAdapter.java b/src/com/android/support/car/lenspicker/LensPickerAdapter.java
index b982dca..eab3f7a 100644
--- a/src/com/android/support/car/lenspicker/LensPickerAdapter.java
+++ b/src/com/android/support/car/lenspicker/LensPickerAdapter.java
@@ -29,11 +29,11 @@
import android.view.View;
import android.view.ViewGroup;
-import com.android.car.view.PagedListView;
-
import java.util.ArrayList;
import java.util.List;
+import androidx.car.widget.PagedListView;
+
/**
* Lens picker adapter that provides the data fed into lens picker list.
*
diff --git a/src/com/android/support/car/lenspicker/LensPickerTrampolineActivity.java b/src/com/android/support/car/lenspicker/LensPickerTrampolineActivity.java
index 6a39c45..0dc0b20 100644
--- a/src/com/android/support/car/lenspicker/LensPickerTrampolineActivity.java
+++ b/src/com/android/support/car/lenspicker/LensPickerTrampolineActivity.java
@@ -59,6 +59,12 @@
finish();
return;
}
+ // if the lens picker is treated as a home app this will handle initial starts
+ if (intent.getCategories().contains(Intent.CATEGORY_HOME)) {
+ launchLastRunOrDefaultApplication();
+ finish();
+ return;
+ }
// Hide the shade if switching to a different facet.
hideNotificationsShade();
diff --git a/src/com/android/support/car/lenspicker/LensResolverActivity.java b/src/com/android/support/car/lenspicker/LensResolverActivity.java
index 6b0892a..3e737b5 100644
--- a/src/com/android/support/car/lenspicker/LensResolverActivity.java
+++ b/src/com/android/support/car/lenspicker/LensResolverActivity.java
@@ -34,13 +34,14 @@
import android.widget.CheckBox;
import android.widget.TextView;
-import com.android.car.stream.ui.ColumnCalculator;
-import com.android.car.view.PagedListView;
-
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import androidx.car.utils.ColumnCalculator;
+import androidx.car.widget.DayNightStyle;
+import androidx.car.widget.PagedListView;
+
/**
* An activity that is displayed when the system attempts to start an Intent for which there is
* more than one matching activity, allowing the user to decide which to go to.
@@ -107,11 +108,11 @@
Log.d(TAG, "Found " + size + " matching activities.");
}
- // The title container should match the width of the StreamCards in the list. Those cards
+ // The title container should match the width of the ColumnCards in the list. Those cards
// have their width set depending on the column span, which changes between screen sizes.
// As a result, need to set the width of the title container programmatically.
int defaultColumnSpan =
- getResources().getInteger(R.integer.stream_card_default_column_span);
+ getResources().getInteger(R.integer.column_card_default_column_span);
int cardWidth = ColumnCalculator.getInstance(this /* context */).getSizeForColumnSpan(
defaultColumnSpan);
View titleAndCheckboxContainer = findViewById(R.id.title_checkbox_container);
@@ -120,7 +121,7 @@
mAlwaysCheckbox = (CheckBox) findViewById(R.id.always_checkbox);
PagedListView pagedListView = (PagedListView) findViewById(R.id.list_view);
- pagedListView.setLightMode();
+ pagedListView.setDayNightStyle(DayNightStyle.FORCE_DAY);
ResolverAdapter adapter = new ResolverAdapter(this /* context */, infos);
adapter.setSelectionHandler(this);
diff --git a/src/com/android/support/car/lenspicker/ResolverAdapter.java b/src/com/android/support/car/lenspicker/ResolverAdapter.java
index b7fb8e2..3773cd1 100644
--- a/src/com/android/support/car/lenspicker/ResolverAdapter.java
+++ b/src/com/android/support/car/lenspicker/ResolverAdapter.java
@@ -28,11 +28,11 @@
import android.view.LayoutInflater;
import android.view.ViewGroup;
-import com.android.car.view.PagedListView;
-
import java.util.ArrayList;
import java.util.List;
+import androidx.car.widget.PagedListView;
+
/**
* An adapter that binds each of the rows within the {@link LensResolverActivity}.
*/