Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • ChenZhangg-Modify_GRADLE_1
  • attachments
  • demo-jump-in-history
  • jetpack-compose-rewrite
  • main
  • wip
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.5.0
  • 1.5.1
  • 1.5.2
  • 1.5.3
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.7.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v1.0.0
  • v1.0.1
  • v1.0.10
  • v1.0.11
  • v1.0.12
  • v1.0.13
  • v1.0.14
  • v1.0.15
  • v1.0.16
  • v1.0.17
  • v1.0.18
  • v1.0.19
  • v1.0.2
  • v1.0.20
  • v1.0.21
  • v1.0.22
  • v1.0.23
  • v1.0.25
  • v1.0.26
  • v1.0.27
  • v1.0.28
  • v1.0.29
  • v1.0.3
  • v1.0.31
  • v1.0.35
  • v1.0.36
  • v1.0.37
  • v1.0.38
  • v1.0.39
  • v1.0.4
  • v1.0.40
  • v1.0.41
  • v1.0.42
  • v1.0.43
  • v1.0.44
  • v1.0.45
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.12
  • v1.2.13
  • v1.2.14
  • v1.2.15
  • v1.2.16
  • v1.2.17
  • v1.2.18
  • v1.2.19
  • v1.2.2
  • v1.2.20
  • v1.2.21
  • v1.2.22
  • v1.2.23
  • v1.2.24
  • v1.2.25
  • v1.2.26
  • v1.2.27
  • v1.2.28
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.9
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
100 results

Target

Select target project
  • justJanne/QuasselDroid-ng
