fix some lint warnings and Kotlin style issues (#1390)
This commit is contained in:
parent
a46922bfde
commit
83f9638aaf
9 changed files with 10 additions and 42 deletions
|
@ -58,6 +58,7 @@ import kotlinx.android.synthetic.main.activity_account.*
|
|||
import kotlinx.android.synthetic.main.view_account_moved.*
|
||||
import java.text.NumberFormat
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.abs
|
||||
|
||||
class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector, LinkListener {
|
||||
|
||||
|
@ -272,7 +273,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
|||
|
||||
accountAvatarImageView.visible(scaledAvatarSize > 0)
|
||||
|
||||
var transparencyPercent = Math.abs(verticalOffset) / titleVisibleHeight.toFloat()
|
||||
var transparencyPercent = abs(verticalOffset) / titleVisibleHeight.toFloat()
|
||||
if (transparencyPercent > 1) transparencyPercent = 1f
|
||||
|
||||
window.statusBarColor = argbEvaluator.evaluate(transparencyPercent, statusBarColorTransparent, statusBarColorOpaque) as Int
|
||||
|
|
|
@ -41,7 +41,7 @@ class ConversationAdapter(private val useAbsoluteTime: Boolean,
|
|||
override fun onChanged(position: Int, count: Int, payload: Any?) {
|
||||
notifyItemRangeChanged(position, count, payload)
|
||||
}
|
||||
}, AsyncDifferConfig.Builder<ConversationEntity>(CONVERSATION_COMPARATOR).build())
|
||||
}, AsyncDifferConfig.Builder(CONVERSATION_COMPARATOR).build())
|
||||
|
||||
fun submitList(list: PagedList<ConversationEntity>) {
|
||||
differ.submitList(list)
|
||||
|
|
|
@ -18,11 +18,9 @@ package com.keylesspalace.tusky.components.conversation
|
|||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.paging.PagedList
|
||||
|
@ -36,15 +34,11 @@ import com.keylesspalace.tusky.db.AppDatabase
|
|||
import com.keylesspalace.tusky.di.Injectable
|
||||
import com.keylesspalace.tusky.di.ViewModelFactory
|
||||
import com.keylesspalace.tusky.fragment.SFragment
|
||||
import com.keylesspalace.tusky.fragment.SearchFragment
|
||||
import com.keylesspalace.tusky.interfaces.ReselectableFragment
|
||||
import com.keylesspalace.tusky.interfaces.StatusActionListener
|
||||
import com.keylesspalace.tusky.util.NetworkState
|
||||
import com.keylesspalace.tusky.util.ThemeUtils
|
||||
import com.keylesspalace.tusky.util.hide
|
||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
|
||||
import com.uber.autodispose.autoDisposable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import kotlinx.android.synthetic.main.fragment_timeline.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.os.Bundle
|
|||
import androidx.preference.EditTextPreference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.keylesspalace.tusky.R
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
class ProxyPreferencesFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
|
@ -50,7 +51,7 @@ class ProxyPreferencesFragment : PreferenceFragmentCompat(), SharedPreferences.O
|
|||
|
||||
if (pendingRestart) {
|
||||
pendingRestart = false
|
||||
System.exit(0)
|
||||
exitProcess(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.keylesspalace.tusky.entity.Status
|
|||
import com.keylesspalace.tusky.service.SendTootService
|
||||
import com.keylesspalace.tusky.util.NotificationHelper
|
||||
import dagger.android.AndroidInjection
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
private const val TAG = "SendStatusBR"
|
||||
|
@ -128,7 +127,7 @@ class SendStatusBroadcastReceiver : BroadcastReceiver() {
|
|||
.inReplyToId(citedStatusId)
|
||||
.replyVisibility(visibility)
|
||||
.contentWarning(spoiler)
|
||||
.mentionedUsernames(Arrays.asList(*mentions))
|
||||
.mentionedUsernames(mentions.toList())
|
||||
.replyingStatusAuthor(localAuthorId)
|
||||
.replyingStatusContent(citedText)
|
||||
.build(context)
|
||||
|
|
|
@ -159,7 +159,7 @@ class ListStatusAccessibilityDelegate(
|
|||
val textLinks = links.map { item -> item.link }
|
||||
AlertDialog.Builder(host.context)
|
||||
.setTitle(R.string.title_links_dialog)
|
||||
.setAdapter(ArrayAdapter<String>(
|
||||
.setAdapter(ArrayAdapter(
|
||||
host.context,
|
||||
android.R.layout.simple_list_item_1,
|
||||
textLinks)
|
||||
|
@ -188,7 +188,7 @@ class ListStatusAccessibilityDelegate(
|
|||
val tags = getHashtags(status).map { it.subSequence(1, it.length) }.toList()
|
||||
AlertDialog.Builder(host.context)
|
||||
.setTitle(R.string.title_hashtags_dialog)
|
||||
.setAdapter(ArrayAdapter<CharSequence>(host.context,
|
||||
.setAdapter(ArrayAdapter(host.context,
|
||||
android.R.layout.simple_list_item_1, tags)
|
||||
) { _, which ->
|
||||
statusActionListener.onViewTag(tags[which].toString())
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.text.style.CharacterStyle
|
|||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.URLSpan
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* @see <a href="https://github.com/tootsuite/mastodon/blob/master/app/models/tag.rb">
|
||||
|
@ -68,7 +69,7 @@ private fun findPattern(string: String, fromIndex: Int): FindCharsResult {
|
|||
&& ((i - fromIndex) < finder.searchPrefixWidth ||
|
||||
Character.isWhitespace(string.codePointAt(i - finder.searchPrefixWidth)))) {
|
||||
result.matchType = matchType
|
||||
result.start = Math.max(0, i - finder.searchPrefixWidth)
|
||||
result.start = max(0, i - finder.searchPrefixWidth)
|
||||
findEndOfPattern(string, result, finder.pattern)
|
||||
if (result.start + finder.searchPrefixWidth <= i + 1 && // The found result is actually triggered by the correct search character
|
||||
result.end >= result.start) { // ...and we actually found a valid result
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/activity_instance_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.keylesspalace.tusky.InstanceListActivity">
|
||||
|
||||
<include layout="@layout/toolbar_basic" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_report"
|
||||
android:title="@string/action_report"
|
||||
android:icon="@drawable/ic_send_24dp"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
Loading…
Reference in a new issue