jenkins-bot has submitted this change and it was merged. Change subject: Upgrade appcompat-v7 to 22.2.0 ......................................................................
Upgrade appcompat-v7 to 22.2.0 * Upgrade appcompat-v7 to 22.2.0 * Replace deprecated ActionBarActivity with AppCompatActivity * Very light refactoring of PageActivity Bug: T98108 Change-Id: I31c782d075838724309de53d81c1ad2b4032a3ef --- M wikipedia/build.gradle M wikipedia/res/layout/activity_page.xml M wikipedia/res/values/styles.xml M wikipedia/src/main/java/org/wikipedia/ThemedActionBarActivity.java M wikipedia/src/main/java/org/wikipedia/editing/CaptchaHandler.java M wikipedia/src/main/java/org/wikipedia/history/HistoryFragment.java M wikipedia/src/main/java/org/wikipedia/page/PageActivity.java M wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java M wikipedia/src/main/java/org/wikipedia/page/ToCHandler.java M wikipedia/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java 10 files changed, 41 insertions(+), 34 deletions(-) Approvals: BearND: Looks good to me, approved jenkins-bot: Verified diff --git a/wikipedia/build.gradle b/wikipedia/build.gradle index b43b63c..266fd0f 100644 --- a/wikipedia/build.gradle +++ b/wikipedia/build.gradle @@ -15,7 +15,7 @@ android { compileSdkVersion 22 - buildToolsVersion '22.0.0' + buildToolsVersion '22.0.1' defaultConfig { applicationId 'org.wikipedia' minSdkVersion 10 @@ -97,7 +97,7 @@ // use http://gradleplease.appspot.com/ or http://search.maven.org/. // Debug with ./gradlew -q wikipedia:dependencies --configuration compile - compile 'com.android.support:appcompat-v7:21.0.3' // includes support-v4 + compile 'com.android.support:appcompat-v7:22.2.0' // includes support-v4 compile('org.mediawiki.api:json:1.3.1') { exclude group: 'org.json', module: 'json' } diff --git a/wikipedia/res/layout/activity_page.xml b/wikipedia/res/layout/activity_page.xml index 5f8d4f5..17776aa 100644 --- a/wikipedia/res/layout/activity_page.xml +++ b/wikipedia/res/layout/activity_page.xml @@ -43,8 +43,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar - xmlns:app="http://schemas.android.com/apk/res-auto" - app:theme="@style/AppTheme.ToolbarTheme" + android:theme="@style/AppTheme.ToolbarTheme" android:id="@+id/main_toolbar" android:background="@color/main_toolbar_background" android:layout_width="match_parent" diff --git a/wikipedia/res/values/styles.xml b/wikipedia/res/values/styles.xml index c9fd6ad..fdf29b0 100644 --- a/wikipedia/res/values/styles.xml +++ b/wikipedia/res/values/styles.xml @@ -4,6 +4,7 @@ <style name="NoTitle" parent="AppTheme"> <item name="windowActionBar">false</item> + <item name="windowNoTitle">true</item> </style> <style name="AppTheme.ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar"> diff --git a/wikipedia/src/main/java/org/wikipedia/ThemedActionBarActivity.java b/wikipedia/src/main/java/org/wikipedia/ThemedActionBarActivity.java index 86d0144..a344b54 100644 --- a/wikipedia/src/main/java/org/wikipedia/ThemedActionBarActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/ThemedActionBarActivity.java @@ -3,7 +3,7 @@ import android.app.Activity; import android.os.Build; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.view.KeyEvent; import android.view.ViewConfiguration; @@ -11,8 +11,7 @@ import java.lang.reflect.Field; -public abstract class ThemedActionBarActivity extends ActionBarActivity { - +public abstract class ThemedActionBarActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/wikipedia/src/main/java/org/wikipedia/editing/CaptchaHandler.java b/wikipedia/src/main/java/org/wikipedia/editing/CaptchaHandler.java index 7023041..6e2abda 100644 --- a/wikipedia/src/main/java/org/wikipedia/editing/CaptchaHandler.java +++ b/wikipedia/src/main/java/org/wikipedia/editing/CaptchaHandler.java @@ -5,7 +5,7 @@ import android.graphics.ColorMatrixColorFilter; import android.net.Uri; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; @@ -108,7 +108,7 @@ .into(captchaImage, new Callback() { @Override public void onSuccess() { - ((ActionBarActivity)activity).getSupportActionBar().setTitle(R.string.title_captcha); + ((AppCompatActivity)activity).getSupportActionBar().setTitle(R.string.title_captcha); if (progressDialog.isShowing()) { progressDialog.hide(); } @@ -143,7 +143,7 @@ } public void hideCaptcha() { - ((ActionBarActivity)activity).getSupportActionBar().setTitle(prevTitle); + ((AppCompatActivity)activity).getSupportActionBar().setTitle(prevTitle); ViewAnimations.crossFade(captchaContainer, primaryView); } diff --git a/wikipedia/src/main/java/org/wikipedia/history/HistoryFragment.java b/wikipedia/src/main/java/org/wikipedia/history/HistoryFragment.java index 757ec7b..1b70aca 100644 --- a/wikipedia/src/main/java/org/wikipedia/history/HistoryFragment.java +++ b/wikipedia/src/main/java/org/wikipedia/history/HistoryFragment.java @@ -11,7 +11,7 @@ import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.CursorAdapter; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.view.ActionMode; import android.text.Editable; import android.text.TextWatcher; @@ -124,7 +124,7 @@ return false; } historyEntryList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); - actionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(new ActionMode.Callback() { + actionMode = ((AppCompatActivity)getActivity()).startSupportActionMode(new ActionMode.Callback() { private final String actionModeTag = "actionModeHistory"; @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { @@ -364,7 +364,7 @@ builder.create().show(); return true; default: - throw new RuntimeException("Unknown menu item clicked!"); + throw new RuntimeException("Unknown menu item clicked! item=" + item); } } } diff --git a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java index 0a94a77..4dd368f 100644 --- a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java @@ -24,6 +24,7 @@ import org.wikipedia.staticdata.MainPageNameData; import org.wikipedia.theme.ThemeChooserDialog; import org.wikipedia.util.ApiUtil; +import org.wikipedia.util.log.L; import org.wikipedia.views.WikiDrawerLayout; import org.wikipedia.zero.ZeroMessage; @@ -145,12 +146,12 @@ toolbarContainer = findViewById(R.id.main_toolbar_container); - bus = app.getBus(); busMethods = new EventBusMethods(); - bus.register(busMethods); + registerBus(); drawerLayout = (WikiDrawerLayout) findViewById(R.id.drawer_layout); - fragmentNavdrawer = (NavDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navdrawer); + fragmentNavdrawer = (NavDrawerFragment) getSupportFragmentManager().findFragmentById( + R.id.navdrawer); searchFragment = (SearchArticlesFragment) getSupportFragmentManager().findFragmentById(R.id.search_fragment); searchHintText = (TextView) findViewById(R.id.main_search_bar_text); @@ -175,7 +176,8 @@ // Set the drawer toggle as the DrawerListener drawerLayout.setDrawerListener(mDrawerToggle); - drawerLayout.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); + drawerLayout.setDragEdgeWidth( + getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); getSupportActionBar().setTitle(""); searchBarHideHandler = new SearchBarHideHandler(this, toolbarContainer); @@ -755,9 +757,7 @@ protected void onStart() { super.onStart(); if (bus == null) { - bus = app.getBus(); - bus.register(busMethods); - Log.d("Wikipedia", "Registering bus"); + registerBus(); } } @@ -797,9 +797,7 @@ @Override public void onActivityResult(int requestCode, int resultCode, final Intent data) { if (bus == null) { - bus = app.getBus(); - bus.register(busMethods); - Log.d("Wikipedia", "Registering bus"); + registerBus(); } if ((requestCode == ACTIVITY_REQUEST_LANGLINKS && resultCode == LangLinksActivity.ACTIVITY_RESULT_LANGLINK_SELECT)) { fragmentContainerView.post(new Runnable() { @@ -828,9 +826,7 @@ app.getSessionFunnel().persistSession(); super.onStop(); - bus.unregister(busMethods); - bus = null; - Log.d("Wikipedia", "Deregistering bus"); + unregisterBus(); } /** @@ -870,4 +866,16 @@ private String emptyIfNull(String value) { return value == null ? "" : value; } + + private void registerBus() { + bus = app.getBus(); + bus.register(busMethods); + L.d("Registered bus."); + } + + private void unregisterBus() { + bus.unregister(busMethods); + bus = null; + L.d("Unregistered bus."); + } } diff --git a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java index 692439f..c6e4661 100755 --- a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java +++ b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragmentInternal.java @@ -44,7 +44,7 @@ import android.support.v4.app.Fragment; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.view.ActionMode; import android.text.Html; import android.util.Log; @@ -339,7 +339,7 @@ @Override public void onResume() { super.onResume(); - ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(""); + ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(""); } /** diff --git a/wikipedia/src/main/java/org/wikipedia/page/ToCHandler.java b/wikipedia/src/main/java/org/wikipedia/page/ToCHandler.java index 6aea805..9a3c348 100755 --- a/wikipedia/src/main/java/org/wikipedia/page/ToCHandler.java +++ b/wikipedia/src/main/java/org/wikipedia/page/ToCHandler.java @@ -14,7 +14,7 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.text.Html; import android.util.Log; import android.view.Gravity; @@ -39,7 +39,7 @@ private final CommunicationBridge bridge; private final WikiDrawerLayout slidingPane; private final TextView headerView; - private final ActionBarActivity parentActivity; + private final AppCompatActivity parentActivity; private ToCInteractionFunnel funnel; /** @@ -50,7 +50,7 @@ private boolean wasClicked = false; private boolean openedViaSwipe = true; - public ToCHandler(final ActionBarActivity activity, final WikiDrawerLayout slidingPane, + public ToCHandler(final AppCompatActivity activity, final WikiDrawerLayout slidingPane, final CommunicationBridge bridge) { this.parentActivity = activity; this.bridge = bridge; diff --git a/wikipedia/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java b/wikipedia/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java index df493eb..b28bbd5 100644 --- a/wikipedia/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java +++ b/wikipedia/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java @@ -11,7 +11,7 @@ import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.CursorAdapter; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.view.ActionMode; import android.text.Editable; import android.text.TextWatcher; @@ -83,7 +83,7 @@ return false; } savedPagesList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); - actionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(new ActionMode.Callback() { + actionMode = ((AppCompatActivity)getActivity()).startSupportActionMode(new ActionMode.Callback() { private final String actionModeTag = "actionModeSavedPages"; @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { @@ -332,7 +332,7 @@ promptToDeleteAll(); return true; default: - throw new RuntimeException("Unknown menu item clicked!"); + throw new RuntimeException("Unknown menu item clicked! item=" + item); } } -- To view, visit https://gerrit.wikimedia.org/r/210122 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I31c782d075838724309de53d81c1ad2b4032a3ef Gerrit-PatchSet: 7 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org> Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits