fix #75, wrap the notes in a scrollview

This commit is contained in:
tibbi 2017-04-01 19:27:20 +02:00
parent 8148107ed4
commit db256dbbb0
3 changed files with 18 additions and 8 deletions

View File

@ -32,7 +32,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.13.7'
compile 'com.simplemobiletools:commons:2.15.0'
compile 'com.facebook.stetho:stetho:1.4.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

View File

@ -5,7 +5,6 @@ import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.support.v7.app.AlertDialog
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RadioGroup
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.setupDialogStuff
@ -13,17 +12,14 @@ import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.notes.R
import com.simplemobiletools.notes.extensions.config
import com.simplemobiletools.notes.helpers.DBHelper
import kotlinx.android.synthetic.main.dialog_open_note.view.*
import kotlinx.android.synthetic.main.open_note_item.view.*
class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> Unit) {
lateinit var dialog: AlertDialog
init {
val view = LinearLayout(activity).apply {
orientation = LinearLayout.VERTICAL
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
val view = activity.layoutInflater.inflate(R.layout.dialog_open_note, null)
val textColor = activity.config.textColor
val notes = DBHelper.newInstance(activity).getNotes()
notes.forEach {
@ -46,7 +42,7 @@ class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> U
activity.toast(note.path)
}
}
view.addView(this, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
view.dialog_open_note_linear.addView(this, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_open_note_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/dialog_open_note_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>