remove unnecessary compat code (#932)

This commit is contained in:
Konrad Pozniak 2018-12-03 11:22:57 +01:00 committed by GitHub
parent 8d7f879a8f
commit 1413a1155b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 23 deletions

View file

@ -32,8 +32,6 @@ import android.support.text.emoji.EmojiCompat
import android.support.v4.app.ActivityOptionsCompat import android.support.v4.app.ActivityOptionsCompat
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewCompat
import android.support.v4.widget.TextViewCompat
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.LinearLayoutManager
import android.view.Menu import android.view.Menu
@ -142,7 +140,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
accountId = intent.getStringExtra(KEY_ACCOUNT_ID) accountId = intent.getStringExtra(KEY_ACCOUNT_ID)
// set toolbar top margin according to system window insets // set toolbar top margin according to system window insets
ViewCompat.setOnApplyWindowInsetsListener(accountCoordinatorLayout) { _, insets -> accountCoordinatorLayout.setOnApplyWindowInsetsListener { _, insets ->
val top = insets.systemWindowInsetTop val top = insets.systemWindowInsetTop
val toolbarParams = accountToolbar.layoutParams as CollapsingToolbarLayout.LayoutParams val toolbarParams = accountToolbar.layoutParams as CollapsingToolbarLayout.LayoutParams
@ -317,7 +315,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
accountAvatarImageView.setOnClickListener { avatarView -> accountAvatarImageView.setOnClickListener { avatarView ->
val intent = ViewMediaActivity.newAvatarIntent(avatarView.context, account.avatar) val intent = ViewMediaActivity.newAvatarIntent(avatarView.context, account.avatar)
ViewCompat.setTransitionName(avatarView, account.avatar) avatarView.transitionName = account.avatar
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, avatarView, account.avatar) val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, avatarView, account.avatar)
startActivity(intent, options.toBundle()) startActivity(intent, options.toBundle())
@ -352,7 +350,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
val textColor = ThemeUtils.getColor(this, android.R.attr.textColorTertiary) val textColor = ThemeUtils.getColor(this, android.R.attr.textColorTertiary)
movedIcon?.setColorFilter(textColor, PorterDuff.Mode.SRC_IN) movedIcon?.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(accountMovedText, movedIcon, null, null, null) accountMovedText.setCompoundDrawablesRelativeWithIntrinsicBounds(movedIcon, null, null, null)
accountFollowers.hide() accountFollowers.hide()
accountFollowing.hide() accountFollowing.hide()

View file

@ -52,8 +52,6 @@ import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider; import android.support.v4.content.FileProvider;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.content.res.AppCompatResources; import android.support.v7.content.res.AppCompatResources;
@ -360,10 +358,10 @@ public final class ComposeActivity
int textColor = ThemeUtils.getColor(this, android.R.attr.textColorTertiary); int textColor = ThemeUtils.getColor(this, android.R.attr.textColorTertiary);
Drawable cameraIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_camera_alt).color(textColor).sizeDp(18); Drawable cameraIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_camera_alt).color(textColor).sizeDp(18);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(actionPhotoTake, cameraIcon, null, null, null); actionPhotoTake.setCompoundDrawablesRelativeWithIntrinsicBounds(cameraIcon, null, null, null);
Drawable imageIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_image).color(textColor).sizeDp(18); Drawable imageIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_image).color(textColor).sizeDp(18);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(actionPhotoPick, imageIcon, null, null, null); actionPhotoPick.setCompoundDrawablesRelativeWithIntrinsicBounds(imageIcon, null, null, null);
actionPhotoTake.setOnClickListener(v -> initiateCameraApp()); actionPhotoTake.setOnClickListener(v -> initiateCameraApp());
actionPhotoPick.setOnClickListener(v -> onMediaPick()); actionPhotoPick.setOnClickListener(v -> onMediaPick());
@ -466,7 +464,7 @@ public final class ComposeActivity
Drawable arrowDownIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_arrow_drop_down).sizeDp(12); Drawable arrowDownIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_arrow_drop_down).sizeDp(12);
ThemeUtils.setDrawableTint(this, arrowDownIcon, android.R.attr.textColorTertiary); ThemeUtils.setDrawableTint(this, arrowDownIcon, android.R.attr.textColorTertiary);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(replyTextView, null, null, arrowDownIcon, null); replyTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, arrowDownIcon, null);
replyTextView.setOnClickListener(v -> { replyTextView.setOnClickListener(v -> {
TransitionManager.beginDelayedTransition((ViewGroup)replyContentTextView.getParent()); TransitionManager.beginDelayedTransition((ViewGroup)replyContentTextView.getParent());
@ -476,11 +474,10 @@ public final class ComposeActivity
Drawable arrowUpIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_arrow_drop_up).sizeDp(12); Drawable arrowUpIcon = new IconicsDrawable(this, GoogleMaterial.Icon.gmd_arrow_drop_up).sizeDp(12);
ThemeUtils.setDrawableTint(this, arrowUpIcon, android.R.attr.textColorTertiary); ThemeUtils.setDrawableTint(this, arrowUpIcon, android.R.attr.textColorTertiary);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(replyTextView, null, null, arrowUpIcon, null); replyTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, arrowUpIcon, null);
} else { } else {
replyContentTextView.setVisibility(View.GONE); replyContentTextView.setVisibility(View.GONE);
replyTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, arrowDownIcon, null);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(replyTextView, null, null, arrowDownIcon, null);
} }
}); });
} }
@ -662,14 +659,14 @@ public final class ComposeActivity
Snackbar.LENGTH_SHORT); Snackbar.LENGTH_SHORT);
bar.setAction(actionId, listener); bar.setAction(actionId, listener);
//necessary so snackbar is shown over everything //necessary so snackbar is shown over everything
ViewCompat.setElevation(bar.getView(), getResources().getDimensionPixelSize(R.dimen.compose_activity_snackbar_elevation)); bar.getView().setElevation(getResources().getDimensionPixelSize(R.dimen.compose_activity_snackbar_elevation));
bar.show(); bar.show();
} }
private void displayTransientError(@StringRes int stringId) { private void displayTransientError(@StringRes int stringId) {
Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose), stringId, Snackbar.LENGTH_LONG); Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose), stringId, Snackbar.LENGTH_LONG);
//necessary so snackbar is shown over everything //necessary so snackbar is shown over everything
ViewCompat.setElevation(bar.getView(), getResources().getDimensionPixelSize(R.dimen.compose_activity_snackbar_elevation)); bar.getView().setElevation(getResources().getDimensionPixelSize(R.dimen.compose_activity_snackbar_elevation));
bar.show(); bar.show();
} }

