Bug 1385464 - Build with Android support library 26.1.0. r?nalexander draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 06 May 2018 17:59:31 +0200
changeset 792150 b4abc06bab6c2a98ec281ada11877200d1e7d030
parent 792126 8495f7960c639daa86ae0d818073e9a6c5f660cc
push id109007
push usermozilla@buttercookie.de
push dateMon, 07 May 2018 18:30:50 +0000
reviewersnalexander
bugs1385464
milestone61.0a1
Bug 1385464 - Build with Android support library 26.1.0. r?nalexander We're not actively using LeanplumActionBarActivity, and since v26 of the Android support library no longer provides the ActionBarActivity class, we just drop it to get the build going. The replacement for AnimatorCompatHelper.clearInterpolator() is based on the framework sources, which did the same thing and just inlined the implementation originally used by the support library. MozReview-Commit-ID: 1XWK10FBB3B
build.gradle
mobile/android/app/src/main/res/layout/bookmark_add_folder.xml
mobile/android/app/src/main/res/layout/bookmark_edit_with_full_page.xml
mobile/android/app/src/main/res/layout/bookmark_folder_select.xml
mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/widget/DefaultItemAnimatorBase.java
mobile/android/thirdparty/com/leanplum/activities/LeanplumActionBarActivity.java
--- a/build.gradle
+++ b/build.gradle
@@ -46,17 +46,17 @@ buildscript {
         }
         // For in tree plugins.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
     }
 
     ext.kotlin_version = '1.2.41'
-    ext.support_library_version = '23.4.0'
+    ext.support_library_version = '26.1.0'
 
     if (gradle.mozconfig.substs.MOZ_ANDROID_GOOGLE_PLAY_SERVICES) {
         ext.google_play_services_version = '8.4.0'
     }
 
     dependencies {
         classpath 'com.android.tools.build:gradle:3.0.1'
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
--- a/mobile/android/app/src/main/res/layout/bookmark_add_folder.xml
+++ b/mobile/android/app/src/main/res/layout/bookmark_add_folder.xml
@@ -13,17 +13,17 @@
     android:background="@android:color/white">
 
     <android.support.v7.widget.Toolbar
         android:id="@+id/toolbar"
         android:layout_width="match_parent"
         android:layout_height="?actionBarSize"
         android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
         android:background="@color/text_and_tabs_tray_grey"
-        app:navigationIcon="@drawable/abc_ic_clear_mtrl_alpha"
+        app:navigationIcon="@drawable/abc_ic_clear_material"
         app:subtitleTextColor="@android:color/white"
         app:title="@string/bookmark_add_folder"
         app:titleTextColor="@android:color/white" />
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="1"
--- a/mobile/android/app/src/main/res/layout/bookmark_edit_with_full_page.xml
+++ b/mobile/android/app/src/main/res/layout/bookmark_edit_with_full_page.xml
@@ -13,17 +13,17 @@
 
     <android.support.v7.widget.Toolbar
         android:id="@+id/toolbar"
         android:layout_width="match_parent"
         android:layout_height="56dp"
         android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
         android:background="@color/text_and_tabs_tray_grey"
         android:minHeight="?actionBarSize"
-        app:navigationIcon="@drawable/abc_ic_clear_mtrl_alpha"
+        app:navigationIcon="@drawable/abc_ic_clear_material"
         app:subtitleTextColor="@android:color/white"
         app:titleTextColor="@android:color/white" />
 
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
         <LinearLayout
--- a/mobile/android/app/src/main/res/layout/bookmark_folder_select.xml
+++ b/mobile/android/app/src/main/res/layout/bookmark_folder_select.xml
@@ -12,17 +12,17 @@
     android:background="@android:color/white">
 
     <android.support.v7.widget.Toolbar
         android:id="@+id/toolbar"
         android:layout_width="match_parent"
         android:layout_height="?actionBarSize"
         android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
         android:background="@color/text_and_tabs_tray_grey"
-        app:navigationIcon="@drawable/abc_ic_ab_back_mtrl_am_alpha"
+        app:navigationIcon="@drawable/abc_ic_ab_back_material"
         app:subtitleTextColor="@android:color/white"
         app:title="@string/bookmark_select_folder" />
 
     <android.support.v7.widget.RecyclerView
         android:id="@+id/folder_recycler_view"
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="1"
--- a/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java
@@ -98,9 +98,19 @@ public class GeckoCustomTabsService exte
     }
 
     @Override
     protected Bundle extraCommand(String commandName, Bundle bundle) {
         Log.v(LOGTAG, "extraCommand()");
 
         return null;
     }
