Update Muzei to 2.4.0 (24016)

This commit is contained in:
relan 2018-01-15 10:50:31 +03:00
parent 9a88538b74
commit fcf128c434
2 changed files with 780 additions and 4 deletions

View file

@ -52,15 +52,22 @@ Build:2.3.1,23124
gradle=prod
rm=wearable,example-watchface
Build:2.4.0,24016
commit=v2.4.0-rc2
subdir=main
patch=2.4.0-remove-play-services.patch
gradle=yes
rm=wearable,example-watchface
Maintainer Notes:
Custom version format, so no UCM applies.
Since 2.0, source code needs to be patched to get rid of Google Play Services.
The wearable and example-watchface components should be removed completely, the
rest of the code has be cleaned up from FirebaseAnalytics.
The "wearable" and "example-watchface" components should be removed
completely, the rest of the code has to be cleaned up from FirebaseAnalytics.
.
Auto Update Mode:None
Update Check Mode:None
Current Version:2.3.1
Current Version Code:23124
Current Version:2.4.0
Current Version Code:24016

View file

@ -0,0 +1,769 @@
diff --git a/android-client-common/build.gradle b/android-client-common/build.gradle
index d0c4761..73f45a9 100644
--- a/android-client-common/build.gradle
+++ b/android-client-common/build.gradle
@@ -25,9 +25,6 @@ dependencies {
implementation "com.android.support:support-fragment:$rootProject.ext.supportLibraryVersion"
api "android.arch.persistence.room:runtime:$rootProject.ext.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.ext.roomVersion"
- api ("com.google.android.gms:play-services-wearable:$rootProject.ext.googlePlayServicesVersion") {
- exclude module: 'support-v4'
- }
}
android {
diff --git a/android-client-common/src/main/java/com/google/android/apps/muzei/wearable/ArtworkTransfer.java b/android-client-common/src/main/java/com/google/android/apps/muzei/wearable/ArtworkTransfer.java
deleted file mode 100644
index ec281b1..0000000
--- a/android-client-common/src/main/java/com/google/android/apps/muzei/wearable/ArtworkTransfer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * 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.google.android.apps.muzei.wearable;
-
-import android.net.Uri;
-import android.os.Bundle;
-import android.text.TextUtils;
-
-import com.google.android.apps.muzei.room.Artwork;
-import com.google.android.gms.wearable.DataMap;
-
-/**
- * Helper class for transferring {@link Artwork} over to Wearable devices
- */
-public class ArtworkTransfer {
- private static final String KEY_IMAGE_URI = "imageUri";
- private static final String KEY_TITLE = "title";
- private static final String KEY_BYLINE = "byline";
- private static final String KEY_ATTRIBUTION = "attribution";
- private static final String KEY_TOKEN = "token";
-
- /**
- * Serializes this artwork object to a {@link DataMap} representation.
- *
- * @return a serialized version of the artwork.
- * @see #fromDataMap
- */
- public static DataMap toDataMap(Artwork artwork) {
- Bundle bundle = new Bundle();
- bundle.putString(KEY_IMAGE_URI, (artwork.imageUri != null) ? artwork.imageUri.toString() : null);
- bundle.putString(KEY_TITLE, artwork.title);
- bundle.putString(KEY_BYLINE, artwork.byline);
- bundle.putString(KEY_ATTRIBUTION, artwork.attribution);
- bundle.putString(KEY_TOKEN, artwork.token);
- return DataMap.fromBundle(bundle);
- }
-
- /**
- * Deserializes an artwork object from a {@link DataMap}.
- *
- * @param dataMap DataMap generated by {@link #toDataMap} to deserialize.
- * @return the artwork from the given {@link DataMap}
- */
- public static Artwork fromDataMap(DataMap dataMap) {
- Bundle bundle = dataMap.toBundle();
- Artwork artwork = new Artwork();
- String imageUri = bundle.getString(KEY_IMAGE_URI);
- if (!TextUtils.isEmpty(imageUri)) {
- artwork.imageUri = Uri.parse(imageUri);
- }
- artwork.title = bundle.getString(KEY_TITLE);
- artwork.byline = bundle.getString(KEY_BYLINE);
- artwork.attribution = bundle.getString(KEY_ATTRIBUTION);
- artwork.token = bundle.getString(KEY_TOKEN);
- return artwork;
- }
-
- private ArtworkTransfer() {
- }
-}
diff --git a/build.gradle b/build.gradle
index 006c6bc..928ed08 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,15 +18,9 @@ buildscript {
repositories {
jcenter()
google()
- maven {
- url 'https://maven.fabric.io/public'
- }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
- classpath 'com.google.gms:google-services:3.1.0'
- classpath 'io.fabric.tools:gradle:1.24.4'
- classpath 'com.google.firebase:firebase-plugins:1.1.1'
}
}
diff --git a/main/build.gradle b/main/build.gradle
index 60a2cbd..551dc78 100644
--- a/main/build.gradle
+++ b/main/build.gradle
@@ -15,8 +15,6 @@
*/
apply plugin: 'com.android.application'
-apply plugin: 'com.google.firebase.firebase-perf'
-apply plugin: 'io.fabric'
project.archivesBaseName = "muzei"
@@ -89,10 +87,6 @@ android {
dependencies {
implementation "com.squareup.okhttp3:okhttp:$rootProject.ext.okhttpVersion"
implementation "com.squareup.picasso:picasso:$rootProject.ext.picassoVersion"
- implementation "com.google.android.gms:play-services-wearable:$rootProject.ext.googlePlayServicesVersion"
- implementation "com.google.firebase:firebase-core:$rootProject.ext.googlePlayServicesVersion"
- implementation "com.google.firebase:firebase-perf:$rootProject.ext.googlePlayServicesVersion"
- implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.ext.crashlyticsVersion"
implementation "com.twofortyfouram:android-plugin-api-for-locale:1.0.2"
implementation "org.greenrobot:eventbus:3.0.0"
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
@@ -108,5 +102,3 @@ dependencies {
implementation project(':source-featured-art')
implementation project(':source-gallery')
}
-
-apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
diff --git a/main/src/main/java/com/google/android/apps/muzei/ArtDetailFragment.java b/main/src/main/java/com/google/android/apps/muzei/ArtDetailFragment.java
index 638b7d3..79b12da 100644
--- a/main/src/main/java/com/google/android/apps/muzei/ArtDetailFragment.java
+++ b/main/src/main/java/com/google/android/apps/muzei/ArtDetailFragment.java
@@ -58,7 +58,6 @@ import com.google.android.apps.muzei.util.AnimatedMuzeiLoadingSpinnerView;
import com.google.android.apps.muzei.util.PanScaleProxyView;
import com.google.android.apps.muzei.util.ScrimUtil;
import com.google.android.apps.muzei.widget.AppWidgetUpdateTask;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -266,7 +265,6 @@ public class ArtDetailFragment extends Fragment {
switch (menuItem.getItemId()) {
case R.id.action_about:
- FirebaseAnalytics.getInstance(context).logEvent("about_open", null);
startActivity(new Intent(context, AboutActivity.class));
return true;
}
diff --git a/main/src/main/java/com/google/android/apps/muzei/IntroFragment.java b/main/src/main/java/com/google/android/apps/muzei/IntroFragment.java
index d3fd494..0e9e16a 100644
--- a/main/src/main/java/com/google/android/apps/muzei/IntroFragment.java
+++ b/main/src/main/java/com/google/android/apps/muzei/IntroFragment.java
@@ -30,7 +30,6 @@ import android.view.ViewGroup;
import android.widget.Toast;
import com.google.android.apps.muzei.util.AnimatedMuzeiLogoFragment;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -43,10 +42,6 @@ public class IntroFragment extends Fragment {
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- if (savedInstanceState == null) {
- FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.TUTORIAL_BEGIN, null);
- }
}
@Override
@@ -61,7 +56,6 @@ public class IntroFragment extends Fragment {
mActivateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- FirebaseAnalytics.getInstance(getContext()).logEvent("activate", null);
try {
startActivity(new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
diff --git a/main/src/main/java/com/google/android/apps/muzei/MainFragment.java b/main/src/main/java/com/google/android/apps/muzei/MainFragment.java
index 33a3116..8529951 100644
--- a/main/src/main/java/com/google/android/apps/muzei/MainFragment.java
+++ b/main/src/main/java/com/google/android/apps/muzei/MainFragment.java
@@ -38,7 +38,6 @@ import android.view.ViewGroup;
import com.google.android.apps.muzei.settings.EffectsFragment;
import com.google.android.apps.muzei.settings.ChooseSourceFragment;
import com.google.android.apps.muzei.util.ScrimUtil;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -86,9 +85,6 @@ public class MainFragment extends Fragment implements FragmentManager.OnBackStac
// Set up the container for the child fragments
final View container = view.findViewById(R.id.container);
if (savedInstanceState == null) {
- FirebaseAnalytics.getInstance(getActivity())
- .setCurrentScreen(getActivity(), "ArtDetail",
- ArtDetailFragment.class.getSimpleName());
getChildFragmentManager().beginTransaction()
.replace(R.id.container, new ArtDetailFragment())
.commit();
@@ -106,18 +102,12 @@ public class MainFragment extends Fragment implements FragmentManager.OnBackStac
}
switch (item.getItemId()) {
case R.id.main_art_details:
- FirebaseAnalytics.getInstance(getContext())
- .setCurrentScreen(getActivity(), "ArtDetail",
- ArtDetailFragment.class.getSimpleName());
getChildFragmentManager().beginTransaction()
.replace(R.id.container, new ArtDetailFragment())
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.commit();
return true;
case R.id.main_choose_source:
- FirebaseAnalytics.getInstance(getContext())
- .setCurrentScreen(getActivity(), "ChooseSource",
- ChooseSourceFragment.class.getSimpleName());
getChildFragmentManager().popBackStack("main",
FragmentManager.POP_BACK_STACK_INCLUSIVE);
getChildFragmentManager().beginTransaction()
@@ -127,9 +117,6 @@ public class MainFragment extends Fragment implements FragmentManager.OnBackStac
.commit();
return true;
case R.id.main_effects:
- FirebaseAnalytics.getInstance(getContext())
- .setCurrentScreen(getActivity(), "Effects",
- EffectsFragment.class.getSimpleName());
getChildFragmentManager().popBackStack("main",
FragmentManager.POP_BACK_STACK_INCLUSIVE);
getChildFragmentManager().beginTransaction()
diff --git a/main/src/main/java/com/google/android/apps/muzei/MuzeiActivity.java b/main/src/main/java/com/google/android/apps/muzei/MuzeiActivity.java
index 828457c..c096346 100644
--- a/main/src/main/java/com/google/android/apps/muzei/MuzeiActivity.java
+++ b/main/src/main/java/com/google/android/apps/muzei/MuzeiActivity.java
@@ -25,7 +25,6 @@ import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.BuildConfig;
import net.nurik.roman.muzei.R;
@@ -42,7 +41,6 @@ public class MuzeiActivity extends AppCompatActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.muzei_activity);
- FirebaseAnalytics.getInstance(this).setUserProperty("device_type", BuildConfig.DEVICE_TYPE);
final View mContainerView = findViewById(R.id.container);
mContainerView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@@ -70,19 +68,13 @@ public class MuzeiActivity extends AppCompatActivity
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (sp.getBoolean(TutorialFragment.PREF_SEEN_TUTORIAL, false)) {
// The wallpaper is active and they've seen the tutorial
- FirebaseAnalytics.getInstance(this).setCurrentScreen(this, "Main",
- MainFragment.class.getSimpleName());
return new MainFragment();
} else {
// They need to see the tutorial after activating Muzei for the first time
- FirebaseAnalytics.getInstance(this).setCurrentScreen(this, "Tutorial",
- TutorialFragment.class.getSimpleName());
return new TutorialFragment();
}
} else {
// Show the intro fragment to have them activate Muzei
- FirebaseAnalytics.getInstance(this).setCurrentScreen(this, "Intro",
- IntroFragment.class.getSimpleName());
return new IntroFragment();
}
}
diff --git a/main/src/main/java/com/google/android/apps/muzei/MuzeiWallpaperService.java b/main/src/main/java/com/google/android/apps/muzei/MuzeiWallpaperService.java
index ac397fb..7f45812 100644
--- a/main/src/main/java/com/google/android/apps/muzei/MuzeiWallpaperService.java
+++ b/main/src/main/java/com/google/android/apps/muzei/MuzeiWallpaperService.java
@@ -55,7 +55,6 @@ import com.google.android.apps.muzei.shortcuts.ArtworkInfoShortcutController;
import com.google.android.apps.muzei.wallpaper.LockscreenObserver;
import com.google.android.apps.muzei.wallpaper.NetworkChangeObserver;
import com.google.android.apps.muzei.wallpaper.WallpaperAnalytics;
-import com.google.android.apps.muzei.wearable.WearableController;
import com.google.android.apps.muzei.widget.WidgetUpdater;
import net.rbgrn.android.glwallpaperservice.GLWallpaperService;
@@ -84,7 +83,6 @@ public class MuzeiWallpaperService extends GLWallpaperService implements Lifecyc
mLifecycle.addObserver(new SourceManager(this));
mLifecycle.addObserver(new NetworkChangeObserver(this));
mLifecycle.addObserver(new NotificationUpdater(this));
- mLifecycle.addObserver(new WearableController(this));
mLifecycle.addObserver(new WidgetUpdater(this));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
mLifecycle.addObserver(new ArtworkInfoShortcutController(this, this));
diff --git a/main/src/main/java/com/google/android/apps/muzei/PhotoSetAsTargetActivity.java b/main/src/main/java/com/google/android/apps/muzei/PhotoSetAsTargetActivity.java
index 202d12b..036a277 100644
--- a/main/src/main/java/com/google/android/apps/muzei/PhotoSetAsTargetActivity.java
+++ b/main/src/main/java/com/google/android/apps/muzei/PhotoSetAsTargetActivity.java
@@ -31,7 +31,6 @@ import android.widget.Toast;
import com.google.android.apps.muzei.gallery.ChosenPhoto;
import com.google.android.apps.muzei.gallery.GalleryArtSource;
import com.google.android.apps.muzei.gallery.GalleryDatabase;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -64,11 +63,6 @@ public class PhotoSetAsTargetActivity extends Activity {
}
// If adding the artwork succeeded, select the gallery source and publish the new image
- Bundle bundle = new Bundle();
- bundle.putString(FirebaseAnalytics.Param.ITEM_ID,
- new ComponentName(context, GalleryArtSource.class).flattenToShortString());
- bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "sources");
- FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
SourceManager.selectSource(context, new ComponentName(context, GalleryArtSource.class),
new SourceManager.Callback() {
@Override
diff --git a/main/src/main/java/com/google/android/apps/muzei/SourceManager.java b/main/src/main/java/com/google/android/apps/muzei/SourceManager.java
index edc7d75..4d48bcc 100644
--- a/main/src/main/java/com/google/android/apps/muzei/SourceManager.java
+++ b/main/src/main/java/com/google/android/apps/muzei/SourceManager.java
@@ -37,7 +37,6 @@ import com.google.android.apps.muzei.featuredart.FeaturedArtSource;
import com.google.android.apps.muzei.room.MuzeiDatabase;
import com.google.android.apps.muzei.room.Source;
import com.google.android.apps.muzei.sync.TaskQueueService;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.BuildConfig;
import net.nurik.roman.muzei.R;
@@ -176,15 +175,11 @@ public class SourceManager implements LifecycleObserver {
if (packageName.length() > MAX_VALUE_LENGTH) {
packageName = packageName.substring(packageName.length() - MAX_VALUE_LENGTH);
}
- FirebaseAnalytics.getInstance(context).setUserProperty(USER_PROPERTY_SELECTED_SOURCE_PACKAGE,
- packageName);
String className = selectedSource.flattenToShortString();
className = className.substring(className.indexOf('/')+1);
if (className.length() > MAX_VALUE_LENGTH) {
className = className.substring(className.length() - MAX_VALUE_LENGTH);
}
- FirebaseAnalytics.getInstance(context).setUserProperty(USER_PROPERTY_SELECTED_SOURCE,
- className);
}
public static void sendAction(final Context context, final int id) {
diff --git a/main/src/main/java/com/google/android/apps/muzei/TutorialFragment.java b/main/src/main/java/com/google/android/apps/muzei/TutorialFragment.java
index a236497..15c827f 100644
--- a/main/src/main/java/com/google/android/apps/muzei/TutorialFragment.java
+++ b/main/src/main/java/com/google/android/apps/muzei/TutorialFragment.java
@@ -36,8 +36,6 @@ import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.ImageView;
-import com.google.firebase.analytics.FirebaseAnalytics;
-
import net.nurik.roman.muzei.R;
public class TutorialFragment extends Fragment {
@@ -59,8 +57,6 @@ public class TutorialFragment extends Fragment {
new View.OnClickListener() {
@Override
public void onClick(View view) {
- FirebaseAnalytics.getInstance(getContext())
- .logEvent(FirebaseAnalytics.Event.TUTORIAL_COMPLETE, null);
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
sp.edit().putBoolean(PREF_SEEN_TUTORIAL, true).apply();
}
diff --git a/main/src/main/java/com/google/android/apps/muzei/quicksettings/NextArtworkTileService.java b/main/src/main/java/com/google/android/apps/muzei/quicksettings/NextArtworkTileService.java
index f9dbe09..8b05fd0 100644
--- a/main/src/main/java/com/google/android/apps/muzei/quicksettings/NextArtworkTileService.java
+++ b/main/src/main/java/com/google/android/apps/muzei/quicksettings/NextArtworkTileService.java
@@ -40,7 +40,6 @@ import com.google.android.apps.muzei.api.MuzeiArtSource;
import com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent;
import com.google.android.apps.muzei.room.MuzeiDatabase;
import com.google.android.apps.muzei.room.Source;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -73,7 +72,6 @@ public class NextArtworkTileService extends TileService implements LifecycleOwne
@Override
public void onTileAdded() {
- FirebaseAnalytics.getInstance(this).logEvent("tile_next_artwork_added", null);
}
@Override
@@ -141,8 +139,6 @@ public class NextArtworkTileService extends TileService implements LifecycleOwne
return;
}
if (tile.getState() == Tile.STATE_ACTIVE) {
- FirebaseAnalytics.getInstance(NextArtworkTileService.this).logEvent(
- "tile_next_artwork_click", null);
// Active means we send the 'Next Artwork' command
SourceManager.sendAction(this, MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK);
} else {
@@ -150,8 +146,6 @@ public class NextArtworkTileService extends TileService implements LifecycleOwne
unlockAndRun(new Runnable() {
@Override
public void run() {
- FirebaseAnalytics.getInstance(NextArtworkTileService.this).logEvent(
- "tile_next_artwork_activate", null);
try {
startActivityAndCollapse(new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
@@ -180,7 +174,6 @@ public class NextArtworkTileService extends TileService implements LifecycleOwne
@Override
public void onTileRemoved() {
- FirebaseAnalytics.getInstance(this).logEvent("tile_next_artwork_removed", null);
}
@Override
diff --git a/main/src/main/java/com/google/android/apps/muzei/settings/ChooseSourceFragment.java b/main/src/main/java/com/google/android/apps/muzei/settings/ChooseSourceFragment.java
index 6bd2dc5..07ad04a 100644
--- a/main/src/main/java/com/google/android/apps/muzei/settings/ChooseSourceFragment.java
+++ b/main/src/main/java/com/google/android/apps/muzei/settings/ChooseSourceFragment.java
@@ -69,7 +69,6 @@ import com.google.android.apps.muzei.notifications.NotificationSettingsDialogFra
import com.google.android.apps.muzei.room.MuzeiDatabase;
import com.google.android.apps.muzei.util.ObservableHorizontalScrollView;
import com.google.android.apps.muzei.util.Scrollbar;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -141,10 +140,6 @@ public class ChooseSourceFragment extends Fragment {
public void onAttach(Context context) {
super.onAttach(context);
- Bundle bundle = new Bundle();
- bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "sources");
- FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.VIEW_ITEM_LIST, bundle);
-
mCurrentSourceLiveData = MuzeiDatabase.getInstance(context).sourceDao().getCurrentSource();
mCurrentSourceLiveData.observe(this,
new Observer<com.google.android.apps.muzei.room.Source>() {
@@ -157,7 +152,6 @@ public class ChooseSourceFragment extends Fragment {
Intent intent = ((Activity) context).getIntent();
if (intent != null && intent.getCategories() != null &&
intent.getCategories().contains(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)) {
- FirebaseAnalytics.getInstance(context).logEvent("notification_preferences_open", null);
NotificationSettingsDialogFragment.showSettings(this);
}
}
@@ -175,7 +169,6 @@ public class ChooseSourceFragment extends Fragment {
NotificationSettingsDialogFragment.showSettings(this);
return true;
case R.id.action_get_more_sources:
- FirebaseAnalytics.getInstance(getContext()).logEvent("more_sources_open", null);
try {
Intent playStoreIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/search?q=Muzei&c=apps"))
@@ -557,18 +550,9 @@ public class ChooseSourceFragment extends Fragment {
}
builder.show();
} else if (source.setupActivity != null) {
- Bundle bundle = new Bundle();
- bundle.putString(FirebaseAnalytics.Param.ITEM_ID, source.componentName.flattenToShortString());
- bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, source.label);
- bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "sources");
- FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle);
mCurrentInitialSetupSource = source.componentName;
launchSourceSetup(source);
} else {
- Bundle bundle = new Bundle();
- bundle.putString(FirebaseAnalytics.Param.ITEM_ID, source.componentName.flattenToShortString());
- bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "sources");
- FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
SourceManager.selectSource(getContext(), source.componentName);
}
}
@@ -652,10 +636,6 @@ public class ChooseSourceFragment extends Fragment {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_EXTENSION_SETUP) {
if (resultCode == Activity.RESULT_OK && mCurrentInitialSetupSource != null) {
- Bundle bundle = new Bundle();
- bundle.putString(FirebaseAnalytics.Param.ITEM_ID, mCurrentInitialSetupSource.flattenToShortString());
- bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "sources");
- FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
SourceManager.selectSource(getContext(), mCurrentInitialSetupSource);
}
diff --git a/main/src/main/java/com/google/android/apps/muzei/settings/SettingsActivity.java b/main/src/main/java/com/google/android/apps/muzei/settings/SettingsActivity.java
index b3b77f6..fb3eeab 100644
--- a/main/src/main/java/com/google/android/apps/muzei/settings/SettingsActivity.java
+++ b/main/src/main/java/com/google/android/apps/muzei/settings/SettingsActivity.java
@@ -33,7 +33,6 @@ import android.widget.TextView;
import com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent;
import com.google.android.apps.muzei.render.MuzeiRendererFragment;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.R;
@@ -164,9 +163,6 @@ public class SettingsActivity extends AppCompatActivity
try {
Fragment newFragment = fragmentClass.newInstance();
- FirebaseAnalytics.getInstance(SettingsActivity.this)
- .setCurrentScreen(SettingsActivity.this, SECTION_SCREEN_NAME[position],
- fragmentClass.getSimpleName());
getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.setTransitionStyle(R.style.Muzei_SimpleFadeFragmentAnimation)
diff --git a/main/src/main/java/com/google/android/apps/muzei/wallpaper/WallpaperAnalytics.java b/main/src/main/java/com/google/android/apps/muzei/wallpaper/WallpaperAnalytics.java
index 6cfa4f9..7491f2c 100644
--- a/main/src/main/java/com/google/android/apps/muzei/wallpaper/WallpaperAnalytics.java
+++ b/main/src/main/java/com/google/android/apps/muzei/wallpaper/WallpaperAnalytics.java
@@ -22,7 +22,6 @@ import android.arch.lifecycle.OnLifecycleEvent;
import android.content.Context;
import com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent;
-import com.google.firebase.analytics.FirebaseAnalytics;
import net.nurik.roman.muzei.BuildConfig;
@@ -40,18 +39,15 @@ public class WallpaperAnalytics implements LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
public void registerDeviceType() {
- FirebaseAnalytics.getInstance(mContext).setUserProperty("device_type", BuildConfig.DEVICE_TYPE);
}
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
public void triggerWallpaperCreated() {
- FirebaseAnalytics.getInstance(mContext).logEvent("wallpaper_created", null);
EventBus.getDefault().postSticky(new WallpaperActiveStateChangedEvent(true));
}
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
public void triggerWallpaperDestroyed() {
- FirebaseAnalytics.getInstance(mContext).logEvent("wallpaper_destroyed", null);
EventBus.getDefault().postSticky(new WallpaperActiveStateChangedEvent(false));
}
}
diff --git a/main/src/main/java/com/google/android/apps/muzei/wearable/NotificationOpenListenerService.java b/main/src/main/java/com/google/android/apps/muzei/wearable/NotificationOpenListenerService.java
deleted file mode 100644
index aa55e66..0000000
--- a/main/src/main/java/com/google/android/apps/muzei/wearable/NotificationOpenListenerService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * 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.google.android.apps.muzei.wearable;
-
-import android.content.Intent;
-import android.content.pm.PackageManager;
-
-import com.google.android.gms.wearable.MessageEvent;
-import com.google.android.gms.wearable.WearableListenerService;
-
-public class NotificationOpenListenerService extends WearableListenerService {
- @Override
- public void onMessageReceived(MessageEvent messageEvent) {
- // Only notification/open actions trigger this WearableListenerService
- PackageManager packageManager = getPackageManager();
- Intent mainIntent = packageManager.getLaunchIntentForPackage(getPackageName());
- startActivity(mainIntent);
- }
-}
diff --git a/main/src/main/java/com/google/android/apps/muzei/wearable/WearableController.java b/main/src/main/java/com/google/android/apps/muzei/wearable/WearableController.java
deleted file mode 100644
index e113ed2..0000000
--- a/main/src/main/java/com/google/android/apps/muzei/wearable/WearableController.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * 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.google.android.apps.muzei.wearable;
-
-import android.arch.lifecycle.Lifecycle;
-import android.arch.lifecycle.LifecycleObserver;
-import android.arch.lifecycle.OnLifecycleEvent;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.ContentObserver;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Matrix;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.support.media.ExifInterface;
-import android.util.Log;
-
-import com.google.android.apps.muzei.api.MuzeiContract;
-import com.google.android.apps.muzei.render.ImageUtil;
-import com.google.android.apps.muzei.room.Artwork;
-import com.google.android.apps.muzei.room.MuzeiDatabase;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.common.api.AvailabilityException;
-import com.google.android.gms.tasks.Tasks;
-import com.google.android.gms.wearable.Asset;
-import com.google.android.gms.wearable.DataClient;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.Wearable;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-/**
- * Controller for updating Android Wear devices with new wallpapers.
- */
-public class WearableController implements LifecycleObserver {
- private static final String TAG = "WearableController";
-
- private final Context mContext;
- private HandlerThread mWearableHandlerThread;
- private ContentObserver mWearableContentObserver;
-
- public WearableController(Context context) {
- mContext = context;
- }
-
- @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
- public void registerContentObserver() {
- // Set up a thread to update Android Wear whenever the artwork changes
- mWearableHandlerThread = new HandlerThread("MuzeiWallpaperService-Wearable");
- mWearableHandlerThread.start();
- mWearableContentObserver = new ContentObserver(new Handler(mWearableHandlerThread.getLooper())) {
- @Override
- public void onChange(final boolean selfChange, final Uri uri) {
- updateArtwork();
- }
- };
- mContext.getContentResolver().registerContentObserver(MuzeiContract.Artwork.CONTENT_URI,
- true, mWearableContentObserver);
- }
-
- @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
- public void unregisterContentObserver() {
- mContext.getContentResolver().unregisterContentObserver(mWearableContentObserver);
- mWearableHandlerThread.quitSafely();
- }
-
- private void updateArtwork() {
- if (ConnectionResult.SUCCESS != GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext)) {
- return;
- }
- DataClient dataClient = Wearable.getDataClient(mContext);
- try {
- Tasks.await(GoogleApiAvailability.getInstance()
- .checkApiAvailability(dataClient), 5, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- if (e.getCause() instanceof AvailabilityException) {
- ConnectionResult connectionResult = ((AvailabilityException) e.getCause())
- .getConnectionResult(dataClient);
- if (connectionResult.getErrorCode() != ConnectionResult.API_UNAVAILABLE) {
- Log.w(TAG, "onConnectionFailed: " + connectionResult, e.getCause());
- }
- } else {
- Log.w(TAG, "Unable to check for Wear API availability", e);
- }
- return;
- } catch (InterruptedException|TimeoutException e) {
- Log.w(TAG, "Unable to check for Wear API availability", e);
- return;
- }
- ContentResolver contentResolver = mContext.getContentResolver();
- Bitmap image = null;
- try {
- BitmapFactory.Options options = new BitmapFactory.Options();
- options.inJustDecodeBounds = true;
- BitmapFactory.decodeStream(contentResolver.openInputStream(
- MuzeiContract.Artwork.CONTENT_URI), null, options);
- options.inJustDecodeBounds = false;
- if (options.outWidth > options.outHeight) {
- options.inSampleSize = ImageUtil.calculateSampleSize(options.outHeight, 320);
- } else {
- options.inSampleSize = ImageUtil.calculateSampleSize(options.outWidth, 320);
- }
- image = BitmapFactory.decodeStream(contentResolver.openInputStream(
- MuzeiContract.Artwork.CONTENT_URI), null, options);
- } catch (FileNotFoundException e) {
- Log.e(TAG, "Unable to read artwork to update Android Wear", e);
- }
- if (image != null) {
- int rotation = getRotation();
- if (rotation != 0) {
- // Rotate the image so that Wear always gets a right side up image
- Matrix matrix = new Matrix();
- matrix.postRotate(rotation);
- image = Bitmap.createBitmap(image, 0, 0, image.getWidth(), image.getHeight(),
- matrix, true);
- }
- final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- image.compress(Bitmap.CompressFormat.PNG, 100, byteStream);
- Asset asset = Asset.createFromBytes(byteStream.toByteArray());
- PutDataMapRequest dataMapRequest = PutDataMapRequest.create("/artwork");
- Artwork artwork = MuzeiDatabase.getInstance(mContext).artworkDao().getCurrentArtworkBlocking();
- dataMapRequest.getDataMap().putDataMap("artwork", ArtworkTransfer.toDataMap(artwork));
- dataMapRequest.getDataMap().putAsset("image", asset);
- try {
- Tasks.await(dataClient.putDataItem(dataMapRequest.asPutDataRequest().setUrgent()));
- } catch (ExecutionException|InterruptedException e) {
- Log.w(TAG, "Error uploading artwork to Wear", e);
- }
- }
- }
-
- private int getRotation() {
- ContentResolver contentResolver = mContext.getContentResolver();
- int rotation = 0;
- try (InputStream in = contentResolver.openInputStream(
- MuzeiContract.Artwork.CONTENT_URI)) {
- if (in == null) {
- return 0;
- }
- ExifInterface exifInterface = new ExifInterface(in);
- int orientation = exifInterface.getAttributeInt(
- ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
- switch (orientation) {
- case ExifInterface.ORIENTATION_ROTATE_90: rotation = 90; break;
- case ExifInterface.ORIENTATION_ROTATE_180: rotation = 180; break;
- case ExifInterface.ORIENTATION_ROTATE_270: rotation = 270; break;
- }
- } catch (IOException|NumberFormatException|StackOverflowError ignored) {
- }
- return rotation;
- }
-}