fix some lint warnings
This commit is contained in:
parent
1ae3e86378
commit
ef66deeae7
36 changed files with 52 additions and 105 deletions
|
@ -55,13 +55,13 @@ class AccountListActivity : BaseActivity(), HasSupportFragmentInjector {
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.apply {
|
supportActionBar?.apply {
|
||||||
when (type) {
|
when (type) {
|
||||||
AccountListActivity.Type.BLOCKS -> setTitle(R.string.title_blocks)
|
Type.BLOCKS -> setTitle(R.string.title_blocks)
|
||||||
AccountListActivity.Type.MUTES -> setTitle(R.string.title_mutes)
|
Type.MUTES -> setTitle(R.string.title_mutes)
|
||||||
AccountListActivity.Type.FOLLOW_REQUESTS -> setTitle(R.string.title_follow_requests)
|
Type.FOLLOW_REQUESTS -> setTitle(R.string.title_follow_requests)
|
||||||
AccountListActivity.Type.FOLLOWERS -> setTitle(R.string.title_followers)
|
Type.FOLLOWERS -> setTitle(R.string.title_followers)
|
||||||
AccountListActivity.Type.FOLLOWS -> setTitle(R.string.title_follows)
|
Type.FOLLOWS -> setTitle(R.string.title_follows)
|
||||||
AccountListActivity.Type.REBLOGGED -> setTitle(R.string.title_reblogged_by)
|
Type.REBLOGGED -> setTitle(R.string.title_reblogged_by)
|
||||||
AccountListActivity.Type.FAVOURITED -> setTitle(R.string.title_favourited_by)
|
Type.FAVOURITED -> setTitle(R.string.title_favourited_by)
|
||||||
}
|
}
|
||||||
setDisplayHomeAsUpEnabled(true)
|
setDisplayHomeAsUpEnabled(true)
|
||||||
setDisplayShowHomeEnabled(true)
|
setDisplayShowHomeEnabled(true)
|
||||||
|
|
|
@ -28,7 +28,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
import com.keylesspalace.tusky.di.ViewModelFactory
|
import com.keylesspalace.tusky.di.ViewModelFactory
|
||||||
import com.keylesspalace.tusky.entity.Account
|
import com.keylesspalace.tusky.entity.Account
|
||||||
|
@ -75,7 +74,7 @@ class AccountsInListFragment : DialogFragment(), Injectable {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setStyle(DialogFragment.STYLE_NORMAL, R.style.TuskyDialogFragmentStyle)
|
setStyle(STYLE_NORMAL, R.style.TuskyDialogFragmentStyle)
|
||||||
viewModel = viewModelFactory.create(AccountsInListViewModel::class.java)
|
viewModel = viewModelFactory.create(AccountsInListViewModel::class.java)
|
||||||
val args = arguments!!
|
val args = arguments!!
|
||||||
listId = args.getString(LIST_ID_ARG)!!
|
listId = args.getString(LIST_ID_ARG)!!
|
||||||
|
|
|
@ -118,7 +118,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int textStyle(String name) {
|
private static int textStyle(String name) {
|
||||||
int style;
|
int style;
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "smallest":
|
case "smallest":
|
||||||
|
|
|
@ -22,7 +22,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.keylesspalace.tusky.entity.SearchResults
|
import com.keylesspalace.tusky.entity.SearchResults
|
||||||
import com.keylesspalace.tusky.entity.Status
|
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.LinkHelper
|
import com.keylesspalace.tusky.util.LinkHelper
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
|
@ -29,7 +29,6 @@ import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.media.Image;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -53,7 +52,6 @@ import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
|
@ -248,13 +248,13 @@ class EditProfileActivity : BaseActivity(), Injectable {
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
intent.type = "image/*"
|
intent.type = "image/*"
|
||||||
when (currentlyPicking) {
|
when (currentlyPicking) {
|
||||||
EditProfileActivity.PickType.AVATAR -> {
|
PickType.AVATAR -> {
|
||||||
startActivityForResult(intent, AVATAR_PICK_RESULT)
|
startActivityForResult(intent, AVATAR_PICK_RESULT)
|
||||||
}
|
}
|
||||||
EditProfileActivity.PickType.HEADER -> {
|
PickType.HEADER -> {
|
||||||
startActivityForResult(intent, HEADER_PICK_RESULT)
|
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() {
|
private fun beginMediaPicking() {
|
||||||
when (currentlyPicking) {
|
when (currentlyPicking) {
|
||||||
EditProfileActivity.PickType.AVATAR -> {
|
PickType.AVATAR -> {
|
||||||
avatarProgressBar.visibility = View.VISIBLE
|
avatarProgressBar.visibility = View.VISIBLE
|
||||||
avatarPreview.visibility = View.INVISIBLE
|
avatarPreview.visibility = View.INVISIBLE
|
||||||
avatarButton.setImageDrawable(null)
|
avatarButton.setImageDrawable(null)
|
||||||
|
|
||||||
}
|
}
|
||||||
EditProfileActivity.PickType.HEADER -> {
|
PickType.HEADER -> {
|
||||||
headerProgressBar.visibility = View.VISIBLE
|
headerProgressBar.visibility = View.VISIBLE
|
||||||
headerPreview.visibility = View.INVISIBLE
|
headerPreview.visibility = View.INVISIBLE
|
||||||
headerButton.setImageDrawable(null)
|
headerButton.setImageDrawable(null)
|
||||||
}
|
}
|
||||||
EditProfileActivity.PickType.NOTHING -> { /* do nothing */ }
|
PickType.NOTHING -> { /* do nothing */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,10 +359,10 @@ class EditProfileActivity : BaseActivity(), Injectable {
|
||||||
beginMediaPicking()
|
beginMediaPicking()
|
||||||
|
|
||||||
when (currentlyPicking) {
|
when (currentlyPicking) {
|
||||||
EditProfileActivity.PickType.AVATAR -> {
|
PickType.AVATAR -> {
|
||||||
viewModel.newAvatar(uri, this)
|
viewModel.newAvatar(uri, this)
|
||||||
}
|
}
|
||||||
EditProfileActivity.PickType.HEADER -> {
|
PickType.HEADER -> {
|
||||||
viewModel.newHeader(uri, this)
|
viewModel.newHeader(uri, this)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|
|
@ -92,7 +92,7 @@ class FiltersActivity: BaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call<Filter>, t: Throwable) {
|
override fun onFailure(call: Call<Filter>, 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()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -598,7 +598,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
|
||||||
headerResult.setActiveProfile(accountManager.getActiveAccount().getId());
|
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());
|
Log.e(TAG, "Failed to fetch user info. " + exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ import dagger.android.DispatchingAndroidInjector;
|
||||||
import dagger.android.HasActivityInjector;
|
import dagger.android.HasActivityInjector;
|
||||||
import dagger.android.HasBroadcastReceiverInjector;
|
import dagger.android.HasBroadcastReceiverInjector;
|
||||||
import dagger.android.HasServiceInjector;
|
import dagger.android.HasServiceInjector;
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
|
|
||||||
public class TuskyApplication extends Application implements HasActivityInjector, HasServiceInjector, HasBroadcastReceiverInjector {
|
public class TuskyApplication extends Application implements HasActivityInjector, HasServiceInjector, HasBroadcastReceiverInjector {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -55,8 +54,6 @@ public class TuskyApplication extends Application implements HasActivityInjector
|
||||||
DispatchingAndroidInjector<BroadcastReceiver> dispatchingBroadcastReceiverInjector;
|
DispatchingAndroidInjector<BroadcastReceiver> dispatchingBroadcastReceiverInjector;
|
||||||
@Inject
|
@Inject
|
||||||
NotificationPullJobCreator notificationPullJobCreator;
|
NotificationPullJobCreator notificationPullJobCreator;
|
||||||
@Inject
|
|
||||||
OkHttpClient okHttpClient;
|
|
||||||
|
|
||||||
private AppDatabase appDatabase;
|
private AppDatabase appDatabase;
|
||||||
private AccountManager accountManager;
|
private AccountManager accountManager;
|
||||||
|
|
|
@ -35,12 +35,12 @@ class AccountFieldAdapter(private val linkListener: LinkListener) : RecyclerView
|
||||||
|
|
||||||
override fun getItemCount() = fields.size
|
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)
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_account_field, parent, false)
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(viewHolder: AccountFieldAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
|
||||||
val field = fields[position]
|
val field = fields[position]
|
||||||
viewHolder.nameTextView.text = field.name
|
viewHolder.nameTextView.text = field.name
|
||||||
val emojifiedValue = CustomEmojiHelper.emojifyText(field.value, emojis, viewHolder.valueTextView)
|
val emojifiedValue = CustomEmojiHelper.emojifyText(field.value, emojis, viewHolder.valueTextView)
|
||||||
|
|
|
@ -56,12 +56,12 @@ class AccountFieldEditAdapter : RecyclerView.Adapter<AccountFieldEditAdapter.Vie
|
||||||
|
|
||||||
override fun getItemCount(): Int = fieldData.size
|
override fun getItemCount(): Int = fieldData.size
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AccountFieldEditAdapter.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_edit_field, parent, false)
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_edit_field, parent, false)
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(viewHolder: AccountFieldEditAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
|
||||||
viewHolder.nameTextView.setText(fieldData[position].first)
|
viewHolder.nameTextView.setText(fieldData[position].first)
|
||||||
viewHolder.valueTextView.setText(fieldData[position].second)
|
viewHolder.valueTextView.setText(fieldData[position].second)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.keylesspalace.tusky.adapter;
|
package com.keylesspalace.tusky.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
|
@ -208,15 +208,15 @@ public class ComposeAutoCompleteAdapter extends BaseAdapter
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatUsername(AccountResult result) {
|
private static String formatUsername(AccountResult result) {
|
||||||
return String.format("@%s", result.account.getUsername());
|
return String.format("@%s", result.account.getUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatHashtag(HashtagResult result) {
|
private static String formatHashtag(HashtagResult result) {
|
||||||
return String.format("#%s", result.hashtag);
|
return String.format("#%s", result.hashtag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatEmoji(EmojiResult result) {
|
private static String formatEmoji(EmojiResult result) {
|
||||||
return String.format(":%s:", result.emoji.getShortcode());
|
return String.format(":%s:", result.emoji.getShortcode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ class EmojiAdapter(emojiList: List<Emoji>, private val onEmojiSelectedListener:
|
||||||
return emojiList.size
|
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
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_emoji_button, parent, false) as ImageView
|
||||||
return EmojiHolder(view)
|
return EmojiHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(viewHolder: EmojiAdapter.EmojiHolder, position: Int) {
|
override fun onBindViewHolder(viewHolder: EmojiHolder, position: Int) {
|
||||||
val emoji = emojiList[position]
|
val emoji = emojiList[position]
|
||||||
|
|
||||||
Glide.with(viewHolder.emojiImageView)
|
Glide.with(viewHolder.emojiImageView)
|
||||||
|
|
|
@ -17,7 +17,6 @@ package com.keylesspalace.tusky.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class ThreadAdapter extends RecyclerView.Adapter {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public StatusViewData.Concrete getItem(int position) {
|
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);
|
return statuses.get(position);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,7 +25,7 @@ data class Filter (
|
||||||
val irreversible: Boolean,
|
val irreversible: Boolean,
|
||||||
@SerializedName("whole_word") val wholeWord: Boolean
|
@SerializedName("whole_word") val wholeWord: Boolean
|
||||||
) {
|
) {
|
||||||
public companion object {
|
companion object {
|
||||||
const val HOME = "home"
|
const val HOME = "home"
|
||||||
const val NOTIFICATIONS = "notifications"
|
const val NOTIFICATIONS = "notifications"
|
||||||
const val PUBLIC = "public"
|
const val PUBLIC = "public"
|
||||||
|
|
|
@ -65,8 +65,8 @@ data class Notification(
|
||||||
class NotificationTypeAdapter : JsonDeserializer<Type> {
|
class NotificationTypeAdapter : JsonDeserializer<Type> {
|
||||||
|
|
||||||
@Throws(JsonParseException::class)
|
@Throws(JsonParseException::class)
|
||||||
override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Notification.Type {
|
override fun deserialize(json: JsonElement, typeOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Type {
|
||||||
return Notification.Type.byString(json.asString)
|
return Type.byString(json.asString)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import androidx.core.view.ViewCompat
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.ViewMediaActivity
|
import com.keylesspalace.tusky.ViewMediaActivity
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
|
@ -234,9 +233,8 @@ class AccountMediaFragment : BaseFragment(), Injectable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun viewMedia(items: List<AttachmentViewData>, currentIndex: Int, view: View?) {
|
private fun viewMedia(items: List<AttachmentViewData>, currentIndex: Int, view: View?) {
|
||||||
val type = items[currentIndex].attachment.type
|
|
||||||
|
|
||||||
when (type) {
|
when (items[currentIndex].attachment.type) {
|
||||||
Attachment.Type.IMAGE,
|
Attachment.Type.IMAGE,
|
||||||
Attachment.Type.GIFV,
|
Attachment.Type.GIFV,
|
||||||
Attachment.Type.VIDEO -> {
|
Attachment.Type.VIDEO -> {
|
||||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.ProgressBar;
|
||||||
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
|
||||||
import com.keylesspalace.tusky.R;
|
import com.keylesspalace.tusky.R;
|
||||||
import com.keylesspalace.tusky.adapter.NotificationsAdapter;
|
import com.keylesspalace.tusky.adapter.NotificationsAdapter;
|
||||||
import com.keylesspalace.tusky.adapter.StatusBaseViewHolder;
|
import com.keylesspalace.tusky.adapter.StatusBaseViewHolder;
|
||||||
|
@ -154,7 +153,6 @@ public class NotificationsFragment extends SFragment implements
|
||||||
private LinearLayoutManager layoutManager;
|
private LinearLayoutManager layoutManager;
|
||||||
private EndlessOnScrollListener scrollListener;
|
private EndlessOnScrollListener scrollListener;
|
||||||
private NotificationsAdapter adapter;
|
private NotificationsAdapter adapter;
|
||||||
private TabLayout.OnTabSelectedListener onTabSelectedListener;
|
|
||||||
private Button buttonFilter;
|
private Button buttonFilter;
|
||||||
private boolean hideFab;
|
private boolean hideFab;
|
||||||
private boolean topLoading;
|
private boolean topLoading;
|
||||||
|
|
|
@ -84,13 +84,13 @@ class ViewVideoFragment : ViewMediaFragment() {
|
||||||
videoView.setOnPreparedListener { mp ->
|
videoView.setOnPreparedListener { mp ->
|
||||||
progressBar.hide()
|
progressBar.hide()
|
||||||
mp.isLooping = true
|
mp.isLooping = true
|
||||||
if (arguments!!.getBoolean(ViewMediaFragment.ARG_START_POSTPONED_TRANSITION)) {
|
if (arguments!!.getBoolean(ARG_START_POSTPONED_TRANSITION)) {
|
||||||
hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS)
|
hideToolbarAfterDelay(TOOLBAR_HIDE_DELAY_MS)
|
||||||
videoView.start()
|
videoView.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments!!.getBoolean(ViewMediaFragment.ARG_START_POSTPONED_TRANSITION)) {
|
if (arguments!!.getBoolean(ARG_START_POSTPONED_TRANSITION)) {
|
||||||
mediaActivity.onBringUp()
|
mediaActivity.onBringUp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class ViewVideoFragment : ViewMediaFragment() {
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
val attachment = arguments?.getParcelable<Attachment>(ViewMediaFragment.ARG_ATTACHMENT)
|
val attachment = arguments?.getParcelable<Attachment>(ARG_ATTACHMENT)
|
||||||
val url: String
|
val url: String
|
||||||
|
|
||||||
if (attachment == null) {
|
if (attachment == null) {
|
||||||
|
|
|
@ -273,7 +273,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
||||||
return drawable
|
return drawable
|
||||||
}
|
}
|
||||||
|
|
||||||
fun launchFilterActivity(filterContext: String, titleResource: Int): Boolean {
|
private fun launchFilterActivity(filterContext: String, titleResource: Int): Boolean {
|
||||||
val intent = Intent(context, FiltersActivity::class.java)
|
val intent = Intent(context, FiltersActivity::class.java)
|
||||||
intent.putExtra(FiltersActivity.FILTERS_CONTEXT, filterContext)
|
intent.putExtra(FiltersActivity.FILTERS_CONTEXT, filterContext)
|
||||||
intent.putExtra(FiltersActivity.FILTERS_TITLE, getString(titleResource))
|
intent.putExtra(FiltersActivity.FILTERS_TITLE, getString(titleResource))
|
||||||
|
|
|
@ -18,7 +18,6 @@ package com.keylesspalace.tusky.fragment.preference
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.preference.EditTextPreference
|
import androidx.preference.EditTextPreference
|
||||||
import androidx.preference.Preference
|
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class TimelineCasesImpl(
|
||||||
override fun block(id: String) {
|
override fun block(id: String) {
|
||||||
val call = mastodonApi.blockAccount(id)
|
val call = mastodonApi.blockAccount(id)
|
||||||
call.enqueue(object : Callback<Relationship> {
|
call.enqueue(object : Callback<Relationship> {
|
||||||
override fun onResponse(call: Call<Relationship>, response: retrofit2.Response<Relationship>) {}
|
override fun onResponse(call: Call<Relationship>, response: Response<Relationship>) {}
|
||||||
|
|
||||||
override fun onFailure(call: Call<Relationship>, t: Throwable) {}
|
override fun onFailure(call: Call<Relationship>, t: Throwable) {}
|
||||||
})
|
})
|
||||||
|
@ -100,7 +100,7 @@ class TimelineCasesImpl(
|
||||||
override fun delete(id: String) {
|
override fun delete(id: String) {
|
||||||
val call = mastodonApi.deleteStatus(id)
|
val call = mastodonApi.deleteStatus(id)
|
||||||
call.enqueue(object : Callback<ResponseBody> {
|
call.enqueue(object : Callback<ResponseBody> {
|
||||||
override fun onResponse(call: Call<ResponseBody>, response: retrofit2.Response<ResponseBody>) {}
|
override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {}
|
||||||
|
|
||||||
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {}
|
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {}
|
||||||
})
|
})
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class AccountPagerAdapter extends FragmentPagerAdapter {
|
||||||
pageTitles = titles;
|
pageTitles = titles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
|
|
|
@ -28,7 +28,6 @@ public class HtmlUtils {
|
||||||
return s.subSequence(0, i + 1);
|
return s.subSequence(0, i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static Spanned fromHtml(String html) {
|
public static Spanned fromHtml(String html) {
|
||||||
Spanned result;
|
Spanned result;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
@ -41,7 +40,6 @@ public class HtmlUtils {
|
||||||
return (Spanned) trimTrailingWhitespace(result);
|
return (Spanned) trimTrailingWhitespace(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static String toHtml(Spanned text) {
|
public static String toHtml(Spanned text) {
|
||||||
String result;
|
String result;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ package com.keylesspalace.tusky.util;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
|
@ -244,7 +244,6 @@ public class NotificationHelper {
|
||||||
|
|
||||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
|
||||||
notificationManager.notify(notificationId, builder.build());
|
notificationManager.notify(notificationId, builder.build());
|
||||||
if (currentNotifications.length() == 1) {
|
if (currentNotifications.length() == 1) {
|
||||||
notificationManager.notify((int) account.getId(), builder.setGroupSummary(true).build());
|
notificationManager.notify((int) account.getId(), builder.setGroupSummary(true).build());
|
||||||
|
@ -375,7 +374,6 @@ public class NotificationHelper {
|
||||||
channels.add(channel);
|
channels.add(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
|
||||||
notificationManager.createNotificationChannels(channels);
|
notificationManager.createNotificationChannels(channels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
/**
|
/**
|
||||||
* A helper class for {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}s and
|
* 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.
|
||||||
* <p>
|
* <p>
|
||||||
* It is designed to support 3 types of requests, {@link RequestType#INITIAL INITIAL},
|
* 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
|
* {@link RequestType#BEFORE BEFORE} and {@link RequestType#AFTER AFTER} and runs only 1 request
|
||||||
|
@ -456,18 +456,18 @@ public class PagingRequestHelper {
|
||||||
*/
|
*/
|
||||||
public enum RequestType {
|
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}.
|
* a {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}.
|
||||||
*/
|
*/
|
||||||
INITIAL,
|
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
|
* {@code onItemAtFrontLoaded} in
|
||||||
* {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}.
|
* {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}.
|
||||||
*/
|
*/
|
||||||
BEFORE,
|
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
|
* {@code onItemAtEndLoaded} in
|
||||||
* {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}.
|
* {@link androidx.paging.PagedList.BoundaryCallback BoundaryCallback}.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,10 +77,10 @@ defStyleAttr: Int = 0
|
||||||
* even if we have a focus point set.
|
* even if we have a focus point set.
|
||||||
*/
|
*/
|
||||||
override fun getScaleType(): ScaleType {
|
override fun getScaleType(): ScaleType {
|
||||||
if (focus != null) {
|
return if (focus != null) {
|
||||||
return ScaleType.CENTER_CROP
|
ScaleType.CENTER_CROP
|
||||||
} else {
|
} else {
|
||||||
return super.getScaleType()
|
super.getScaleType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,12 +194,10 @@ public class RoundedImageView extends AppCompatImageView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyColorFilter() {
|
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) {
|
if (drawable == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ public abstract class StatusViewData {
|
||||||
|
|
||||||
@Override public long getViewDataId() {
|
@Override public long getViewDataId() {
|
||||||
// Chance of collision is super low and impact of mistake is low as well
|
// 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) {
|
public boolean deepEquals(StatusViewData o) {
|
||||||
|
@ -311,7 +311,7 @@ public abstract class StatusViewData {
|
||||||
}
|
}
|
||||||
|
|
||||||
static CharSequence replaceCrashingCharacters(CharSequence content) {
|
static CharSequence replaceCrashingCharacters(CharSequence content) {
|
||||||
Boolean replacing = false;
|
boolean replacing = false;
|
||||||
SpannableStringBuilder builder = null;
|
SpannableStringBuilder builder = null;
|
||||||
int length = content.length();
|
int length = content.length();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ internal class ListsViewModel @Inject constructor(private val api: MastodonApi)
|
||||||
|
|
||||||
private fun loadIfNeeded() {
|
private fun loadIfNeeded() {
|
||||||
val state = _state.value!!
|
val state = _state.value!!
|
||||||
if (state.loadingState == LoadingState.LOADING || !state.lists.isEmpty()) return
|
if (state.loadingState == LoadingState.LOADING || state.lists.isNotEmpty()) return
|
||||||
updateState {
|
updateState {
|
||||||
copy(loadingState = LoadingState.LOADING)
|
copy(loadingState = LoadingState.LOADING)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<scale
|
<scale
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:duration="300"
|
android:duration="300"
|
||||||
android:fromXScale="0"
|
android:fromXScale="0"
|
||||||
android:fromYScale="0"
|
android:fromYScale="0"
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<corners android:radius="4dp" />
|
|
||||||
<solid android:color="?attr/window_background" />
|
|
||||||
</shape>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/filter_favourites"
|
|
||||||
android:checkable="true"
|
|
||||||
android:checked="true"
|
|
||||||
android:title="@string/filter_favorites" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/filter_boosts"
|
|
||||||
android:checkable="true"
|
|
||||||
android:checked="true"
|
|
||||||
android:title="@string/filter_boosts" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/filter_follows"
|
|
||||||
android:checkable="true"
|
|
||||||
android:checked="true"
|
|
||||||
android:title="@string/filter_follows" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/filter_mentions"
|
|
||||||
android:checkable="true"
|
|
||||||
android:checked="true"
|
|
||||||
android:title="@string/filter_mentions" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/filter_apply"
|
|
||||||
android:title="@string/filter_apply" />
|
|
||||||
</menu>
|
|
Loading…
Reference in a new issue