+
+    @Override
+    protected boolean requestPostMessageChannel(CustomTabsSessionToken sessionToken, Uri postMessageOrigin) {
+        return false;
+    }
+
+    @Override
+    protected int postMessage(CustomTabsSessionToken sessionToken, String message, Bundle extras) {
+        return RESULT_FAILURE_DISALLOWED;
+    }
 }
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -226,17 +226,17 @@ public class GeckoPreferences
         }
     }
 
     private void updateHomeAsUpIndicator() {
         final ActionBar actionBar = getSupportActionBar();
         if (actionBar == null) {
             return;
         }
-        actionBar.setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_mtrl_am_alpha);
+        actionBar.setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_material);
     }
 
     /**
      * We only call this method for pre-HC versions of Android.
      */
     private void updateTitleForPrefsResource(int res) {
         // At present we only need to do this for non-leaf prefs views
         // and the locale switcher itself.
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DefaultItemAnimatorBase.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DefaultItemAnimatorBase.java
@@ -1,17 +1,18 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.widget;
 
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
 import android.support.annotation.NonNull;
-import android.support.v4.animation.AnimatorCompatHelper;
 import android.support.v4.view.ViewCompat;
 import android.support.v4.view.ViewPropertyAnimatorCompat;
 import android.support.v4.view.ViewPropertyAnimatorListener;
 import android.support.v7.widget.RecyclerView;
 import android.support.v7.widget.SimpleItemAnimator;
 import android.view.View;
 
 import java.util.ArrayList;
@@ -36,16 +37,18 @@ import java.util.List;
  *       values before resetting the current animation, so this class does not provide the reset
  *       service itself.</li>
  *   <li>{@link #resetViewProperties(View)} is used to reset a view any time an animation ends or
  *       gets canceled - you should redefine resetViewProperties if the version here doesn't reset
  *       all of the properties you're animating.</li>
  * </ul>
  */
 public class DefaultItemAnimatorBase extends SimpleItemAnimator {
+    private static TimeInterpolator defaultInterpolator;
+
     private List<RecyclerView.ViewHolder> pendingRemovals = new ArrayList<>();
     private List<RecyclerView.ViewHolder> pendingAdditions = new ArrayList<>();
     private List<MoveInfo> pendingMoves = new ArrayList<>();
     private List<ChangeInfo> pendingChanges = new ArrayList<>();
 
     private List<List<RecyclerView.ViewHolder>> additionsList = new ArrayList<>();
     private List<List<MoveInfo>> movesList = new ArrayList<>();
     private List<List<ChangeInfo>> changesList = new ArrayList<>();
@@ -476,17 +479,20 @@ public class DefaultItemAnimatorBase ext
                     additionsList.remove(i);
                 }
             }
         }
         dispatchFinishedWhenDone();
     }
 
     protected void resetAnimation(RecyclerView.ViewHolder holder) {
-        AnimatorCompatHelper.clearInterpolator(holder.itemView);
+        if (defaultInterpolator == null) {
+            defaultInterpolator = new ValueAnimator().getInterpolator();
+        }
+        holder.itemView.animate().setInterpolator(defaultInterpolator);
         endAnimation(holder);
     }
 
     @Override
     public boolean isRunning() {
         return (!pendingAdditions.isEmpty() ||
                 !pendingChanges.isEmpty() ||
                 !pendingMoves.isEmpty() ||
deleted file mode 100644
--- a/mobile/android/thirdparty/com/leanplum/activities/LeanplumActionBarActivity.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2013, Leanplum, Inc. All rights reserved.
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.leanplum.activities;
-
-import android.annotation.SuppressLint;
-import android.content.res.Resources;
-import android.support.v7.app.ActionBarActivity;
-
-import com.leanplum.Leanplum;
-import com.leanplum.LeanplumActivityHelper;
-
-@SuppressLint("Registered")
-@SuppressWarnings("deprecation")
-public class LeanplumActionBarActivity extends ActionBarActivity {
-  private LeanplumActivityHelper helper;
-
-  private LeanplumActivityHelper getHelper() {
-    if (helper == null) {
-      helper = new LeanplumActivityHelper(this);
-    }
-    return helper;
-  }
-
-  @Override
-  protected void onPause() {
-    super.onPause();
-    getHelper().onPause();
-  }
-
-  @Override
-  protected void onStop() {
-    super.onStop();
-    getHelper().onStop();
-  }
-
-  @Override
-  protected void onResume() {
-    super.onResume();
-    getHelper().onResume();
-  }
-
-  @Override
-  public Resources getResources() {
-    if (Leanplum.isTestModeEnabled() || !Leanplum.isResourceSyncingEnabled()) {
-      return super.getResources();
-    }
-    return getHelper().getLeanplumResources(super.getResources());
-  }
-
-  @Override
-  public void setContentView(final int layoutResID) {
-    if (Leanplum.isTestModeEnabled() || !Leanplum.isResourceSyncingEnabled()) {
-      super.setContentView(layoutResID);
-      return;
-    }
-    getHelper().setContentView(layoutResID);
-  }
-}