1 result
Select Git revision
  • ChenZhangg-Modify_GRADLE_1
  • attachments
  • demo-jump-in-history
  • jetpack-compose-rewrite
  • main
  • wip
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.5.0
  • 1.5.1
  • 1.5.2
  • 1.5.3
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.7.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v1.0.0
  • v1.0.1
  • v1.0.10
  • v1.0.11
  • v1.0.12
  • v1.0.13
  • v1.0.14
  • v1.0.15
  • v1.0.16
  • v1.0.17
  • v1.0.18
  • v1.0.19
  • v1.0.2
  • v1.0.20
  • v1.0.21
  • v1.0.22
  • v1.0.23
  • v1.0.25
  • v1.0.26
  • v1.0.27
  • v1.0.28
  • v1.0.29
  • v1.0.3
  • v1.0.31
  • v1.0.35
  • v1.0.36
  • v1.0.37
  • v1.0.38
  • v1.0.39
  • v1.0.4
  • v1.0.40
  • v1.0.41
  • v1.0.42
  • v1.0.43
  • v1.0.44
  • v1.0.45
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.12
  • v1.2.13
  • v1.2.14
  • v1.2.15
  • v1.2.16
  • v1.2.17
  • v1.2.18
  • v1.2.19
  • v1.2.2
  • v1.2.20
  • v1.2.21
  • v1.2.22
  • v1.2.23
  • v1.2.24
  • v1.2.25
  • v1.2.26
  • v1.2.27
  • v1.2.28
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.9
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
100 results
Show changes
Commits on Source (5)
......@@ -105,7 +105,7 @@ dependencies {
implementation(kotlin("stdlib", "1.3.41"))
// App Compat
implementation("com.google.android.material", "material", "1.1.0-alpha07")
implementation("com.google.android.material", "material", "1.1.0-alpha09")
implementation("androidx.appcompat", "appcompat", "1.0.2")
implementation("androidx.browser", "browser", "1.0.0")
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2019 Janne Mareike Koschinski
* Copyright (c) 2019 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.quasseldroid.util.ui
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.core.widget.NestedScrollView
class FixedNestingScrollView : NestedScrollView {
constructor(context: Context) :
super(context)
constructor(context: Context, attrs: AttributeSet?) :
super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
super(context, attrs, defStyleAttr)
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
if (!canScrollVertically(-1))
return false
return super.onInterceptTouchEvent(ev)
}
}
......@@ -31,9 +31,10 @@
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/tab_complete"
......@@ -50,15 +51,11 @@
app:srcCompat="@drawable/ic_tab"
app:tint="?attr/colorTextSecondary" />
<ScrollView
<de.kuschku.quasseldroid.util.ui.FixedNestingScrollView
android:id="@+id/chatline_scroller"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/send"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/tab_complete"
app:layout_constraintTop_toTopOf="parent">
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1">
<de.kuschku.quasseldroid.ui.chat.input.RichEditText
android:id="@+id/chatline"
......@@ -77,7 +74,7 @@
android:paddingBottom="8dp"
android:textColor="?attr/colorForeground"
android:textSize="16sp" />
</ScrollView>
</de.kuschku.quasseldroid.util.ui.FixedNestingScrollView>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/send"
......@@ -95,7 +92,7 @@
app:srcCompat="@drawable/ic_send"
app:tint="?attr/colorAccent"
tools:ignore="UnusedAttribute" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/autocomplete_list"
......
......@@ -183,4 +183,7 @@
<string name="preference_show_notification_title">Mostra notifica</string>
<string name="preference_show_notification_summary">Mantiene Quasseldroid sempre collegato mostrando una notifica permanente</string>
<string name="preference_ignore_network_changes_title">Ignora cambi di rete</string>
<string name="preference_ignore_network_changes_summary">Interrompi la riconnessione automatica di Quasseldroid se la rete cambia</string>
</resources>
......@@ -200,5 +200,5 @@
<string name="info_copied_version">Version copied to clipboard</string>
<string name="advertisement_support_patreon">Please help support the development of this app on Patreon</string>
<string name="advertisement_support_button">Donate</string>
<string name="advertisement_support_button">Support development</string>
</resources>
......@@ -39,7 +39,7 @@ android {
lintOptions {
isWarningsAsErrors = true
setLintConfig(file("../lint.xml"))
lintConfig = file("../lint.xml")
}
}
......@@ -65,4 +65,6 @@ dependencies {
implementation(project(":lib")) {
exclude(group = "org.threeten", module = "threetenbp")
}
testImplementation("junit", "junit", "4.12")
}
......@@ -150,14 +150,12 @@ open class ChatViewModel : QuasselViewModel() {
)
}
private fun recentMessagesChange(value: Int) {
val current = recentlySentMessageIndex.safeValue
val size = recentlySentMessages.safeValue.size
val nextValue = current + value
recentlySentMessageIndex.onNext(
if (nextValue < 0) -1
else (size + current + value) % size
)
private fun recentMessagesChange(change: Int) {
recentlySentMessageIndex.onNext(recentMessagesChangeInternal(
recentlySentMessageIndex.safeValue,
recentlySentMessages.safeValue.size,
change
))
}
fun recentMessagesValue() =
......@@ -197,5 +195,9 @@ open class ChatViewModel : QuasselViewModel() {
const val KEY_SELECTED_BUFFER_ID = "model_chat_selectedBufferId"
const val MAX_RECENT_MESSAGES = 20
fun recentMessagesChangeInternal(current: Int, size: Int, change: Int) =
if (current + change < 0 || size == 0) -1
else (size + current + change) % size
}
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2019 Janne Mareike Koschinski
* Copyright (c) 2019 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.quasseldroid.viewmodel
import de.kuschku.quasseldroid.viewmodel.ChatViewModel.Companion.recentMessagesChangeInternal
import org.junit.Assert.assertEquals
import org.junit.Test
class ChatViewModelTest {
@Test
fun testRecentMessagesChange() {
assertEquals(recentMessagesChangeInternal(0, 0, -1), -1)
assertEquals(recentMessagesChangeInternal(0, 0, +1), -1)
assertEquals(recentMessagesChangeInternal(-1, 0, -1), -1)
assertEquals(recentMessagesChangeInternal(-1, 0, +1), -1)
assertEquals(recentMessagesChangeInternal(1, 0, -1), -1)
assertEquals(recentMessagesChangeInternal(1, 0, +1), -1)
assertEquals(recentMessagesChangeInternal(0, 5, -1), -1)
assertEquals(recentMessagesChangeInternal(0, 5, +1), 1)
assertEquals(recentMessagesChangeInternal(1, 5, -1), 0)
assertEquals(recentMessagesChangeInternal(1, 5, +1), 2)
assertEquals(recentMessagesChangeInternal(4, 5, -1), 3)
assertEquals(recentMessagesChangeInternal(4, 5, +1), 0)
}
}