View file

@ -29,7 +29,6 @@ import android.os.Bundle
import android.support.design.widget.Snackbar import android.support.design.widget.Snackbar
import android.support.v4.app.ActivityCompat import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.support.v4.widget.TextViewCompat
import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.LinearLayoutManager
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
@ -98,7 +97,7 @@ class EditProfileActivity : BaseActivity(), Injectable {
val plusDrawable = IconicsDrawable(this, GoogleMaterial.Icon.gmd_add).sizeDp(12).color(Color.WHITE) val plusDrawable = IconicsDrawable(this, GoogleMaterial.Icon.gmd_add).sizeDp(12).color(Color.WHITE)
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(addFieldButton, plusDrawable, null, null, null) addFieldButton.setCompoundDrawablesRelativeWithIntrinsicBounds(plusDrawable, null, null, null)
addFieldButton.setOnClickListener { addFieldButton.setOnClickListener {
accountFieldEditAdapter.addField() accountFieldEditAdapter.addField()

View file

@ -3,7 +3,6 @@ package com.keylesspalace.tusky
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.support.v4.widget.TextViewCompat
import android.support.v7.widget.DividerItemDecoration import android.support.v7.widget.DividerItemDecoration
import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
@ -175,7 +174,7 @@ class ListsActivity : BaseActivity(), ListsView, Injectable {
val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list).sizeDp(20) val icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_list).sizeDp(20)
ThemeUtils.setDrawableTint(context, icon, android.R.attr.textColorTertiary) ThemeUtils.setDrawableTint(context, icon, android.R.attr.textColorTertiary)
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(nameTextView, icon, null, null, null) nameTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null)
} }
} }

View file

@ -21,7 +21,6 @@ import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.support.v4.view.ViewCompat
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -72,7 +71,7 @@ class ViewVideoFragment : ViewMediaFragment() {
override fun setupMediaView(url: String) { override fun setupMediaView(url: String) {
descriptionView = mediaDescription descriptionView = mediaDescription
val videoView = videoPlayer val videoView = videoPlayer
ViewCompat.setTransitionName(videoView, url) videoView.transitionName = url
videoView.setVideoPath(url) videoView.setVideoPath(url)
mediaController = MediaController(mediaActivity) mediaController = MediaController(mediaActivity)
mediaController.setMediaPlayer(videoPlayer) mediaController.setMediaPlayer(videoPlayer)

View file

@ -25,7 +25,6 @@ import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.content.res.AppCompatResources; import android.support.v7.content.res.AppCompatResources;
import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet; import android.util.AttributeSet;
@ -117,7 +116,7 @@ public final class ProgressImageView extends AppCompatImageView {
getHeight() - circleMargin - circleRadius, getHeight() - circleMargin - circleRadius,
getWidth() - circleMargin, getWidth() - circleMargin,
getHeight() - circleMargin); getHeight() - circleMargin);
DrawableCompat.setTint(captionDrawable, Color.WHITE); captionDrawable.setTint(Color.WHITE);
captionDrawable.draw(canvas); captionDrawable.draw(canvas);
} }
} }