Cooltey has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/381494 )
Change subject: Remove compatibility code for API 19 and bump minSdkVersion
......................................................................
Remove compatibility code for API 19 and bump minSdkVersion
In this update:
- Remove < API 19 code, includes TargetAPI() and RequireAPI()
- Remove redundent casting
- Update build.gradle
Bug:T175994
Change-Id: I022373f4f0479b621bddc2113c73ce92db23cc89
---
M app/build.gradle
M app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
M app/src/androidTest/java/org/wikipedia/test/view/ViewTest.java
M app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
M app/src/androidTest/java/org/wikipedia/views/AppTextViewWithImagesTest.java
M app/src/main/AndroidManifest.xml
M
app/src/main/java/com/facebook/samples/gestures/MultiPointerGestureDetector.java
M app/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java
M
app/src/main/java/com/facebook/samples/zoomable/AbstractAnimatedZoomableController.java
M app/src/main/java/org/wikipedia/WikipediaApp.java
M app/src/main/java/org/wikipedia/activity/BaseActivity.java
M app/src/main/java/org/wikipedia/captcha/CaptchaHandler.java
M app/src/main/java/org/wikipedia/dataclient/okhttp/OkHttpWebViewClient.java
M app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
M app/src/main/java/org/wikipedia/edit/preview/EditPreviewFragment.java
M app/src/main/java/org/wikipedia/edit/summaries/EditSummaryFragment.java
M app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
M app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.java
M app/src/main/java/org/wikipedia/gallery/GalleryThumbnailScrollView.java
M app/src/main/java/org/wikipedia/history/SearchActionModeCallback.java
M app/src/main/java/org/wikipedia/language/LangLinksActivity.java
M app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
M app/src/main/java/org/wikipedia/page/FindInPageActionProvider.java
M app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
M app/src/main/java/org/wikipedia/page/NoDimBottomSheetDialog.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/page/PageInfoDialog.java
M app/src/main/java/org/wikipedia/page/ReferenceDialog.java
M app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
M app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.java
M app/src/main/java/org/wikipedia/page/shareafact/ShareHandler.java
M app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
M app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
M app/src/main/java/org/wikipedia/search/RecentSearchesFragment.java
M app/src/main/java/org/wikipedia/search/SearchFragment.java
M app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
M app/src/main/java/org/wikipedia/settings/AboutActivity.java
M app/src/main/java/org/wikipedia/settings/LanguagePreferenceDialog.java
M app/src/main/java/org/wikipedia/settings/LicenseActivity.java
M app/src/main/java/org/wikipedia/util/ConfigurationCompat.java
M app/src/main/java/org/wikipedia/util/DeviceUtil.java
M app/src/main/java/org/wikipedia/util/FeedbackUtil.java
M app/src/main/java/org/wikipedia/util/FileUtil.java
M app/src/main/java/org/wikipedia/util/L10nUtil.java
M app/src/main/java/org/wikipedia/views/CabSearchView.java
M app/src/main/java/org/wikipedia/views/TextInputDialog.java
M app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
M app/src/main/res/values/styles.xml
M app/src/test/java/okhttp3/internal/cache/CacheDelegateInterceptorTest.java
51 files changed, 131 insertions(+), 188 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/94/381494/1
diff --git a/app/build.gradle b/app/build.gradle
index 2c0c2ef..9a638c47 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -53,7 +53,7 @@
defaultConfig {
applicationId 'org.wikipedia'
- minSdkVersion 16
+ minSdkVersion 19
targetSdkVersion 26
versionCode 203
testApplicationId 'org.wikipedia.test'
diff --git
a/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
b/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
index ab7b4f3..d4c9499 100644
--- a/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
+++ b/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
@@ -1,6 +1,5 @@
package org.wikipedia.richtext;
-import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Spannable;
@@ -60,9 +59,7 @@
private void init(@Nullable CharSequence text, float leadingScalar) {
textView = new AppTextView(ctx());
textView.setText(spanned(text, leadingScalar));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- textView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
- }
+ textView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
}
private Spanned spanned(@Nullable CharSequence text, float leadingScalar) {
diff --git a/app/src/androidTest/java/org/wikipedia/test/view/ViewTest.java
b/app/src/androidTest/java/org/wikipedia/test/view/ViewTest.java
index 2302613..0c2c437 100644
--- a/app/src/androidTest/java/org/wikipedia/test/view/ViewTest.java
+++ b/app/src/androidTest/java/org/wikipedia/test/view/ViewTest.java
@@ -100,13 +100,11 @@
}
protected void snap(@NonNull View subject, @Nullable String... dataPoints)
{
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- int rtl = layoutDirection == LayoutDirection.RTL
- ? View.LAYOUT_DIRECTION_RTL
- : TextUtilsCompat.getLayoutDirectionFromLocale(locale);
- //noinspection WrongConstant
- subject.setLayoutDirection(rtl);
- }
+ int rtl = layoutDirection == LayoutDirection.RTL
+ ? View.LAYOUT_DIRECTION_RTL
+ : TextUtilsCompat.getLayoutDirectionFromLocale(locale);
+ //noinspection WrongConstant
+ subject.setLayoutDirection(rtl);
ViewHelpers viewHelpers =
ViewHelpers.setupView(subject).setExactWidthDp(widthDp);
if (heightDp != null) {
diff --git a/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
index 46a5568..0b8de8e 100644
--- a/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
+++ b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
@@ -1,6 +1,5 @@
package org.wikipedia.views;
-import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
@@ -52,8 +51,6 @@
private void init(@Nullable CharSequence text) {
subject = new AppTextView(ctx());
subject.setText(text);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- subject.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
- }
+ subject.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
}
}
diff --git
a/app/src/androidTest/java/org/wikipedia/views/AppTextViewWithImagesTest.java
b/app/src/androidTest/java/org/wikipedia/views/AppTextViewWithImagesTest.java
index 6aac42d..fa4cc60 100644
---
a/app/src/androidTest/java/org/wikipedia/views/AppTextViewWithImagesTest.java
+++
b/app/src/androidTest/java/org/wikipedia/views/AppTextViewWithImagesTest.java
@@ -1,7 +1,6 @@
package org.wikipedia.views;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
@@ -91,9 +90,7 @@
@NonNull FontScale fontScale, @NonNull
Theme theme) {
super.setUp(widthDp, layoutDirection, fontScale, theme);
subject = new AppTextViewWithImages(ctx());
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- subject.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
- }
+ subject.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
}
private void setUpTypical() {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4d49061..6df1160 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,7 +27,7 @@
android:maxSdkVersion="22" />
<!-- For Wikipedia Zero notifications:
http://stackoverflow.com/q/13602190/970346 -->
- <uses-permission android:name="android.permission.VIBRATE"
android:maxSdkVersion="18" />
+ <uses-permission android:name="android.permission.VIBRATE"/>
<!-- For being able to receive notifications upon boot -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"
/>
diff --git
a/app/src/main/java/com/facebook/samples/gestures/MultiPointerGestureDetector.java
b/app/src/main/java/com/facebook/samples/gestures/MultiPointerGestureDetector.java
index 97594ee..27c93ef 100644
---
a/app/src/main/java/com/facebook/samples/gestures/MultiPointerGestureDetector.java
+++
b/app/src/main/java/com/facebook/samples/gestures/MultiPointerGestureDetector.java
@@ -26,13 +26,13 @@
/** The listener for receiving notifications when gestures occur. */
public interface Listener {
/** A callback called right before the gesture is about to start. */
- public void onGestureBegin(MultiPointerGestureDetector detector);
+ void onGestureBegin(MultiPointerGestureDetector detector);
/** A callback called each time the gesture gets updated. */
- public void onGestureUpdate(MultiPointerGestureDetector detector);
+ void onGestureUpdate(MultiPointerGestureDetector detector);
/** A callback called right after the gesture has finished. */
- public void onGestureEnd(MultiPointerGestureDetector detector);
+ void onGestureEnd(MultiPointerGestureDetector detector);
}
private static final int MAX_POINTERS = 2;
diff --git
a/app/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java
b/app/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java
index 7cebf58..b28a059 100644
---
a/app/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java
+++
b/app/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java
@@ -26,13 +26,13 @@
/** The listener for receiving notifications when gestures occur. */
public interface Listener {
/** A callback called right before the gesture is about to start. */
- public void onGestureBegin(TransformGestureDetector detector);
+ void onGestureBegin(TransformGestureDetector detector);
/** A callback called each time the gesture gets updated. */
- public void onGestureUpdate(TransformGestureDetector detector);
+ void onGestureUpdate(TransformGestureDetector detector);
/** A callback called right after the gesture has finished. */
- public void onGestureEnd(TransformGestureDetector detector);
+ void onGestureEnd(TransformGestureDetector detector);
}
private final MultiPointerGestureDetector mDetector;
diff --git
a/app/src/main/java/com/facebook/samples/zoomable/AbstractAnimatedZoomableController.java
b/app/src/main/java/com/facebook/samples/zoomable/AbstractAnimatedZoomableController.java
index eef4d63..f953ff2 100644
---
a/app/src/main/java/com/facebook/samples/zoomable/AbstractAnimatedZoomableController.java
+++
b/app/src/main/java/com/facebook/samples/zoomable/AbstractAnimatedZoomableController.java
@@ -14,9 +14,6 @@
import android.graphics.Matrix;
import android.graphics.PointF;
import android.support.annotation.Nullable;
-import android.view.animation.DecelerateInterpolator;
-
-import com.facebook.common.internal.Preconditions;
import com.facebook.common.logging.FLog;
import com.facebook.samples.gestures.TransformGestureDetector;
diff --git a/app/src/main/java/org/wikipedia/WikipediaApp.java
b/app/src/main/java/org/wikipedia/WikipediaApp.java
index 6c3c080..4ac0a82 100644
--- a/app/src/main/java/org/wikipedia/WikipediaApp.java
+++ b/app/src/main/java/org/wikipedia/WikipediaApp.java
@@ -441,7 +441,7 @@
}
private void enableWebViewDebugging() {
- if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >=
Build.VERSION_CODES.KITKAT) {
+ if (BuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true);
}
}
diff --git a/app/src/main/java/org/wikipedia/activity/BaseActivity.java
b/app/src/main/java/org/wikipedia/activity/BaseActivity.java
index f399936..499b6cc 100644
--- a/app/src/main/java/org/wikipedia/activity/BaseActivity.java
+++ b/app/src/main/java/org/wikipedia/activity/BaseActivity.java
@@ -1,6 +1,5 @@
package org.wikipedia.activity;
-import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -42,7 +41,6 @@
import java.util.List;
public abstract class BaseActivity extends AppCompatActivity {
- private boolean destroyed;
private EventBusMethods busMethods;
private NetworkStateReceiver networkStateReceiver = new
NetworkStateReceiver();
@@ -71,7 +69,6 @@
WikipediaApp.getInstance().getBus().unregister(busMethods);
busMethods = null;
super.onDestroy();
- destroyed = true;
}
@Override protected void onResume() {
@@ -121,10 +118,7 @@
}
@Override public boolean isDestroyed() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return super.isDestroyed();
- }
- return destroyed;
+ return super.isDestroyed();
}
protected void setTheme() {
@@ -171,7 +165,6 @@
}
}
- @TargetApi(17)
private void searchOfflineCompilations(boolean force) {
if ((!DeviceUtil.isOnline() &&
OfflineManager.instance().shouldSearchAgain()) || force) {
OfflineManager.instance().searchForCompilations(new
OfflineManager.Callback() {
diff --git a/app/src/main/java/org/wikipedia/captcha/CaptchaHandler.java
b/app/src/main/java/org/wikipedia/captcha/CaptchaHandler.java
index 5587857..7553fb2 100644
--- a/app/src/main/java/org/wikipedia/captcha/CaptchaHandler.java
+++ b/app/src/main/java/org/wikipedia/captcha/CaptchaHandler.java
@@ -49,10 +49,10 @@
this.prevTitle = prevTitle;
captchaContainer = activity.findViewById(R.id.captcha_container);
- captchaImage = (SimpleDraweeView)
activity.findViewById(R.id.captcha_image);
+ captchaImage = activity.findViewById(R.id.captcha_image);
captchaText = ((TextInputLayout)
activity.findViewById(R.id.captcha_text)).getEditText();
captchaProgress = activity.findViewById(R.id.captcha_image_progress);
- TextView submitButton = (TextView)
activity.findViewById(R.id.captcha_submit_button);
+ TextView submitButton =
activity.findViewById(R.id.captcha_submit_button);
if (submitButtonText != null) {
submitButton.setText(submitButtonText);
diff --git
a/app/src/main/java/org/wikipedia/dataclient/okhttp/OkHttpWebViewClient.java
b/app/src/main/java/org/wikipedia/dataclient/okhttp/OkHttpWebViewClient.java
index 6949f73..ddff4e3 100644
--- a/app/src/main/java/org/wikipedia/dataclient/okhttp/OkHttpWebViewClient.java
+++ b/app/src/main/java/org/wikipedia/dataclient/okhttp/OkHttpWebViewClient.java
@@ -107,13 +107,9 @@
@NonNull private InputStream getInputStream(@NonNull Response rsp) throws
IOException {
InputStream inputStream = rsp.body().byteStream();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
- && CONTENT_TYPE_OGG.equals(rsp.header(HEADER_CONTENT_TYPE))) {
+ if (CONTENT_TYPE_OGG.equals(rsp.header(HEADER_CONTENT_TYPE))) {
inputStream = new AvailableInputStream(rsp.body().byteStream(),
rsp.body().contentLength());
- } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
- && CONTENT_TYPE_SVG.equals(rsp.header(HEADER_CONTENT_TYPE))) {
- return transformSvgFile(inputStream);
}
return inputStream;
diff --git a/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
b/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
index bfce9ea..b7b7368 100644
--- a/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
+++ b/app/src/main/java/org/wikipedia/edit/EditSectionActivity.java
@@ -148,19 +148,19 @@
supportActionBar.setTitle("");
}
- sectionText = (EditText) findViewById(R.id.edit_section_text);
+ sectionText = findViewById(R.id.edit_section_text);
syntaxHighlighter = new SyntaxHighlighter(this, sectionText);
sectionProgress = findViewById(R.id.edit_section_load_progress);
- sectionContainer = (ScrollView)
findViewById(R.id.edit_section_container);
+ sectionContainer = findViewById(R.id.edit_section_container);
sectionContainer.setSmoothScrollingEnabled(false);
- errorView = (WikiErrorView) findViewById(R.id.view_edit_section_error);
+ errorView = findViewById(R.id.view_edit_section_error);
abusefilterContainer =
findViewById(R.id.edit_section_abusefilter_container);
- abuseFilterImage = (ImageView)
findViewById(R.id.edit_section_abusefilter_image);
- abusefilterTitle = (TextView)
findViewById(R.id.edit_section_abusefilter_title);
- abusefilterText = (TextView)
findViewById(R.id.edit_section_abusefilter_text);
+ abuseFilterImage = findViewById(R.id.edit_section_abusefilter_image);
+ abusefilterTitle = findViewById(R.id.edit_section_abusefilter_title);
+ abusefilterText = findViewById(R.id.edit_section_abusefilter_text);
captchaHandler = new CaptchaHandler(this, title.getWikiSite(),
progressDialog, sectionContainer, "", null);
@@ -250,7 +250,7 @@
}
private void updateEditLicenseText() {
- TextView editLicenseText = (TextView)
findViewById(R.id.edit_section_license_text);
+ TextView editLicenseText =
findViewById(R.id.edit_section_license_text);
editLicenseText.setText(StringUtil.fromHtml(String.format(getString(AccountUtil.isLoggedIn()
? R.string.edit_save_action_license_logged_in
: R.string.edit_save_action_license_anon),
@@ -563,7 +563,7 @@
LinearLayout.LayoutParams params = new
LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
- TextView txtView = (TextView)
v.findViewById(R.id.edit_actionbar_button_text);
+ TextView txtView = v.findViewById(R.id.edit_actionbar_button_text);
txtView.setText(item.getTitle());
txtView.setTypeface(null, item.isEnabled() ? Typeface.BOLD :
Typeface.NORMAL);
v.setTag(item);
diff --git
a/app/src/main/java/org/wikipedia/edit/preview/EditPreviewFragment.java
b/app/src/main/java/org/wikipedia/edit/preview/EditPreviewFragment.java
index 384daee..084b094 100644
--- a/app/src/main/java/org/wikipedia/edit/preview/EditPreviewFragment.java
+++ b/app/src/main/java/org/wikipedia/edit/preview/EditPreviewFragment.java
@@ -65,9 +65,9 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View parent = inflater.inflate(R.layout.fragment_preview_edit,
container, false);
- webview = (ObservableWebView)
parent.findViewById(R.id.edit_preview_webview);
- previewContainer = (ScrollView)
parent.findViewById(R.id.edit_preview_container);
- editSummaryTagsContainer = (ViewGroup)
parent.findViewById(R.id.edit_summary_tags_container);
+ webview = parent.findViewById(R.id.edit_preview_webview);
+ previewContainer = parent.findViewById(R.id.edit_preview_container);
+ editSummaryTagsContainer =
parent.findViewById(R.id.edit_summary_tags_container);
bridge = new CommunicationBridge(webview,
"file:///android_asset/preview.html");
diff --git
a/app/src/main/java/org/wikipedia/edit/summaries/EditSummaryFragment.java
b/app/src/main/java/org/wikipedia/edit/summaries/EditSummaryFragment.java
index 6df478c..b6e2708 100644
--- a/app/src/main/java/org/wikipedia/edit/summaries/EditSummaryFragment.java
+++ b/app/src/main/java/org/wikipedia/edit/summaries/EditSummaryFragment.java
@@ -28,7 +28,7 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
editSummaryContainer =
inflater.inflate(R.layout.fragment_preview_summary, container, false);
- summaryText = (AutoCompleteTextView)
editSummaryContainer.findViewById(R.id.edit_summary_edit);
+ summaryText =
editSummaryContainer.findViewById(R.id.edit_summary_edit);
// Explicitly enable standard dictionary autocompletion in the edit
summary box
// We should be able to do this in the XML, but doing it there doesn't
work. Thanks Android!
diff --git a/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
b/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
index 923fab0..074656d 100644
--- a/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
+++ b/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
@@ -174,24 +174,24 @@
setContentView(R.layout.activity_gallery);
initToolbar();
- toolbarContainer = (ViewGroup)
findViewById(R.id.gallery_toolbar_container);
- infoContainer = (ViewGroup) findViewById(R.id.gallery_info_container);
+ toolbarContainer = findViewById(R.id.gallery_toolbar_container);
+ infoContainer = findViewById(R.id.gallery_info_container);
setBackgroundGradient(infoContainer, Gravity.BOTTOM);
- progressBar = (ProgressBar) findViewById(R.id.gallery_progressbar);
+ progressBar = findViewById(R.id.gallery_progressbar);
- descriptionText = (TextView)
findViewById(R.id.gallery_description_text);
+ descriptionText = findViewById(R.id.gallery_description_text);
descriptionText.setShadowLayer(2, 1, 1, color(R.color.black54));
descriptionText.setMovementMethod(linkMovementMethod);
- licenseIcon = (ImageView) findViewById(R.id.gallery_license_icon);
+ licenseIcon = findViewById(R.id.gallery_license_icon);
licenseIcon.setOnClickListener(licenseShortClickListener);
licenseIcon.setOnLongClickListener(licenseLongClickListener);
- creditText = (TextView) findViewById(R.id.gallery_credit_text);
+ creditText = findViewById(R.id.gallery_credit_text);
creditText.setShadowLayer(2, 1, 1, color(R.color.black54));
- errorView = (WikiErrorView) findViewById(R.id.view_gallery_error);
+ errorView = findViewById(R.id.view_gallery_error);
((ImageView) errorView.findViewById(R.id.view_wiki_error_icon))
.setColorFilter(color(R.color.base70));
((TextView) errorView.findViewById(R.id.view_wiki_error_text))
@@ -218,7 +218,7 @@
galleryCache = new HashMap<>();
galleryAdapter = new GalleryItemAdapter(this);
- galleryPager = (ViewPager) findViewById(R.id.gallery_item_pager);
+ galleryPager = findViewById(R.id.gallery_item_pager);
galleryPager.setAdapter(galleryAdapter);
pageChangeListener = new GalleryPageChangeListener();
galleryPager.addOnPageChangeListener(pageChangeListener);
@@ -633,7 +633,7 @@
}
private void initToolbar() {
- final Toolbar toolbar = (Toolbar) findViewById(R.id.gallery_toolbar);
+ final Toolbar toolbar = findViewById(R.id.gallery_toolbar);
setBackgroundGradient(toolbar, Gravity.TOP);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
diff --git a/app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.java
b/app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.java
index fcabd29..3c5c028 100644
--- a/app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.java
+++ b/app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.java
@@ -113,12 +113,12 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_gallery_item,
container, false);
- progressBar = (ProgressBar)
rootView.findViewById(R.id.gallery_item_progress_bar);
+ progressBar = rootView.findViewById(R.id.gallery_item_progress_bar);
videoContainer = rootView.findViewById(R.id.gallery_video_container);
- videoView = (VideoView) rootView.findViewById(R.id.gallery_video);
- videoThumbnail = (SimpleDraweeView)
rootView.findViewById(R.id.gallery_video_thumbnail);
+ videoView = rootView.findViewById(R.id.gallery_video);
+ videoThumbnail = rootView.findViewById(R.id.gallery_video_thumbnail);
videoPlayButton =
rootView.findViewById(R.id.gallery_video_play_button);
- imageView = (ZoomableDraweeViewWithBackground)
rootView.findViewById(R.id.gallery_image);
+ imageView = rootView.findViewById(R.id.gallery_image);
imageView.setTapListener(new DoubleTapGestureListener(imageView) {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
diff --git
a/app/src/main/java/org/wikipedia/gallery/GalleryThumbnailScrollView.java
b/app/src/main/java/org/wikipedia/gallery/GalleryThumbnailScrollView.java
index fb6c4cd..96350be 100644
--- a/app/src/main/java/org/wikipedia/gallery/GalleryThumbnailScrollView.java
+++ b/app/src/main/java/org/wikipedia/gallery/GalleryThumbnailScrollView.java
@@ -57,7 +57,7 @@
GalleryItemHolder(View itemView) {
super(itemView);
- mImageView = (SimpleDraweeView)
itemView.findViewById(R.id.gallery_thumbnail_image);
+ mImageView = itemView.findViewById(R.id.gallery_thumbnail_image);
}
public void bindItem(GalleryItem item) {
diff --git
a/app/src/main/java/org/wikipedia/history/SearchActionModeCallback.java
b/app/src/main/java/org/wikipedia/history/SearchActionModeCallback.java
index da886ec..f77ad63 100644
--- a/app/src/main/java/org/wikipedia/history/SearchActionModeCallback.java
+++ b/app/src/main/java/org/wikipedia/history/SearchActionModeCallback.java
@@ -26,7 +26,7 @@
mode.setTag(ACTION_MODE_TAG);
mode.getMenuInflater().inflate(R.menu.menu_action_mode_search, menu);
searchView = (SearchView)
MenuItemCompat.getActionView(menu.findItem(R.id.menu_search_view));
- searchMagIcon = (ImageView)
searchView.findViewById(android.support.v7.appcompat.R.id.search_mag_icon);
+ searchMagIcon =
searchView.findViewById(android.support.v7.appcompat.R.id.search_mag_icon);
searchMagIcon.setImageDrawable(null);
searchView.setIconifiedByDefault(false);
searchView.setQueryHint(getSearchHintString());
diff --git a/app/src/main/java/org/wikipedia/language/LangLinksActivity.java
b/app/src/main/java/org/wikipedia/language/LangLinksActivity.java
index adb89f5..d37ba3d 100644
--- a/app/src/main/java/org/wikipedia/language/LangLinksActivity.java
+++ b/app/src/main/java/org/wikipedia/language/LangLinksActivity.java
@@ -71,13 +71,13 @@
throw new RuntimeException("Only ACTION_LANGLINKS_FOR_TITLE is
supported");
}
- langLinksList = (ListView) findViewById(R.id.langlinks_list);
+ langLinksList = findViewById(R.id.langlinks_list);
langLinksProgress = findViewById(R.id.langlinks_load_progress);
langLinksContainer = findViewById(R.id.langlinks_list_container);
langLinksEmpty = findViewById(R.id.langlinks_empty);
langLinksNoMatch = findViewById(R.id.langlinks_no_match);
- langLinksError = (WikiErrorView) findViewById(R.id.langlinks_error);
- EditText langLinksFilter = (EditText)
findViewById(R.id.langlinks_filter);
+ langLinksError = findViewById(R.id.langlinks_error);
+ EditText langLinksFilter = findViewById(R.id.langlinks_filter);
title = getIntent().getParcelableExtra(EXTRA_PAGETITLE);
@@ -266,8 +266,8 @@
String languageCode = item.getWikiSite().languageCode();
String localizedLanguageName =
app.getAppLanguageLocalizedName(languageCode);
- TextView localizedLanguageNameTextView = (TextView)
convertView.findViewById(R.id.localized_language_name);
- TextView articleTitleTextView = (TextView)
convertView.findViewById(R.id.language_subtitle);
+ TextView localizedLanguageNameTextView =
convertView.findViewById(R.id.localized_language_name);
+ TextView articleTitleTextView =
convertView.findViewById(R.id.language_subtitle);
localizedLanguageNameTextView.setText(localizedLanguageName);
articleTitleTextView.setText(item.getDisplayText());
diff --git a/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
b/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
index 69b2870..8c23a7c 100644
--- a/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
+++ b/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
@@ -122,8 +122,8 @@
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_page_list_entry,
parent, false);
holder = new ViewHolder();
- holder.icon = (SimpleDraweeView)
convertView.findViewById(R.id.page_list_item_image);
- holder.title = (TextView)
convertView.findViewById(R.id.page_list_item_title);
+ holder.icon = convertView.findViewById(R.id.page_list_item_image);
+ holder.title = convertView.findViewById(R.id.page_list_item_title);
holder.description = (GoneIfEmptyTextView)
convertView.findViewById(R.id.page_list_item_description);
convertView.setTag(holder);
} else {
diff --git a/app/src/main/java/org/wikipedia/page/FindInPageActionProvider.java
b/app/src/main/java/org/wikipedia/page/FindInPageActionProvider.java
index 2932874..015e429 100644
--- a/app/src/main/java/org/wikipedia/page/FindInPageActionProvider.java
+++ b/app/src/main/java/org/wikipedia/page/FindInPageActionProvider.java
@@ -62,9 +62,9 @@
}
});
- findInPageMatch = (TextView)
view.findViewById(R.id.find_in_page_match);
+ findInPageMatch = view.findViewById(R.id.find_in_page_match);
- SearchView searchView = (SearchView)
view.findViewById(R.id.find_in_page_input);
+ SearchView searchView = view.findViewById(R.id.find_in_page_input);
searchView.setQueryHint(fragment.getContext().getString(R.string.menu_page_find_in_page));
searchView.setFocusable(true);
searchView.requestFocusFromTouch();
diff --git a/app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
b/app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
index 3d83f9d..e9052e6 100644
--- a/app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
+++ b/app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
@@ -43,9 +43,9 @@
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_issue, parent, false);
holder = new ViewHolder();
- holder.icon = (ImageView)
convertView.findViewById(R.id.issue_icon);
- holder.text = (TextView) convertView.findViewById(R.id.issue_text);
- holder.subText = (TextView)
convertView.findViewById(R.id.issue_subtext);
+ holder.icon = convertView.findViewById(R.id.issue_icon);
+ holder.text = convertView.findViewById(R.id.issue_text);
+ holder.subText = convertView.findViewById(R.id.issue_subtext);
convertView.setTag(holder);
} else {
// view already defined, retrieve view holder
diff --git a/app/src/main/java/org/wikipedia/page/NoDimBottomSheetDialog.java
b/app/src/main/java/org/wikipedia/page/NoDimBottomSheetDialog.java
index a39f241..b2b9ed8 100644
--- a/app/src/main/java/org/wikipedia/page/NoDimBottomSheetDialog.java
+++ b/app/src/main/java/org/wikipedia/page/NoDimBottomSheetDialog.java
@@ -40,7 +40,7 @@
getWindow().getDecorView().post(new Runnable() {
@Override
public void run() {
- FrameLayout bottomSheet = (FrameLayout)
getWindow().getDecorView().findViewById(android.support.design.R.id.design_bottom_sheet);
+ FrameLayout bottomSheet =
getWindow().getDecorView().findViewById(android.support.design.R.id.design_bottom_sheet);
BottomSheetBehavior<?> behavior =
BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 24f2d46..90b2c64 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -395,7 +395,6 @@
* @param position Whether to open this page in the current tab, a new
background tab, or new
* foreground tab.
*/
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void loadPage(@NonNull final PageTitle title,
@NonNull final HistoryEntry entry,
@NonNull final TabPosition position) {
diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 9f49922..073059e 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -295,27 +295,26 @@
final Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_page, container,
false);
- webView = (ObservableWebView)
rootView.findViewById(R.id.page_web_view);
+ webView = rootView.findViewById(R.id.page_web_view);
initWebViewListeners();
- tocDrawer = (WikiDrawerLayout)
rootView.findViewById(R.id.page_toc_drawer);
+ tocDrawer = rootView.findViewById(R.id.page_toc_drawer);
tocDrawer.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin));
- refreshView = (SwipeRefreshLayoutWithScroll) rootView
- .findViewById(R.id.page_refresh_container);
+ refreshView = rootView.findViewById(R.id.page_refresh_container);
int swipeOffset = getContentTopOffsetPx(getActivity()) +
REFRESH_SPINNER_ADDITIONAL_OFFSET;
refreshView.setProgressViewOffset(false, -swipeOffset, swipeOffset);
refreshView.setColorSchemeResources(getThemedAttributeId(getContext(),
R.attr.colorAccent));
refreshView.setScrollableChild(webView);
refreshView.setOnRefreshListener(pageRefreshListener);
- tabLayout = (ConfigurableTabLayout)
rootView.findViewById(R.id.page_actions_tab_layout);
+ tabLayout = rootView.findViewById(R.id.page_actions_tab_layout);
tabLayout.addOnTabSelectedListener(pageActionTabListener);
PageActionToolbarHideHandler pageActionToolbarHideHandler = new
PageActionToolbarHideHandler(tabLayout);
pageActionToolbarHideHandler.setScrollView(webView);
- errorView = (WikiPageErrorView) rootView.findViewById(R.id.page_error);
+ errorView = rootView.findViewById(R.id.page_error);
return rootView;
}
diff --git a/app/src/main/java/org/wikipedia/page/PageInfoDialog.java
b/app/src/main/java/org/wikipedia/page/PageInfoDialog.java
index 55437ff..cf96d6c 100644
--- a/app/src/main/java/org/wikipedia/page/PageInfoDialog.java
+++ b/app/src/main/java/org/wikipedia/page/PageInfoDialog.java
@@ -30,11 +30,11 @@
View parentView =
LayoutInflater.from(fragment.getContext()).inflate(R.layout.dialog_page_info,
null);
setContentView(parentView);
- flipper = (ViewFlipper)
parentView.findViewById(R.id.page_info_flipper);
- disambigList = (ListView) parentView.findViewById(R.id.disambig_list);
- ListView issuesList = (ListView)
parentView.findViewById(R.id.page_issues_list);
- disambigHeading = (TextView)
parentView.findViewById(R.id.page_info_similar_titles_heading);
- issuesHeading = (TextView)
parentView.findViewById(R.id.page_info_page_issues_heading);
+ flipper = parentView.findViewById(R.id.page_info_flipper);
+ disambigList = parentView.findViewById(R.id.disambig_list);
+ ListView issuesList = parentView.findViewById(R.id.page_issues_list);
+ disambigHeading =
parentView.findViewById(R.id.page_info_similar_titles_heading);
+ issuesHeading =
parentView.findViewById(R.id.page_info_page_issues_heading);
View separatorHeading =
parentView.findViewById(R.id.page_info_heading_separator);
View closeButton = parentView.findViewById(R.id.page_info_close);
diff --git a/app/src/main/java/org/wikipedia/page/ReferenceDialog.java
b/app/src/main/java/org/wikipedia/page/ReferenceDialog.java
index c5f0262..a3eb8bd 100644
--- a/app/src/main/java/org/wikipedia/page/ReferenceDialog.java
+++ b/app/src/main/java/org/wikipedia/page/ReferenceDialog.java
@@ -20,11 +20,11 @@
View rootView =
LayoutInflater.from(context).inflate(R.layout.dialog_reference, null);
setContentView(rootView);
- TextView referenceText = (TextView)
rootView.findViewById(R.id.reference_text);
+ TextView referenceText = rootView.findViewById(R.id.reference_text);
referenceText.setText(StringUtil.fromHtml(html));
referenceText.setMovementMethod(new
LinkMovementMethodExt(linkHandler));
- TextView titleText = (TextView)
rootView.findViewById(R.id.reference_title_text);
+ TextView titleText = rootView.findViewById(R.id.reference_title_text);
titleText.setText(getContext().getString(R.string.reference_title,
linkText));
}
}
diff --git
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
index 0c8bc0e..5f79c6f 100644
---
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
+++
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
@@ -91,12 +91,12 @@
webview.addOnScrollChangeListener(this);
webview.addOnContentHeightChangedListener(this);
- pageLastUpdatedText = (TextView)
bottomContentContainer.findViewById(R.id.page_last_updated_text);
- pageLicenseText = (TextView)
bottomContentContainer.findViewById(R.id.page_license_text);
+ pageLastUpdatedText =
bottomContentContainer.findViewById(R.id.page_last_updated_text);
+ pageLicenseText =
bottomContentContainer.findViewById(R.id.page_license_text);
readMoreContainer =
bottomContentContainer.findViewById(R.id.read_more_container);
- readMoreList = (ConfigurableListView)
bottomContentContainer.findViewById(R.id.read_more_list);
+ readMoreList =
bottomContentContainer.findViewById(R.id.read_more_list);
- TextView pageExternalLink = (TextView)
bottomContentContainer.findViewById(R.id.page_external_link);
+ TextView pageExternalLink =
bottomContentContainer.findViewById(R.id.page_external_link);
pageExternalLink.setPaintFlags(pageExternalLink.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);
pageExternalLink.setOnClickListener(new View.OnClickListener() {
@Override
@@ -465,11 +465,11 @@
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_page_list_entry,
parent, false);
}
- TextView pageTitleText = (TextView)
convertView.findViewById(R.id.page_list_item_title);
+ TextView pageTitleText =
convertView.findViewById(R.id.page_list_item_title);
SearchResult result = getItem(position);
pageTitleText.setText(result.getPageTitle().getDisplayText());
- GoneIfEmptyTextView descriptionText = (GoneIfEmptyTextView)
convertView.findViewById(R.id.page_list_item_description);
+ GoneIfEmptyTextView descriptionText =
convertView.findViewById(R.id.page_list_item_description);
descriptionText.setText(StringUtils.capitalize(result.getPageTitle().getDescription()));
ViewUtil.loadImageUrlInto((SimpleDraweeView)
convertView.findViewById(R.id.page_list_item_image),
result.getPageTitle().getThumbUrl());
diff --git
a/app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.java
b/app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.java
index 6d0909e..5b456ce 100755
--- a/app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.java
+++ b/app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.java
@@ -100,30 +100,27 @@
location = getArguments().getParcelable("location");
View rootView = inflater.inflate(R.layout.dialog_link_preview,
container);
- dialogContainer = (LinearLayout)
rootView.findViewById(R.id.dialog_link_preview_container);
+ dialogContainer =
rootView.findViewById(R.id.dialog_link_preview_container);
contentContainer =
rootView.findViewById(R.id.dialog_link_preview_content_container);
- errorContainer = (LinkPreviewErrorView)
rootView.findViewById(R.id.dialog_link_preview_error_container);
- progressBar = (ProgressBar)
rootView.findViewById(R.id.link_preview_progress);
+ errorContainer =
rootView.findViewById(R.id.dialog_link_preview_error_container);
+ progressBar = rootView.findViewById(R.id.link_preview_progress);
toolbarView = rootView.findViewById(R.id.link_preview_toolbar);
toolbarView.setOnClickListener(goToPageListener);
- TextView titleText = (TextView)
rootView.findViewById(R.id.link_preview_title);
+ TextView titleText = rootView.findViewById(R.id.link_preview_title);
titleText.setText(pageTitle.getDisplayText());
setConditionalLayoutDirection(rootView,
pageTitle.getWikiSite().languageCode());
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
- // for oldish devices, reset line spacing to 1, since it truncates
the descenders.
- titleText.setLineSpacing(0, 1.0f);
- } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// for <5.0, give the title a bit more bottom padding, since these
versions
// incorrectly cut off the bottom of the text when line spacing is
<1.
final int bottomPadding = 8;
ViewUtil.setBottomPaddingDp(titleText, bottomPadding);
}
- extractText = (TextView)
rootView.findViewById(R.id.link_preview_extract);
- thumbnailView = (SimpleDraweeView)
rootView.findViewById(R.id.link_preview_thumbnail);
+ extractText = rootView.findViewById(R.id.link_preview_extract);
+ thumbnailView = rootView.findViewById(R.id.link_preview_thumbnail);
- thumbnailGallery = (GalleryThumbnailScrollView)
rootView.findViewById(R.id.link_preview_thumbnail_gallery);
+ thumbnailGallery =
rootView.findViewById(R.id.link_preview_thumbnail_gallery);
if (isImageDownloadEnabled()) {
CallbackTask.execute(new CallbackTask.Task<Map<String,
ImageInfo>>() {
@Override public Map<String, ImageInfo> execute() throws
Throwable {
@@ -179,7 +176,7 @@
@Override public void onResume() {
super.onResume();
if (overlayView == null) {
- ViewGroup containerView = (ViewGroup)
getDialog().findViewById(R.id.container);
+ ViewGroup containerView = getDialog().findViewById(R.id.container);
overlayView = new LinkPreviewOverlayView(getContext());
overlayView.setCallback(new OverlayViewCallback());
overlayView.setPrimaryButtonText(getStringForArticleLanguage(pageTitle,
R.string.button_continue_to_article));
diff --git a/app/src/main/java/org/wikipedia/page/shareafact/ShareHandler.java
b/app/src/main/java/org/wikipedia/page/shareafact/ShareHandler.java
index 3af5f57..d006948 100755
--- a/app/src/main/java/org/wikipedia/page/shareafact/ShareHandler.java
+++ b/app/src/main/java/org/wikipedia/page/shareafact/ShareHandler.java
@@ -282,7 +282,7 @@
super(context);
View rootView =
LayoutInflater.from(context).inflate(R.layout.dialog_share_preview, null);
setContentView(rootView);
- ImageView previewImage = (ImageView)
rootView.findViewById(R.id.preview_img);
+ ImageView previewImage = rootView.findViewById(R.id.preview_img);
previewImage.setImageBitmap(resultBitmap);
rootView.findViewById(R.id.close_button)
.setOnClickListener(new View.OnClickListener() {
diff --git a/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
b/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
index 508e3c4..3e5f7a6 100644
--- a/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
+++ b/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
@@ -434,8 +434,8 @@
convertView = inflater.inflate(R.layout.item_tab_entry,
parent, false);
convertView.setTag(viewHolder);
viewHolder.container = convertView;
- viewHolder.title = (TextView)
convertView.findViewById(R.id.tab_item_title);
- viewHolder.thumbnail = (SimpleDraweeView)
convertView.findViewById(R.id.tab_item_thumbnail);
+ viewHolder.title =
convertView.findViewById(R.id.tab_item_title);
+ viewHolder.thumbnail =
convertView.findViewById(R.id.tab_item_thumbnail);
viewHolder.gradient =
convertView.findViewById(R.id.tab_item_bottom_gradient);
viewHolder.closeButton =
convertView.findViewById(R.id.tab_item_close);
} else {
diff --git
a/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
b/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
index e85ad8a..b6f2767 100644
--- a/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
+++ b/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
@@ -114,7 +114,7 @@
onboardingButton = rootView.findViewById(R.id.onboarding_button);
checkAndShowOnboarding();
- RecyclerView readingListView = (RecyclerView)
rootView.findViewById(R.id.list_of_lists);
+ RecyclerView readingListView =
rootView.findViewById(R.id.list_of_lists);
readingListView.setLayoutManager(new
LinearLayoutManager(getActivity()));
readingListView.setAdapter(adapter);
diff --git
a/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
b/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
index aa49fc3..4b728ae 100644
--- a/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
+++ b/app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
@@ -555,7 +555,7 @@
.setNegativeButton(android.R.string.cancel, null)
.create();
dialog.show();
- TextView text = (TextView) dialog.findViewById(android.R.id.message);
+ TextView text = dialog.findViewById(android.R.id.message);
text.setLineSpacing(0, 1.3f);
}
diff --git a/app/src/main/java/org/wikipedia/search/RecentSearchesFragment.java
b/app/src/main/java/org/wikipedia/search/RecentSearchesFragment.java
index d053635..57324ad 100644
--- a/app/src/main/java/org/wikipedia/search/RecentSearchesFragment.java
+++ b/app/src/main/java/org/wikipedia/search/RecentSearchesFragment.java
@@ -148,7 +148,7 @@
@Override
public void bindView(View view, Context context, Cursor cursor) {
- TextView textView = (TextView) view.findViewById(R.id.text1);
+ TextView textView = view.findViewById(R.id.text1);
RecentSearch entry = getEntry(cursor);
textView.setText(entry.getText());
view.setTag(entry);
diff --git a/app/src/main/java/org/wikipedia/search/SearchFragment.java
b/app/src/main/java/org/wikipedia/search/SearchFragment.java
index b57c2cb..e959759 100644
--- a/app/src/main/java/org/wikipedia/search/SearchFragment.java
+++ b/app/src/main/java/org/wikipedia/search/SearchFragment.java
@@ -414,7 +414,7 @@
.findViewById(android.support.v7.appcompat.R.id.search_plate);
searchEditPlate.setBackgroundColor(Color.TRANSPARENT);
- ImageView searchClose = (ImageView) searchView.findViewById(
+ ImageView searchClose = searchView.findViewById(
android.support.v7.appcompat.R.id.search_close_btn);
FeedbackUtil.setToolbarButtonLongPressToast(searchClose);
}
diff --git a/app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
b/app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
index dcb9306..106fccf 100644
--- a/app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
+++ b/app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
@@ -486,10 +486,10 @@
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_search_result,
parent, false);
}
- TextView pageTitleText = (TextView)
convertView.findViewById(R.id.page_list_item_title);
+ TextView pageTitleText =
convertView.findViewById(R.id.page_list_item_title);
SearchResult result = (SearchResult) getItem(position);
- GoneIfEmptyTextView descriptionText = (GoneIfEmptyTextView)
convertView.findViewById(R.id.page_list_item_description);
+ GoneIfEmptyTextView descriptionText =
convertView.findViewById(R.id.page_list_item_description);
View redirectContainer =
convertView.findViewById(R.id.page_list_item_redirect_container);
if (TextUtils.isEmpty(result.getRedirectFrom())) {
redirectContainer.setVisibility(View.GONE);
@@ -497,7 +497,7 @@
} else {
redirectContainer.setVisibility(View.VISIBLE);
descriptionText.setVisibility(View.GONE);
- TextView redirectText = (TextView)
convertView.findViewById(R.id.page_list_item_redirect);
+ TextView redirectText =
convertView.findViewById(R.id.page_list_item_redirect);
redirectText.setText(String.format(getString(R.string.search_redirect_from),
result.getRedirectFrom()));
}
diff --git a/app/src/main/java/org/wikipedia/settings/AboutActivity.java
b/app/src/main/java/org/wikipedia/settings/AboutActivity.java
index 355e932..2b793a3 100644
--- a/app/src/main/java/org/wikipedia/settings/AboutActivity.java
+++ b/app/src/main/java/org/wikipedia/settings/AboutActivity.java
@@ -38,7 +38,7 @@
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
- mScrollView = (ScrollView) findViewById(R.id.about_scrollview);
+ mScrollView = findViewById(R.id.about_scrollview);
translatorsTextView.setText(StringUtil.fromHtml(getString(R.string.about_translators_translatewiki)));
RichTextUtil.removeUnderlinesFromLinks(translatorsTextView);
wmfTextView.setText(StringUtil.fromHtml(getString(R.string.about_wmf)));
diff --git
a/app/src/main/java/org/wikipedia/settings/LanguagePreferenceDialog.java
b/app/src/main/java/org/wikipedia/settings/LanguagePreferenceDialog.java
index 51b8f0b..8fd034a 100644
--- a/app/src/main/java/org/wikipedia/settings/LanguagePreferenceDialog.java
+++ b/app/src/main/java/org/wikipedia/settings/LanguagePreferenceDialog.java
@@ -51,13 +51,13 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- TextView textView = (TextView) findViewById(android.R.id.title);
+ TextView textView = findViewById(android.R.id.title);
if (textView != null) {
textView.setSingleLine(false);
}
- languagesList = (ListView)
findViewById(R.id.preference_languages_list);
- EditText languagesFilter = (EditText)
findViewById(R.id.preference_languages_filter);
+ languagesList = findViewById(R.id.preference_languages_list);
+ EditText languagesFilter =
findViewById(R.id.preference_languages_filter);
languagesList.setOnItemClickListener(new
AdapterView.OnItemClickListener() {
@Override
@@ -152,8 +152,8 @@
convertView =
LayoutInflater.from(parent.getContext()).inflate(R.layout.item_language_list_entry,
parent, false);
}
- TextView localizedNameTextView = (TextView)
convertView.findViewById(R.id.localized_language_name);
- TextView canonicalNameTextView = (TextView)
convertView.findViewById(R.id.language_subtitle);
+ TextView localizedNameTextView =
convertView.findViewById(R.id.localized_language_name);
+ TextView canonicalNameTextView =
convertView.findViewById(R.id.language_subtitle);
String languageCode = getItem(position);
diff --git a/app/src/main/java/org/wikipedia/settings/LicenseActivity.java
b/app/src/main/java/org/wikipedia/settings/LicenseActivity.java
index 5fe1337..04265c2 100644
--- a/app/src/main/java/org/wikipedia/settings/LicenseActivity.java
+++ b/app/src/main/java/org/wikipedia/settings/LicenseActivity.java
@@ -27,7 +27,7 @@
setTitle(getString(R.string.license_title,
path.substring(libraryNameStart)));
try {
- TextView textView = (TextView) findViewById(R.id.license_text);
+ TextView textView = findViewById(R.id.license_text);
final int assetPathStart = 15;
final String text =
readFile(getAssets().open(path.substring(assetPathStart)));
textView.setText(StringUtil.fromHtml(text.replace("\n\n",
"<br/><br/>")));
diff --git a/app/src/main/java/org/wikipedia/util/ConfigurationCompat.java
b/app/src/main/java/org/wikipedia/util/ConfigurationCompat.java
index b06b0e8..32d08e7 100644
--- a/app/src/main/java/org/wikipedia/util/ConfigurationCompat.java
+++ b/app/src/main/java/org/wikipedia/util/ConfigurationCompat.java
@@ -8,12 +8,7 @@
public final class ConfigurationCompat {
public static void setLocale(@NonNull Configuration cfg, @NonNull Locale
locale) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- cfg.setLocale(locale);
- } else {
- //noinspection deprecation
- cfg.locale = locale;
- }
+ cfg.setLocale(locale);
}
@NonNull public static Locale getLocale(@NonNull Configuration cfg) {
diff --git a/app/src/main/java/org/wikipedia/util/DeviceUtil.java
b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
index 871759e..be77724 100644
--- a/app/src/main/java/org/wikipedia/util/DeviceUtil.java
+++ b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
@@ -7,11 +7,9 @@
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
-import android.os.Build;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.net.ConnectivityManagerCompat;
-import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
@@ -74,19 +72,14 @@
}
public static boolean isLocationServiceEnabled(@NonNull Context context) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- int locationMode = Settings.Secure.LOCATION_MODE_OFF;
- try {
- locationMode =
Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.LOCATION_MODE);
- } catch (Settings.SettingNotFoundException e) {
- L.d("Location service setting not found.", e);
- }
- return locationMode != Settings.Secure.LOCATION_MODE_OFF;
+ int locationMode = Settings.Secure.LOCATION_MODE_OFF;
+ try {
+ locationMode = Settings.Secure.getInt(context.getContentResolver(),
+ Settings.Secure.LOCATION_MODE);
+ } catch (Settings.SettingNotFoundException e) {
+ L.d("Location service setting not found.", e);
}
- String locationProviders =
Settings.Secure.getString(context.getContentResolver(),
- Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
- return !TextUtils.isEmpty(locationProviders);
+ return locationMode != Settings.Secure.LOCATION_MODE_OFF;
}
public static boolean isOnline() {
diff --git a/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
b/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
index 54bb32b..f7b0d4d 100644
--- a/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
+++ b/app/src/main/java/org/wikipedia/util/FeedbackUtil.java
@@ -109,9 +109,9 @@
private static Snackbar makeSnackbar(View view, CharSequence text, int
duration) {
Snackbar snackbar = Snackbar.make(view, text, duration);
- TextView textView = (TextView)
snackbar.getView().findViewById(R.id.snackbar_text);
+ TextView textView =
snackbar.getView().findViewById(R.id.snackbar_text);
textView.setMaxLines(SNACKBAR_MAX_LINES);
- TextView actionView = (TextView)
snackbar.getView().findViewById(R.id.snackbar_action);
+ TextView actionView =
snackbar.getView().findViewById(R.id.snackbar_action);
actionView.setTextColor(ContextCompat.getColor(view.getContext(),
R.color.green50));
return snackbar;
}
diff --git a/app/src/main/java/org/wikipedia/util/FileUtil.java
b/app/src/main/java/org/wikipedia/util/FileUtil.java
index 0573568..bb22e03 100644
--- a/app/src/main/java/org/wikipedia/util/FileUtil.java
+++ b/app/src/main/java/org/wikipedia/util/FileUtil.java
@@ -1,7 +1,6 @@
package org.wikipedia.util;
import android.graphics.Bitmap;
-import android.os.Build;
import android.os.StatFs;
import android.support.annotation.NonNull;
@@ -29,12 +28,7 @@
public static long blockSize(File file) {
StatFs statFs = new StatFs(file.getAbsolutePath());
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
- return statFs.getBlockSizeLong();
- }
-
- //noinspection deprecation
- return statFs.getBlockSize();
+ return statFs.getBlockSizeLong();
}
public static File writeToFile(ByteArrayOutputStream bytes, File
destinationFile) throws IOException {
diff --git a/app/src/main/java/org/wikipedia/util/L10nUtil.java
b/app/src/main/java/org/wikipedia/util/L10nUtil.java
index 445cb3e..01cef80 100644
--- a/app/src/main/java/org/wikipedia/util/L10nUtil.java
+++ b/app/src/main/java/org/wikipedia/util/L10nUtil.java
@@ -3,7 +3,6 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.SparseArray;
@@ -95,9 +94,7 @@
* @param lang Wiki code for the language based on which to set direction
*/
public static void setConditionalTextDirection(View view, String lang) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- view.setTextDirection(isLangRTL(lang) ? View.TEXT_DIRECTION_RTL :
View.TEXT_DIRECTION_LTR);
- }
+ view.setTextDirection(isLangRTL(lang) ? View.TEXT_DIRECTION_RTL :
View.TEXT_DIRECTION_LTR);
}
/**
@@ -109,9 +106,7 @@
* @param lang Wiki code for the language based on which to set direction
*/
public static void setConditionalLayoutDirection(View view, String lang) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- view.setLayoutDirection(isLangRTL(lang) ?
View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
- }
+ view.setLayoutDirection(isLangRTL(lang) ? View.LAYOUT_DIRECTION_RTL :
View.LAYOUT_DIRECTION_LTR);
}
/**
diff --git a/app/src/main/java/org/wikipedia/views/CabSearchView.java
b/app/src/main/java/org/wikipedia/views/CabSearchView.java
index 73c0ebe..713fac6 100644
--- a/app/src/main/java/org/wikipedia/views/CabSearchView.java
+++ b/app/src/main/java/org/wikipedia/views/CabSearchView.java
@@ -33,7 +33,7 @@
public CabSearchView(Context context, AttributeSet attrs, int
defStyleAttr) {
super(context, attrs, defStyleAttr);
- SearchView.SearchAutoComplete searchSrcTextView = (SearchAutoComplete)
findViewById(R.id.search_src_text);
+ SearchView.SearchAutoComplete searchSrcTextView =
findViewById(R.id.search_src_text);
searchSrcTextView.setCustomSelectionActionModeCallback(new Callback());
addFilter(searchSrcTextView, new PlainTextInputFilter());
diff --git a/app/src/main/java/org/wikipedia/views/TextInputDialog.java
b/app/src/main/java/org/wikipedia/views/TextInputDialog.java
index f7e44d6..9f25ddf 100644
--- a/app/src/main/java/org/wikipedia/views/TextInputDialog.java
+++ b/app/src/main/java/org/wikipedia/views/TextInputDialog.java
@@ -45,8 +45,8 @@
public TextInputDialog setView(@LayoutRes int id) {
View rootView = LayoutInflater.from(getContext()).inflate(id, null);
- editText = (EditText) rootView.findViewById(R.id.text_input);
- editTextContainer = (TextInputLayout)
rootView.findViewById(R.id.text_input_container);
+ editText = rootView.findViewById(R.id.text_input);
+ editTextContainer = rootView.findViewById(R.id.text_input_container);
super.setView(rootView);
editTextContainer.setErrorEnabled(true);
diff --git a/app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
b/app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
index 79c6241..5f6c2fe 100644
--- a/app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
+++ b/app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
@@ -81,9 +81,9 @@
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.dialog_wiktionary, container);
- progressBar = (ProgressBar)
rootView.findViewById(R.id.dialog_wiktionary_progress);
+ progressBar = rootView.findViewById(R.id.dialog_wiktionary_progress);
- TextView titleText = (TextView)
rootView.findViewById(R.id.wiktionary_definition_dialog_title);
+ TextView titleText =
rootView.findViewById(R.id.wiktionary_definition_dialog_title);
titleText.setText(sanitizeForDialogTitle(selectedText));
setConditionalLayoutDirection(rootView,
pageTitle.getWikiSite().languageCode());
@@ -141,14 +141,14 @@
};
private void displayNoDefinitionsFound() {
- TextView noDefinitionsFoundView = (TextView)
rootView.findViewById(R.id.wiktionary_no_definitions_found);
+ TextView noDefinitionsFoundView =
rootView.findViewById(R.id.wiktionary_no_definitions_found);
noDefinitionsFoundView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
private void layOutDefinitionsByUsage() {
LayoutInflater inflater = LayoutInflater.from(getContext());
- LinearLayout fullDefinitionsList = (LinearLayout)
rootView.findViewById(R.id.wiktionary_definitions_by_part_of_speech);
+ LinearLayout fullDefinitionsList =
rootView.findViewById(R.id.wiktionary_definitions_by_part_of_speech);
RbDefinition.Usage[] usageList =
currentDefinition.getUsagesForLang("en");
if (usageList == null || usageList.length == 0) {
@@ -163,9 +163,9 @@
}
private void layOutUsage(RbDefinition.Usage currentUsage, View usageView,
LayoutInflater inflater) {
- TextView partOfSpeechView = (TextView)
usageView.findViewById(R.id.wiktionary_part_of_speech);
+ TextView partOfSpeechView =
usageView.findViewById(R.id.wiktionary_part_of_speech);
partOfSpeechView.setText(currentUsage.getPartOfSpeech());
- LinearLayout definitionsForPartOfSpeechList = (LinearLayout)
usageView.findViewById(R.id.list_wiktionary_definitions_with_examples);
+ LinearLayout definitionsForPartOfSpeechList =
usageView.findViewById(R.id.list_wiktionary_definitions_with_examples);
for (int i = 0; i < currentUsage.getDefinitions().length; i++) {
View definitionContainerView =
inflater.inflate(R.layout.item_wiktionary_definition_with_examples, (ViewGroup)
rootView, false);
@@ -175,12 +175,12 @@
}
private void layOutDefinitionWithExamples(RbDefinition.Definition
currentDefinition, View definitionContainerView, LayoutInflater inflater, int
count) {
- AppTextView definitionView = (AppTextView)
definitionContainerView.findViewById(R.id.wiktionary_definition);
+ AppTextView definitionView =
definitionContainerView.findViewById(R.id.wiktionary_definition);
String definitionWithCount = getCounterString(count) +
currentDefinition.getDefinition();
definitionView.setText(StringUtil.fromHtml(definitionWithCount));
definitionView.setMovementMethod(linkMovementMethod);
- LinearLayout examplesView = (LinearLayout)
definitionContainerView.findViewById(R.id.wiktionary_examples);
+ LinearLayout examplesView =
definitionContainerView.findViewById(R.id.wiktionary_examples);
if (currentDefinition.getExamples() != null) {
layoutExamples(currentDefinition.getExamples(), examplesView,
inflater);
}
diff --git a/app/src/main/res/values/styles.xml
b/app/src/main/res/values/styles.xml
index 33b9b8f..37b9c0f 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -106,7 +106,7 @@
<item name="android:dividerHeight">0dp</item>
</style>
- <style name="RtlAwareTextView" tools:targetApi="17">
+ <style name="RtlAwareTextView">
<item name="android:textDirection">anyRtl</item>
<item name="android:textAlignment">viewStart</item>
</style>
@@ -184,7 +184,7 @@
<!-- Preferences -->
- <style name="AppPreferenceTheme"
parent="PreferenceThemeOverlay.v14.Material" tools:targetApi="17">
+ <style name="AppPreferenceTheme"
parent="PreferenceThemeOverlay.v14.Material" >
<item
name="preferenceFragmentCompatStyle">@style/AppPreferenceFragment</item>
<item
name="android:listPreferredItemPaddingLeft">@dimen/activity_horizontal_margin</item>
<item
name="android:listPreferredItemPaddingStart">@dimen/activity_horizontal_margin</item>
diff --git
a/app/src/test/java/okhttp3/internal/cache/CacheDelegateInterceptorTest.java
b/app/src/test/java/okhttp3/internal/cache/CacheDelegateInterceptorTest.java
index 6636f85..a08d991 100644
--- a/app/src/test/java/okhttp3/internal/cache/CacheDelegateInterceptorTest.java
+++ b/app/src/test/java/okhttp3/internal/cache/CacheDelegateInterceptorTest.java
@@ -1,8 +1,6 @@
package okhttp3.internal.cache;
-import android.os.Build;
import android.support.annotation.NonNull;
-import android.support.annotation.RequiresApi;
import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
@@ -77,7 +75,6 @@
}
// The size on disk of OkHttp metadata is expected to be nonzero.
- @RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Test public void testAssumptionCacheSizeMetadataIsNonzero() throws
Throwable {
Request req = newRequest();
requestResponse("A", req);
@@ -92,7 +89,6 @@
// Although OkHttp decompresses gzipped service responses seamlessly, the
cache is expected to
// persist them in compressed form and report the compressed size, not the
decompressed size.
- @RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Test public void testAssumptionCacheSizeCompressedSizeIsReported() throws
Throwable {
String interval = "0123456789"; // One cycle.
String body = StringUtils.repeat(interval, 100_000); // The body is
many intervals.
--
To view, visit https://gerrit.wikimedia.org/r/381494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I022373f4f0479b621bddc2113c73ce92db23cc89
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Cooltey <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits