Skip to content
Snippets Groups Projects
Commit b8a8050e authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fix lint issues, correctly sort messages

parent 4d43cc69
No related branches found
No related tags found
No related merge requests found
Showing
with 123 additions and 124 deletions
...@@ -49,6 +49,8 @@ android { ...@@ -49,6 +49,8 @@ android {
setProperty("archivesBaseName", "QuasselDroidNG-$versionName") setProperty("archivesBaseName", "QuasselDroidNG-$versionName")
multiDexEnabled = false
// Disable test runner analytics // Disable test runner analytics
testInstrumentationRunnerArguments = mapOf( testInstrumentationRunnerArguments = mapOf(
"disableAnalytics" to "true" "disableAnalytics" to "true"
...@@ -80,6 +82,10 @@ android { ...@@ -80,6 +82,10 @@ android {
) )
} }
} }
lintOptions {
disable("ResourceType")
}
} }
dependencies { dependencies {
......
...@@ -81,7 +81,7 @@ class ToolbarFragment : ServiceBoundFragment() { ...@@ -81,7 +81,7 @@ class ToolbarFragment : ServiceBoundFragment() {
this.subtitle = colorizeDescription(data?.description) this.subtitle = colorizeDescription(data?.description)
} else { } else {
val description = colorizeDescription(data?.description) val description = colorizeDescription(data?.description)
if (description.isNullOrBlank()) { if (description.isBlank()) {
this.subtitle = "Lag: ${lag}ms" this.subtitle = "Lag: ${lag}ms"
} else { } else {
this.subtitle = SpanFormatter.format( this.subtitle = SpanFormatter.format(
...@@ -101,5 +101,4 @@ class ToolbarFragment : ServiceBoundFragment() { ...@@ -101,5 +101,4 @@ class ToolbarFragment : ServiceBoundFragment() {
private fun colorizeDescription(description: String?) = ircFormatDeserializer.formatString( private fun colorizeDescription(description: String?) = ircFormatDeserializer.formatString(
requireContext(), description, appearanceSettings.colorizeMirc requireContext(), description, appearanceSettings.colorizeMirc
) )
?: description
} }
\ No newline at end of file
...@@ -88,8 +88,8 @@ class FormatHandler( ...@@ -88,8 +88,8 @@ class FormatHandler(
return return
val exists = editText.text.removeSpans<UnderlineSpan, IrcUnderlineSpan>(range) { span -> val exists = editText.text.removeSpans<UnderlineSpan, IrcUnderlineSpan>(range) { span ->
when { when (span) {
span is IrcUnderlineSpan -> span is IrcUnderlineSpan -> span
else -> IrcUnderlineSpan() else -> IrcUnderlineSpan()
} }
} }
...@@ -106,8 +106,8 @@ class FormatHandler( ...@@ -106,8 +106,8 @@ class FormatHandler(
return return
val exists = editText.text.removeSpans<StrikethroughSpan, IrcStrikethroughSpan>(range) { span -> val exists = editText.text.removeSpans<StrikethroughSpan, IrcStrikethroughSpan>(range) { span ->
when { when (span) {
span is IrcStrikethroughSpan -> span is IrcStrikethroughSpan -> span
else -> IrcStrikethroughSpan() else -> IrcStrikethroughSpan()
} }
} }
......
...@@ -82,7 +82,7 @@ class NickListAdapter( ...@@ -82,7 +82,7 @@ class NickListAdapter(
} }
companion object { companion object {
val VIEWTYPE_ACTIVE = 0 const val VIEWTYPE_ACTIVE = 0
val VIEWTYPE_AWAY = 1 const val VIEWTYPE_AWAY = 1
} }
} }
\ No newline at end of file
...@@ -54,7 +54,7 @@ abstract class SetupActivity : DaggerAppCompatActivity() { ...@@ -54,7 +54,7 @@ abstract class SetupActivity : DaggerAppCompatActivity() {
override fun onPageSelected(position: Int) = Unit override fun onPageSelected(position: Int) = Unit
} }
private val pageChangeListener = SetupActivityViewPagerPageChangeListener(this) private lateinit var pageChangeListener: SetupActivityViewPagerPageChangeListener
private fun pageChanged() { private fun pageChanged() {
currentPage.value = adapter.getItem(viewPager.currentItem) currentPage.value = adapter.getItem(viewPager.currentItem)
...@@ -84,6 +84,8 @@ abstract class SetupActivity : DaggerAppCompatActivity() { ...@@ -84,6 +84,8 @@ abstract class SetupActivity : DaggerAppCompatActivity() {
fragments.forEach(adapter::addFragment) fragments.forEach(adapter::addFragment)
viewPager.adapter = adapter viewPager.adapter = adapter
pageChangeListener = SetupActivityViewPagerPageChangeListener(this)
button.setOnClickListener { button.setOnClickListener {
if (viewPager.currentItem == adapter.totalCount - 1) if (viewPager.currentItem == adapter.totalCount - 1)
onDoneInternal() onDoneInternal()
......
...@@ -83,7 +83,7 @@ class QuasseldroidNotificationManager(private val context: Context) { ...@@ -83,7 +83,7 @@ class QuasseldroidNotificationManager(private val context: Context) {
} }
companion object { companion object {
val BACKGROUND_NOTIFICATION_ID = Int.MAX_VALUE const val BACKGROUND_NOTIFICATION_ID = Int.MAX_VALUE
} }
data class Handle( data class Handle(
......
...@@ -61,6 +61,6 @@ class ReadableWrappedChannel( ...@@ -61,6 +61,6 @@ class ReadableWrappedChannel(
override fun implCloseChannel() = backingStream.close() override fun implCloseChannel() = backingStream.close()
companion object { companion object {
private val PAGE_SIZE = 8192 private const val PAGE_SIZE = 8192
} }
} }
...@@ -48,6 +48,6 @@ class WritableWrappedChannel( ...@@ -48,6 +48,6 @@ class WritableWrappedChannel(
override fun implCloseChannel() = backingStream.close() override fun implCloseChannel() = backingStream.close()
companion object { companion object {
private val PAGE_SIZE = 8192 private const val PAGE_SIZE = 8192
} }
} }
...@@ -28,7 +28,7 @@ private class DelimitedRangesSequence( ...@@ -28,7 +28,7 @@ private class DelimitedRangesSequence(
nextSearchIndex = -1 nextSearchIndex = -1
} else { } else {
val (index, length) = match val (index, length) = match
nextItem = currentStartIndex..index - 1 nextItem = currentStartIndex until index
currentStartIndex = index + length currentStartIndex = index + length
nextSearchIndex = currentStartIndex + if (length == 0) 1 else 0 nextSearchIndex = currentStartIndex + if (length == 0) 1 else 0
} }
......
...@@ -96,12 +96,12 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -96,12 +96,12 @@ class IrcFormatDeserializer @Inject constructor() {
normalCount = 0 normalCount = 0
// If there is an element on stack with the same code, close it // If there is an element on stack with the same code, close it
if (bold != null) { bold = if (bold != null) {
if (colorize) bold.apply(plainText, plainText.length) if (colorize) bold.apply(plainText, plainText.length)
bold = null null
// Otherwise create a new one // Otherwise create a new one
} else { } else {
bold = FormatDescription(plainText.length, BoldIrcFormat()) FormatDescription(plainText.length, BoldIrcFormat())
} }
} }
CODE_ITALIC -> { CODE_ITALIC -> {
...@@ -109,12 +109,12 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -109,12 +109,12 @@ class IrcFormatDeserializer @Inject constructor() {
normalCount = 0 normalCount = 0
// If there is an element on stack with the same code, close it // If there is an element on stack with the same code, close it
if (italic != null) { italic = if (italic != null) {
if (colorize) italic.apply(plainText, plainText.length) if (colorize) italic.apply(plainText, plainText.length)
italic = null null
// Otherwise create a new one // Otherwise create a new one
} else { } else {
italic = FormatDescription(plainText.length, ItalicIrcFormat()) FormatDescription(plainText.length, ItalicIrcFormat())
} }
} }
CODE_UNDERLINE -> { CODE_UNDERLINE -> {
...@@ -122,12 +122,12 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -122,12 +122,12 @@ class IrcFormatDeserializer @Inject constructor() {
normalCount = 0 normalCount = 0
// If there is an element on stack with the same code, close it // If there is an element on stack with the same code, close it
if (underline != null) { underline = if (underline != null) {
if (colorize) underline.apply(plainText, plainText.length) if (colorize) underline.apply(plainText, plainText.length)
underline = null null
// Otherwise create a new one // Otherwise create a new one
} else { } else {
underline = FormatDescription(plainText.length, UnderlineIrcFormat()) FormatDescription(plainText.length, UnderlineIrcFormat())
} }
} }
CODE_STRIKETHROUGH -> { CODE_STRIKETHROUGH -> {
...@@ -135,12 +135,12 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -135,12 +135,12 @@ class IrcFormatDeserializer @Inject constructor() {
normalCount = 0 normalCount = 0
// If there is an element on stack with the same code, close it // If there is an element on stack with the same code, close it
if (strikethrough != null) { strikethrough = if (strikethrough != null) {
if (colorize) strikethrough.apply(plainText, plainText.length) if (colorize) strikethrough.apply(plainText, plainText.length)
strikethrough = null null
// Otherwise create a new one // Otherwise create a new one
} else { } else {
strikethrough = FormatDescription(plainText.length, StrikethroughIrcFormat()) FormatDescription(plainText.length, StrikethroughIrcFormat())
} }
} }
CODE_MONOSPACE -> { CODE_MONOSPACE -> {
...@@ -148,12 +148,12 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -148,12 +148,12 @@ class IrcFormatDeserializer @Inject constructor() {
normalCount = 0 normalCount = 0
// If there is an element on stack with the same code, close it // If there is an element on stack with the same code, close it
if (monospace != null) { monospace = if (monospace != null) {
if (colorize) monospace.apply(plainText, plainText.length) if (colorize) monospace.apply(plainText, plainText.length)
monospace = null null
// Otherwise create a new one // Otherwise create a new one
} else { } else {
monospace = FormatDescription(plainText.length, MonospaceIrcFormat()) FormatDescription(plainText.length, MonospaceIrcFormat())
} }
} }
CODE_COLOR -> { CODE_COLOR -> {
...@@ -308,7 +308,7 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -308,7 +308,7 @@ class IrcFormatDeserializer @Inject constructor() {
fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int) fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int)
} }
private class FormatDescription<U : IrcFormat>(val start: Int, val format: U) { private class FormatDescription<out U : IrcFormat>(val start: Int, val format: U) {
fun apply(editable: SpannableStringBuilder, end: Int) { fun apply(editable: SpannableStringBuilder, end: Int) {
format.applyTo(editable, start, end) format.applyTo(editable, start, end)
...@@ -387,15 +387,15 @@ class IrcFormatDeserializer @Inject constructor() { ...@@ -387,15 +387,15 @@ class IrcFormatDeserializer @Inject constructor() {
} }
companion object { companion object {
val CODE_BOLD = 0x02.toChar() private const val CODE_BOLD = 0x02.toChar()
val CODE_COLOR = 0x03.toChar() private const val CODE_COLOR = 0x03.toChar()
val CODE_HEXCOLOR = 0x04.toChar() private const val CODE_HEXCOLOR = 0x04.toChar()
val CODE_ITALIC = 0x1D.toChar() private const val CODE_ITALIC = 0x1D.toChar()
val CODE_UNDERLINE = 0x1F.toChar() private const val CODE_UNDERLINE = 0x1F.toChar()
val CODE_STRIKETHROUGH = 0x1E.toChar() private const val CODE_STRIKETHROUGH = 0x1E.toChar()
val CODE_MONOSPACE = 0x11.toChar() private const val CODE_MONOSPACE = 0x11.toChar()
val CODE_SWAP = 0x16.toChar() private const val CODE_SWAP = 0x16.toChar()
val CODE_RESET = 0x0F.toChar() private const val CODE_RESET = 0x0F.toChar()
/** /**
* Try to read a number from a String in specified bounds * Try to read a number from a String in specified bounds
......
...@@ -209,14 +209,14 @@ class IrcFormatSerializer @Inject constructor(private val context: Context) { ...@@ -209,14 +209,14 @@ class IrcFormatSerializer @Inject constructor(private val context: Context) {
} }
companion object { companion object {
val CODE_BOLD: Char = 0x02.toChar() private const val CODE_BOLD: Char = 0x02.toChar()
val CODE_COLOR: Char = 0x03.toChar() private const val CODE_COLOR: Char = 0x03.toChar()
val CODE_HEXCOLOR = 0x04.toChar() private const val CODE_HEXCOLOR = 0x04.toChar()
val CODE_ITALIC: Char = 0x1D.toChar() private const val CODE_ITALIC: Char = 0x1D.toChar()
val CODE_UNDERLINE: Char = 0x1F.toChar() private const val CODE_UNDERLINE: Char = 0x1F.toChar()
val CODE_STRIKETHROUGH = 0x1E.toChar() private const val CODE_STRIKETHROUGH = 0x1E.toChar()
val CODE_MONOSPACE = 0x11.toChar() private const val CODE_MONOSPACE = 0x11.toChar()
val CODE_SWAP: Char = 0x16.toChar() private const val CODE_SWAP: Char = 0x16.toChar()
val CODE_RESET: Char = 0x0F.toChar() private const val CODE_RESET: Char = 0x0F.toChar()
} }
} }
...@@ -39,19 +39,19 @@ object IrcUserUtils { ...@@ -39,19 +39,19 @@ object IrcUserUtils {
startIndex: Int? = null, startIndex: Int? = null,
ignoreCase: Boolean = false): Int? { ignoreCase: Boolean = false): Int? {
val lastIndex = indexOf(char, startIndex ?: 0, ignoreCase) val lastIndex = indexOf(char, startIndex ?: 0, ignoreCase)
if (lastIndex < 0) return if (lastIndex < 0)
return null null
else else
return lastIndex lastIndex
} }
private fun String.lastIndex(char: Char, private fun String.lastIndex(char: Char,
startIndex: Int? = null, startIndex: Int? = null,
ignoreCase: Boolean = false): Int? { ignoreCase: Boolean = false): Int? =
val lastIndex = lastIndexOf(char, startIndex ?: lastIndex, ignoreCase) lastIndexOf(char, startIndex ?: lastIndex, ignoreCase).let { lastIndex ->
if (lastIndex < 0) if (lastIndex < 0)
return null null
else else
return lastIndex lastIndex
} }
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ import de.kuschku.quasseldroid.R ...@@ -16,7 +16,7 @@ import de.kuschku.quasseldroid.R
* *
* @hide * @hide
*/ */
class ContextThemeWrapper : ContextWrapper { open class ContextThemeWrapper : ContextWrapper {
var themeResId: Int = 0 var themeResId: Int = 0
private set private set
private var mTheme: Resources.Theme? = null private var mTheme: Resources.Theme? = null
...@@ -70,10 +70,6 @@ class ContextThemeWrapper : ContextWrapper { ...@@ -70,10 +70,6 @@ class ContextThemeWrapper : ContextWrapper {
mTheme = theme mTheme = theme
} }
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(newBase)
}
/** /**
* Call to set an "override configuration" on this context -- this is * Call to set an "override configuration" on this context -- this is
* a configuration that replies one or more values of the standard * a configuration that replies one or more values of the standard
......
...@@ -22,10 +22,10 @@ class DrawerRecyclerView @JvmOverloads constructor( ...@@ -22,10 +22,10 @@ class DrawerRecyclerView @JvmOverloads constructor(
init { init {
val a = context.obtainStyledAttributes( val a = context.obtainStyledAttributes(
attrs, attrs,
R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.styleable.DrawerRecyclerView, defStyleAttr,
R.style.Widget_Design_ScrimInsetsFrameLayout R.style.Widget_DrawerRecyclerView
) )
mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground) mInsetForeground = a.getDrawable(R.styleable.DrawerRecyclerView_insetBackground)
a.recycle() a.recycle()
setWillNotDraw(true) // No need to draw until the insets are adjusted setWillNotDraw(true) // No need to draw until the insets are adjusted
ViewCompat.setOnApplyWindowInsetsListener( ViewCompat.setOnApplyWindowInsetsListener(
......
...@@ -105,7 +105,7 @@ class MaterialContentLoadingProgressBar @JvmOverloads constructor(context: Conte ...@@ -105,7 +105,7 @@ class MaterialContentLoadingProgressBar @JvmOverloads constructor(context: Conte
} }
companion object { companion object {
private val MIN_SHOW_TIME = 500 // ms private const val MIN_SHOW_TIME = 500 // ms
private val MIN_DELAY = 500 // ms private const val MIN_DELAY = 500 // ms
} }
} }
...@@ -37,10 +37,10 @@ class NavigationDrawerLayout @JvmOverloads constructor( ...@@ -37,10 +37,10 @@ class NavigationDrawerLayout @JvmOverloads constructor(
init { init {
val a = context.obtainStyledAttributes( val a = context.obtainStyledAttributes(
attrs, attrs,
R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.styleable.NavigationDrawerLayout, defStyleAttr,
R.style.Widget_Design_ScrimInsetsFrameLayout R.style.Widget_NavigationDrawerLayout
) )
mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground) mInsetForeground = a.getDrawable(R.styleable.NavigationDrawerLayout_insetBackground)
a.recycle() a.recycle()
setWillNotDraw(true) // No need to draw until the insets are adjusted setWillNotDraw(true) // No need to draw until the insets are adjusted
ViewCompat.setOnApplyWindowInsetsListener( ViewCompat.setOnApplyWindowInsetsListener(
......
<!-- drawable/format_strikethrough_variant.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
android:layout_gravity="start" android:layout_gravity="start"
android:background="?attr/colorBackground" android:background="?attr/colorBackground"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:insetForeground="?attr/colorPrimaryDark"> app:insetBackground="?attr/colorPrimaryDark">
<fragment <fragment
android:id="@+id/fragment_chat_list" android:id="@+id/fragment_chat_list"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card_panel" android:id="@+id/card_panel"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v7.widget.CardView
style="?attr/cardStyle" style="?attr/cardStyle"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
...@@ -38,15 +34,15 @@ ...@@ -38,15 +34,15 @@
android:textColor="?attr/colorForegroundSecondary" /> android:textColor="?attr/colorForegroundSecondary" />
<android.support.v7.widget.AppCompatImageView <android.support.v7.widget.AppCompatImageView
android:id="@+id/send" android:id="@+id/close"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="top" android:layout_gravity="top"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp" android:padding="12dp"
android:scaleType="fitXY" android:scaleType="fitXY"
app:tint="?attr/colorForegroundSecondary" app:srcCompat="@drawable/ic_close"
app:srcCompat="@drawable/ic_close" /> app:tint="?attr/colorForegroundSecondary" />
</LinearLayout> </LinearLayout>
...@@ -59,5 +55,3 @@ ...@@ -59,5 +55,3 @@
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
\ No newline at end of file
</FrameLayout>
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingRight" android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingRight="?android:attr/listPreferredItemPaddingRight" android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:baselineAligned="false"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"> android:paddingStart="?android:attr/listPreferredItemPaddingLeft">
<FrameLayout <FrameLayout
...@@ -38,6 +39,8 @@ ...@@ -38,6 +39,8 @@
android:minWidth="60dp" android:minWidth="60dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingLeft="0dp"
android:paddingStart="0dp"
android:paddingEnd="12dp" android:paddingEnd="12dp"
android:paddingRight="12dp" android:paddingRight="12dp"
android:paddingTop="4dp"> android:paddingTop="4dp">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment