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

Increase width of drag area at each side

parent 3b878e73
Branches
Tags 1.5.0
No related merge requests found
Pipeline #2559 failed
......@@ -91,6 +91,7 @@ import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer
import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog
import de.kuschku.quasseldroid.util.missingfeatures.RequiredFeatures
import de.kuschku.quasseldroid.util.service.ServiceBoundActivity
import de.kuschku.quasseldroid.util.setEdgeSize
import de.kuschku.quasseldroid.util.ui.DragInterceptBottomSheetBehavior
import de.kuschku.quasseldroid.util.ui.drawable.DrawerToggleActivityDrawable
import de.kuschku.quasseldroid.util.ui.drawable.NickCountDrawable
......@@ -293,6 +294,7 @@ class ChatActivity : ServiceBoundActivity(), SharedPreferences.OnSharedPreferenc
setSupportActionBar(binding.layoutMain.layoutToolbar.toolbar)
binding.drawerLayout.setEdgeSize(resources.getInteger(R.integer.drawer_edge_size))
chatViewModel.bufferOpened.toLiveData().observe(this, Observer {
actionMode?.finish()
if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 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
import androidx.customview.widget.ViewDragHelper
import androidx.drawerlayout.widget.DrawerLayout
fun DrawerLayout.setEdgeSize(edgeSize: Int) {
val leftDragger: ViewDragHelper = getField("mLeftDragger") ?: return
val rightDragger: ViewDragHelper = getField("mRightDragger") ?: return
val density = context.resources.displayMetrics.density
leftDragger.setField("mEdgeSize", (edgeSize * density + 0.5f).toInt())
rightDragger.setField("mEdgeSize", (edgeSize * density + 0.5f).toInt())
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 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
import java.lang.reflect.Field
inline fun <reified T, reified U> T.getField(fieldName: String): U? = try {
obtainField(fieldName)?.get(this) as? U
} catch (_: Throwable) {
null
}
inline fun <reified T, reified U> T.setField(fieldName: String, value: U) {
try {
obtainField(fieldName)?.set(this, value)
} catch (_: Throwable) {
}
}
inline fun <reified T> T.obtainField(fieldName: String): Field? = try {
val field = T::class.java.getDeclaredField(fieldName)
field.isAccessible = true
field
} catch (_: Throwable) {
null
}
......@@ -19,4 +19,5 @@
<resources>
<integer name="shortcut_image_size">432</integer>
<integer name="drawer_edge_size">96</integer>
</resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment