Initial set up for CustomizationPickerActivity
Bug: 120560581
Change-Id: I1b0f29d9f4a5aad28ec1d0c9b94f8059c056ebf1
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 79d81d4..7610e13 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,6 +2,25 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.wallpaper">
- <uses-sdk android:targetSdkVersion="28" android:minSdkVersion="28"/>
+ <uses-sdk android:targetSdkVersion="28" android:minSdkVersion="28"/>
+ <application
+ android:extractNativeLibs="false"
+ android:hardwareAccelerated="true"
+ android:icon="@mipmap/product_logo_wallpapers_launcher_color_48"
+ android:label="@string/app_name"
+ android:theme="@style/WallpaperTheme"
+ android:requiredForAllUsers="true"
+ android:restoreAnyVersion="true"
+ android:supportsRtl="true">
+ <activity android:name="com.android.theme.picker.ThemePickerActivity"
+ android:label="@string/app_name"
+ android:theme="@style/WallpaperTheme"
+ android:resizeableActivity="true">
+ <intent-filter>
+ <action android:name="android.intent.action.SET_WALLPAPER"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+ </application>
</manifest>
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100755
index 0000000..a57fd07
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- The name of this application, a theme picker. [CHAR LIMIT=50] -->
+ <string name="app_name">Themes & Styles</string>
+
+</resources>
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
new file mode 100644
index 0000000..c482826
--- /dev/null
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.customization.picker;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import androidx.annotation.Nullable;
+
+import com.android.wallpaper.model.WallpaperInfo;
+import com.android.wallpaper.module.FormFactorChecker;
+import com.android.wallpaper.module.Injector;
+import com.android.wallpaper.module.InjectorProvider;
+import com.android.wallpaper.module.UserEventLogger;
+import com.android.wallpaper.picker.BaseActivity;
+import com.android.wallpaper.picker.CategoryFragment;
+import com.android.wallpaper.picker.CategoryFragment.CategoryFragmentHost;
+import com.android.wallpaper.picker.MyPhotosLauncher.PermissionChangedListener;
+import com.android.wallpaper.picker.TopLevelPickerActivity;
+import com.android.wallpaper.picker.WallpaperPickerDelegate;
+import com.android.wallpaper.picker.WallpapersUiContainer;
+
+//TODO(santie): implement
+public class CustomizationPickerActivity extends BaseActivity implements WallpapersUiContainer,
+ CategoryFragmentHost {
+
+ private static final String TAG = "CustomizationPickerActivity";
+
+ private WallpaperPickerDelegate mDelegate;
+ private UserEventLogger mUserEventLogger;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Injector injector = InjectorProvider.getInjector();
+ mDelegate = new WallpaperPickerDelegate(this, this, injector);
+ mUserEventLogger = injector.getUserEventLogger(this);
+
+ if (!supportsCustomization()) {
+ Log.w(TAG, "Themes not supported, reverting to Wallpaper Picker");
+ Intent intent = new Intent(this, TopLevelPickerActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ }
+
+ private boolean supportsCustomization() {
+ // TODO (santie): check for actual themes support
+ return mDelegate.getFormFactor() == FormFactorChecker.FORM_FACTOR_MOBILE;
+ }
+
+ @Override
+ public void requestExternalStoragePermission(PermissionChangedListener listener) {
+
+ }
+
+ @Override
+ public boolean isReadExternalStoragePermissionGranted() {
+ return false;
+ }
+
+ @Override
+ public void showViewOnlyPreview(WallpaperInfo wallpaperInfo) {
+
+ }
+
+ /**
+ * Shows the picker activity for the given category.
+ */
+ @Override
+ public void show(String collectionId) {
+ mDelegate.show(collectionId);
+ }
+
+ @Override
+ public void onWallpapersReady() {
+
+ }
+
+ @Nullable
+ @Override
+ public CategoryFragment getCategoryFragment() {
+ return null;
+ }
+
+ @Override
+ public void doneFetchingCategories() {
+
+ }
+}
diff --git a/src/com/android/theme/picker/ThemePickerActivity.java b/src/com/android/theme/picker/ThemePickerActivity.java
deleted file mode 100644
index 7817d99..0000000
--- a/src/com/android/theme/picker/ThemePickerActivity.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.android.theme.picker;
-
-import com.android.wallpaper.picker.BaseActivity;
-
-//TODO(santie): implement
-public class ThemePickerActivity extends BaseActivity {
-}