From 41268859b1b4d0f0069cfd0a54676755d40d3afc Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sat, 20 Apr 2019 22:36:44 +0200 Subject: [PATCH] fix some lint warnings --- .../tusky/AccountListActivity.kt | 14 +++++----- .../tusky/AccountsInListFragment.kt | 3 +-- .../com/keylesspalace/tusky/BaseActivity.java | 2 +- .../tusky/BottomSheetActivity.kt | 1 - .../keylesspalace/tusky/ComposeActivity.java | 2 -- .../tusky/EditProfileActivity.kt | 16 +++++------ .../keylesspalace/tusky/FiltersActivity.kt | 2 +- .../com/keylesspalace/tusky/MainActivity.java | 2 +- .../keylesspalace/tusky/TuskyApplication.java | 3 --- .../tusky/adapter/AccountFieldAdapter.kt | 4 +-- .../tusky/adapter/AccountFieldEditAdapter.kt | 4 +-- .../tusky/adapter/AccountViewHolder.java | 1 - .../adapter/ComposeAutoCompleteAdapter.java | 6 ++--- .../tusky/adapter/EmojiAdapter.kt | 4 +-- .../tusky/adapter/StatusViewHolder.java | 1 - .../tusky/adapter/ThreadAdapter.java | 2 +- .../com/keylesspalace/tusky/entity/Filter.kt | 2 +- .../tusky/entity/Notification.kt | 4 +-- .../tusky/fragment/AccountMediaFragment.kt | 4 +-- .../tusky/fragment/NotificationsFragment.java | 2 -- .../tusky/fragment/ViewVideoFragment.kt | 6 ++--- .../preference/AccountPreferencesFragment.kt | 2 +- .../preference/ProxyPreferencesFragment.kt | 1 - .../tusky/network/TimelineCases.kt | 4 +-- .../tusky/pager/AccountPagerAdapter.java | 1 + .../keylesspalace/tusky/util/HtmlUtils.java | 2 -- .../keylesspalace/tusky/util/LinkHelper.java | 1 - .../tusky/util/NotificationHelper.java | 2 -- .../tusky/util/PagingRequestHelper.java | 8 +++--- .../tusky/view/MediaPreviewImageView.kt | 6 ++--- .../tusky/view/RoundedImageView.java | 6 ++--- .../tusky/viewdata/StatusViewData.java | 4 +-- .../tusky/viewmodel/ListsViewModel.kt | 2 +- app/src/main/res/anim/explode.xml | 1 - app/src/main/res/drawable/dialog_bg.xml | 5 ---- .../main/res/menu/notifications_filter.xml | 27 ------------------- 36 files changed, 52 insertions(+), 105 deletions(-) delete mode 100644 app/src/main/res/drawable/dialog_bg.xml delete mode 100644 app/src/main/res/menu/notifications_filter.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountListActivity.kt b/app/src/main/java/com/keylesspalace/tusky/AccountListActivity.kt index 8421a137..a73092e3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountListActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/AccountListActivity.kt @@ -55,13 +55,13 @@ class AccountListActivity : BaseActivity(), HasSupportFragmentInjector { setSupportActionBar(toolbar) supportActionBar?.apply { when (type) { - AccountListActivity.Type.BLOCKS -> setTitle(R.string.title_blocks) - AccountListActivity.Type.MUTES -> setTitle(R.string.title_mutes) - AccountListActivity.Type.FOLLOW_REQUESTS -> setTitle(R.string.title_follow_requests) - AccountListActivity.Type.FOLLOWERS -> setTitle(R.string.title_followers) - AccountListActivity.Type.FOLLOWS -> setTitle(R.string.title_follows) - AccountListActivity.Type.REBLOGGED -> setTitle(R.string.title_reblogged_by) - AccountListActivity.Type.FAVOURITED -> setTitle(R.string.title_favourited_by) + Type.BLOCKS -> setTitle(R.string.title_blocks) + Type.MUTES -> setTitle(R.string.title_mutes) + Type.FOLLOW_REQUESTS -> setTitle(R.string.title_follow_requests) + Type.FOLLOWERS -> setTitle(R.string.title_followers) + Type.FOLLOWS -> setTitle(R.string.title_follows) + Type.REBLOGGED -> setTitle(R.string.title_reblogged_by) + Type.FAVOURITED -> setTitle(R.string.title_favourited_by) } setDisplayHomeAsUpEnabled(true) setDisplayShowHomeEnabled(true) diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt index 4a80b00b..3c6c6cf3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt @@ -28,7 +28,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.bumptech.glide.request.RequestOptions import com.keylesspalace.tusky.di.Injectable import com.keylesspalace.tusky.di.ViewModelFactory import com.keylesspalace.tusky.entity.Account @@ -75,7 +74,7 @@ class AccountsInListFragment : DialogFragment(), Injectable { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(DialogFragment.STYLE_NORMAL, R.style.TuskyDialogFragmentStyle) + setStyle(STYLE_NORMAL, R.style.TuskyDialogFragmentStyle) viewModel = viewModelFactory.create(AccountsInListViewModel::class.java) val args = arguments!! listId = args.getString(LIST_ID_ARG)!! diff --git a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java index df069dc3..7d9860ea 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java @@ -118,7 +118,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab return true; } - private int textStyle(String name) { + private static int textStyle(String name) { int style; switch (name) { case "smallest": diff --git a/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt b/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt index 5e1b4c7f..b76bbab5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt @@ -22,7 +22,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior import android.view.View import android.widget.LinearLayout import com.keylesspalace.tusky.entity.SearchResults -import com.keylesspalace.tusky.entity.Status import com.keylesspalace.tusky.network.MastodonApi import com.keylesspalace.tusky.util.LinkHelper import retrofit2.Call diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 8b64c7ea..14ca2108 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -29,7 +29,6 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.media.Image; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; @@ -53,7 +52,6 @@ import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.webkit.MimeTypeMap; -import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; diff --git a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt index 82b23223..516f3be7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt @@ -248,13 +248,13 @@ class EditProfileActivity : BaseActivity(), Injectable { intent.addCategory(Intent.CATEGORY_OPENABLE) intent.type = "image/*" when (currentlyPicking) { - EditProfileActivity.PickType.AVATAR -> { + PickType.AVATAR -> { startActivityForResult(intent, AVATAR_PICK_RESULT) } - EditProfileActivity.PickType.HEADER -> { + PickType.HEADER -> { startActivityForResult(intent, HEADER_PICK_RESULT) } - EditProfileActivity.PickType.NOTHING -> { /* do nothing */ } + PickType.NOTHING -> { /* do nothing */ } } } @@ -297,18 +297,18 @@ class EditProfileActivity : BaseActivity(), Injectable { private fun beginMediaPicking() { when (currentlyPicking) { - EditProfileActivity.PickType.AVATAR -> { + PickType.AVATAR -> { avatarProgressBar.visibility = View.VISIBLE avatarPreview.visibility = View.INVISIBLE avatarButton.setImageDrawable(null) } - EditProfileActivity.PickType.HEADER -> { + PickType.HEADER -> { headerProgressBar.visibility = View.VISIBLE headerPreview.visibility = View.INVISIBLE headerButton.setImageDrawable(null) } - EditProfileActivity.PickType.NOTHING -> { /* do nothing */ } + PickType.NOTHING -> { /* do nothing */ } } } @@ -359,10 +359,10 @@ class EditProfileActivity : BaseActivity(), Injectable { beginMediaPicking() when (currentlyPicking) { - EditProfileActivity.PickType.AVATAR -> { + PickType.AVATAR -> { viewModel.newAvatar(uri, this) } - EditProfileActivity.PickType.HEADER -> { + PickType.HEADER -> { viewModel.newHeader(uri, this) } else -> { diff --git a/app/src/main/java/com/keylesspalace/tusky/FiltersActivity.kt b/app/src/main/java/com/keylesspalace/tusky/FiltersActivity.kt index 609f290e..202c7780 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FiltersActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/FiltersActivity.kt @@ -92,7 +92,7 @@ class FiltersActivity: BaseActivity() { } override fun onFailure(call: Call, t: Throwable) { - Toast.makeText(this@FiltersActivity, "Error creating filter '${phrase}'", Toast.LENGTH_SHORT).show() + Toast.makeText(this@FiltersActivity, "Error creating filter '$phrase'", Toast.LENGTH_SHORT).show() } }) } diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index f4028e4e..80d7abb8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -598,7 +598,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut headerResult.setActiveProfile(accountManager.getActiveAccount().getId()); } - private void onFetchUserInfoFailure(Exception exception) { + private static void onFetchUserInfoFailure(Exception exception) { Log.e(TAG, "Failed to fetch user info. " + exception.getMessage()); } diff --git a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java index ec9cfb97..2144b7d7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java +++ b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java @@ -44,7 +44,6 @@ import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector; import dagger.android.HasBroadcastReceiverInjector; import dagger.android.HasServiceInjector; -import okhttp3.OkHttpClient; public class TuskyApplication extends Application implements HasActivityInjector, HasServiceInjector, HasBroadcastReceiverInjector { @Inject @@ -55,8 +54,6 @@ public class TuskyApplication extends Application implements HasActivityInjector DispatchingAndroidInjector dispatchingBroadcastReceiverInjector; @Inject NotificationPullJobCreator notificationPullJobCreator; - @Inject - OkHttpClient okHttpClient; private AppDatabase appDatabase; private AccountManager accountManager; diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldAdapter.kt index 3dcc6d2f..c01d3d72 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldAdapter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldAdapter.kt @@ -35,12 +35,12 @@ class AccountFieldAdapter(private val linkListener: LinkListener) : RecyclerView override fun getItemCount() = fields.size - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AccountFieldAdapter.ViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_account_field, parent, false) return ViewHolder(view) } - override fun onBindViewHolder(viewHolder: AccountFieldAdapter.ViewHolder, position: Int) { + override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) { val field = fields[position] viewHolder.nameTextView.text = field.name val emojifiedValue = CustomEmojiHelper.emojifyText(field.value, emojis, viewHolder.valueTextView) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldEditAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldEditAdapter.kt index 96ae4dc9..768c2885 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldEditAdapter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/AccountFieldEditAdapter.kt @@ -56,12 +56,12 @@ class AccountFieldEditAdapter : RecyclerView.Adapter, private val onEmojiSelectedListener: return emojiList.size } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EmojiAdapter.EmojiHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EmojiHolder { val view = LayoutInflater.from(parent.context).inflate(R.layout.item_emoji_button, parent, false) as ImageView return EmojiHolder(view) } - override fun onBindViewHolder(viewHolder: EmojiAdapter.EmojiHolder, position: Int) { + override fun onBindViewHolder(viewHolder: EmojiHolder, position: Int) { val emoji = emojiList[position] Glide.with(viewHolder.emojiImageView) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java index 00367d03..f96c869a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java @@ -17,7 +17,6 @@ package com.keylesspalace.tusky.adapter; import android.content.Context; import android.text.InputFilter; -import android.text.TextUtils; import android.view.View; import android.widget.TextView; import android.widget.ToggleButton; diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/ThreadAdapter.java b/app/src/main/java/com/keylesspalace/tusky/adapter/ThreadAdapter.java index c66e0371..3df88642 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/ThreadAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/ThreadAdapter.java @@ -140,7 +140,7 @@ public class ThreadAdapter extends RecyclerView.Adapter { @Nullable public StatusViewData.Concrete getItem(int position) { - if (position != RecyclerView.NO_POSITION && position >= 0 && position < statuses.size()) { + if (position >= 0 && position < statuses.size()) { return statuses.get(position); } else { return null; diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Filter.kt b/app/src/main/java/com/keylesspalace/tusky/entity/Filter.kt index e0440be8..6d6cbaa5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Filter.kt +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Filter.kt @@ -25,7 +25,7 @@ data class Filter ( val irreversible: Boolean, @SerializedName("whole_word") val wholeWord: Boolean ) { - public companion object { + companion object { const val HOME = "home" const val NOTIFICATIONS = "notifications" const val PUBLIC = "public" diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt b/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt index b731cd5a..30d5499d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Notification.kt @@ -65,8 +65,8 @@ data class Notification( class NotificationTypeAdapter : JsonDeserializer { @Throws(JsonParseException::class) - override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Notification.Type { - return Notification.Type.byString(json.asString) + override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Type { + return Type.byString(json.asString) } } diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountMediaFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountMediaFragment.kt index e6fb7a66..fb020694 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountMediaFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountMediaFragment.kt @@ -28,7 +28,6 @@ import androidx.core.view.ViewCompat import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy import com.keylesspalace.tusky.R import com.keylesspalace.tusky.ViewMediaActivity import com.keylesspalace.tusky.di.Injectable @@ -234,9 +233,8 @@ class AccountMediaFragment : BaseFragment(), Injectable { } private fun viewMedia(items: List, currentIndex: Int, view: View?) { - val type = items[currentIndex].attachment.type - when (type) { + when (items[currentIndex].attachment.type) { Attachment.Type.IMAGE, Attachment.Type.GIFV, Attachment.Type.VIDEO -> { diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java index 7eee789d..a424c985 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java @@ -34,7 +34,6 @@ import android.widget.ProgressBar; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.adapter.NotificationsAdapter; import com.keylesspalace.tusky.adapter.StatusBaseViewHolder; @@ -154,7 +153,6 @@ public class NotificationsFragment extends SFragment implements private LinearLayoutManager layoutManager; private EndlessOnScrollListener scrollListener; private NotificationsAdapter adapter; - private TabLayout.OnTabSelectedListener onTabSelectedListener; private Button buttonFilter; private boolean hideFab; private boolean topLoading; diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt index 827305d4..429ac9e7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt @@ -84,13 +84,13 @@ class ViewVideoFragment : ViewMediaFragment() { videoView.setOnPreparedListener { mp -> progressBar.hide() mp.isLooping = true - if (arguments!!.getBoolean(ViewMediaFragment.ARG_START_POSTPONED_TRANSITION)) { + if (arguments!!.getBoolean(ARG_START_POSTPONED_TRANSITION)) { hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS) videoView.start() } } - if (arguments!!.getBoolean(ViewMediaFragment.ARG_START_POSTPONED_TRANSITION)) { + if (arguments!!.getBoolean(ARG_START_POSTPONED_TRANSITION)) { mediaActivity.onBringUp() } } @@ -107,7 +107,7 @@ class ViewVideoFragment : ViewMediaFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val attachment = arguments?.getParcelable(ViewMediaFragment.ARG_ATTACHMENT) + val attachment = arguments?.getParcelable(ARG_ATTACHMENT) val url: String if (attachment == null) { diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/AccountPreferencesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/AccountPreferencesFragment.kt index c3293bd1..03110498 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/AccountPreferencesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/AccountPreferencesFragment.kt @@ -273,7 +273,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), return drawable } - fun launchFilterActivity(filterContext: String, titleResource: Int): Boolean { + private fun launchFilterActivity(filterContext: String, titleResource: Int): Boolean { val intent = Intent(context, FiltersActivity::class.java) intent.putExtra(FiltersActivity.FILTERS_CONTEXT, filterContext) intent.putExtra(FiltersActivity.FILTERS_TITLE, getString(titleResource)) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/ProxyPreferencesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/ProxyPreferencesFragment.kt index 64403539..ede9749f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/preference/ProxyPreferencesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/preference/ProxyPreferencesFragment.kt @@ -18,7 +18,6 @@ package com.keylesspalace.tusky.fragment.preference import android.content.SharedPreferences import android.os.Bundle import androidx.preference.EditTextPreference -import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import com.keylesspalace.tusky.R diff --git a/app/src/main/java/com/keylesspalace/tusky/network/TimelineCases.kt b/app/src/main/java/com/keylesspalace/tusky/network/TimelineCases.kt index 32fe5c07..97ad9b7c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/network/TimelineCases.kt +++ b/app/src/main/java/com/keylesspalace/tusky/network/TimelineCases.kt @@ -89,7 +89,7 @@ class TimelineCasesImpl( override fun block(id: String) { val call = mastodonApi.blockAccount(id) call.enqueue(object : Callback { - override fun onResponse(call: Call, response: retrofit2.Response) {} + override fun onResponse(call: Call, response: Response) {} override fun onFailure(call: Call, t: Throwable) {} }) @@ -100,7 +100,7 @@ class TimelineCasesImpl( override fun delete(id: String) { val call = mastodonApi.deleteStatus(id) call.enqueue(object : Callback { - override fun onResponse(call: Call, response: retrofit2.Response) {} + override fun onResponse(call: Call, response: Response) {} override fun onFailure(call: Call, t: Throwable) {} }) diff --git a/app/src/main/java/com/keylesspalace/tusky/pager/AccountPagerAdapter.java b/app/src/main/java/com/keylesspalace/tusky/pager/AccountPagerAdapter.java index 848fed99..1fcb3f81 100644 --- a/app/src/main/java/com/keylesspalace/tusky/pager/AccountPagerAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/pager/AccountPagerAdapter.java @@ -43,6 +43,7 @@ public class AccountPagerAdapter extends FragmentPagerAdapter { pageTitles = titles; } + @NonNull @Override public Fragment getItem(int position) { switch (position) { diff --git a/app/src/main/java/com/keylesspalace/tusky/util/HtmlUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/HtmlUtils.java index eee9bb44..cba8f2fa 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/HtmlUtils.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/HtmlUtils.java @@ -28,7 +28,6 @@ public class HtmlUtils { return s.subSequence(0, i + 1); } - @SuppressWarnings("deprecation") public static Spanned fromHtml(String html) { Spanned result; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { @@ -41,7 +40,6 @@ public class HtmlUtils { return (Spanned) trimTrailingWhitespace(result); } - @SuppressWarnings("deprecation") public static String toHtml(Spanned text) { String result; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { diff --git a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java index ddd08d82..324d17ff 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java @@ -18,7 +18,6 @@ package com.keylesspalace.tusky.util; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.net.Uri; import android.preference.PreferenceManager; import androidx.annotation.Nullable; diff --git a/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java b/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java index 84c67dd3..49bb6553 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java @@ -244,7 +244,6 @@ public class NotificationHelper { NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); - //noinspection ConstantConditions notificationManager.notify(notificationId, builder.build()); if (currentNotifications.length() == 1) { notificationManager.notify((int) account.getId(), builder.setGroupSummary(true).build()); @@ -375,7 +374,6 @@ public class NotificationHelper { channels.add(channel); } - //noinspection ConstantConditions notificationManager.createNotificationChannels(channels); } diff --git a/app/src/main/java/com/keylesspalace/tusky/util/PagingRequestHelper.java b/app/src/main/java/com/keylesspalace/tusky/util/PagingRequestHelper.java index 43b95b39..4f7d3eff 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/PagingRequestHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/PagingRequestHelper.java @@ -26,7 +26,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; /** * A helper class for {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}s and - * {@link DataSource}s to help with tracking network requests. + * {@link androidx.paging.DataSource}s to help with tracking network requests. *

* It is designed to support 3 types of requests, {@link RequestType#INITIAL INITIAL}, * {@link RequestType#BEFORE BEFORE} and {@link RequestType#AFTER AFTER} and runs only 1 request @@ -456,18 +456,18 @@ public class PagingRequestHelper { */ public enum RequestType { /** - * Corresponds to an initial request made to a {@link DataSource} or the empty state for + * Corresponds to an initial request made to a {@link androidx.paging.DataSource} or the empty state for * a {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}. */ INITIAL, /** - * Corresponds to the {@code loadBefore} calls in {@link DataSource} or + * Corresponds to the {@code loadBefore} calls in {@link androidx.paging.DataSource} or * {@code onItemAtFrontLoaded} in * {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}. */ BEFORE, /** - * Corresponds to the {@code loadAfter} calls in {@link DataSource} or + * Corresponds to the {@code loadAfter} calls in {@link androidx.paging.DataSource} or * {@code onItemAtEndLoaded} in * {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}. */ diff --git a/app/src/main/java/com/keylesspalace/tusky/view/MediaPreviewImageView.kt b/app/src/main/java/com/keylesspalace/tusky/view/MediaPreviewImageView.kt index cdff3225..666fe402 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/MediaPreviewImageView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/view/MediaPreviewImageView.kt @@ -77,10 +77,10 @@ defStyleAttr: Int = 0 * even if we have a focus point set. */ override fun getScaleType(): ScaleType { - if (focus != null) { - return ScaleType.CENTER_CROP + return if (focus != null) { + ScaleType.CENTER_CROP } else { - return super.getScaleType() + super.getScaleType() } } diff --git a/app/src/main/java/com/keylesspalace/tusky/view/RoundedImageView.java b/app/src/main/java/com/keylesspalace/tusky/view/RoundedImageView.java index 7d60e72d..43cac86e 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/RoundedImageView.java +++ b/app/src/main/java/com/keylesspalace/tusky/view/RoundedImageView.java @@ -194,12 +194,10 @@ public class RoundedImageView extends AppCompatImageView { } private void applyColorFilter() { - if (mBitmapPaint != null) { - mBitmapPaint.setColorFilter(mColorFilter); - } + mBitmapPaint.setColorFilter(mColorFilter); } - private Bitmap getBitmapFromDrawable(Drawable drawable) { + private static Bitmap getBitmapFromDrawable(Drawable drawable) { if (drawable == null) { return null; } diff --git a/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java b/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java index 904eacb9..18c56381 100644 --- a/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java +++ b/app/src/main/java/com/keylesspalace/tusky/viewdata/StatusViewData.java @@ -269,7 +269,7 @@ public abstract class StatusViewData { @Override public long getViewDataId() { // Chance of collision is super low and impact of mistake is low as well - return getId().hashCode(); + return id.hashCode(); } public boolean deepEquals(StatusViewData o) { @@ -311,7 +311,7 @@ public abstract class StatusViewData { } static CharSequence replaceCrashingCharacters(CharSequence content) { - Boolean replacing = false; + boolean replacing = false; SpannableStringBuilder builder = null; int length = content.length(); diff --git a/app/src/main/java/com/keylesspalace/tusky/viewmodel/ListsViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/viewmodel/ListsViewModel.kt index 8424b103..e6331072 100644 --- a/app/src/main/java/com/keylesspalace/tusky/viewmodel/ListsViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/viewmodel/ListsViewModel.kt @@ -54,7 +54,7 @@ internal class ListsViewModel @Inject constructor(private val api: MastodonApi) private fun loadIfNeeded() { val state = _state.value!! - if (state.loadingState == LoadingState.LOADING || !state.lists.isEmpty()) return + if (state.loadingState == LoadingState.LOADING || state.lists.isNotEmpty()) return updateState { copy(loadingState = LoadingState.LOADING) } diff --git a/app/src/main/res/anim/explode.xml b/app/src/main/res/anim/explode.xml index 27982abc..08001aef 100644 --- a/app/src/main/res/anim/explode.xml +++ b/app/src/main/res/anim/explode.xml @@ -1,7 +1,6 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/notifications_filter.xml b/app/src/main/res/menu/notifications_filter.xml deleted file mode 100644 index 1725c7d8..00000000 --- a/app/src/main/res/menu/notifications_filter.xml +++ /dev/null @@ -1,27 +0,0 @@ - -

- - - - - - - \ No newline at end of file