fix #29, allow scrolling notes

This commit is contained in:
tibbi 2016-11-21 20:13:19 +01:00
parent d38c77c3b1
commit f10cc1f3d4
2 changed files with 15 additions and 7 deletions

View File

@ -8,14 +8,16 @@ import android.widget.RadioGroup
import com.simplemobiletools.notes.Config import com.simplemobiletools.notes.Config
import com.simplemobiletools.notes.R import com.simplemobiletools.notes.R
import com.simplemobiletools.notes.databases.DBHelper import com.simplemobiletools.notes.databases.DBHelper
import kotlinx.android.synthetic.main.dialog_radio_group.view.*
class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListener { class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListener {
val dialog: AlertDialog? val dialog: AlertDialog?
init { init {
val config = Config.newInstance(activity) val config = Config.newInstance(activity)
val view = activity.layoutInflater.inflate(R.layout.dialog_radio_group, null) as RadioGroup val view = activity.layoutInflater.inflate(R.layout.dialog_radio_group, null)
view.setOnCheckedChangeListener(this) val radioGroup = view.dialog_radio_group
radioGroup.setOnCheckedChangeListener(this)
val notes = DBHelper.newInstance(activity).getNotes() val notes = DBHelper.newInstance(activity).getNotes()
notes.forEach { notes.forEach {
@ -25,7 +27,7 @@ class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListene
isChecked = it.id == config.currentNoteId isChecked = it.id == config.currentNoteId
id = it.id id = it.id
} }
view.addView(radioButton, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)) radioGroup.addView(radioButton, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
} }
dialog = AlertDialog.Builder(activity) dialog = AlertDialog.Builder(activity)

View File

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RadioGroup <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_radio_group" android:id="@+id/dialog_radio_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:padding="@dimen/activity_margin"/>
<RadioGroup
android:id="@+id/dialog_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/activity_margin"/>
</ScrollView>