parent
19e85ed814
commit
d27034ddf3
@ -1,30 +0,0 @@ |
|||||||
package net.pokeranalytics.android.ui.view |
|
||||||
|
|
||||||
import android.text.InputType |
|
||||||
import io.realm.RealmResults |
|
||||||
|
|
||||||
/** |
|
||||||
* An interface to describe how an object can be editable and to handle the update of the object |
|
||||||
*/ |
|
||||||
interface RowEditable { |
|
||||||
/** |
|
||||||
* A list of [RowEditableDescriptor] object specifying the way the edition will be handled |
|
||||||
*/ |
|
||||||
fun rowEditableDescriptors(row: RowRepresentable): ArrayList<RowEditableDescriptor> |
|
||||||
|
|
||||||
/** |
|
||||||
* a method to handle the modification of the object. |
|
||||||
* Through [RowRepresentable] the object is able to update the right variable with the new value. |
|
||||||
*/ |
|
||||||
fun updateValue(value: Any?, row: RowRepresentable) |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* An container class to describe the way an field of an object will be edited |
|
||||||
*/ |
|
||||||
class RowEditableDescriptor( |
|
||||||
var defaultValue: Any? = null, |
|
||||||
var hint: Int? = null, |
|
||||||
var inputType: Int? = InputType.TYPE_CLASS_TEXT, |
|
||||||
var data: RealmResults<*>? = null |
|
||||||
) |
|
||||||
@ -0,0 +1,14 @@ |
|||||||
|
package net.pokeranalytics.android.ui.view |
||||||
|
|
||||||
|
import android.text.InputType |
||||||
|
import io.realm.RealmResults |
||||||
|
|
||||||
|
/** |
||||||
|
* An container class to describe the way an field of an object will be edited |
||||||
|
*/ |
||||||
|
class RowRepresentableEditDescriptor( |
||||||
|
var defaultValue: Any? = null, |
||||||
|
var hint: Int? = null, |
||||||
|
var inputType: Int? = InputType.TYPE_CLASS_TEXT, |
||||||
|
var data: RealmResults<*>? = null |
||||||
|
) |
||||||
@ -0,0 +1,64 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:id="@+id/rowTitleSwitch.container" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="?selectableItemBackground"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/rowTitleSwitch.title" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginTop="16dp" |
||||||
|
android:layout_marginBottom="16dp" |
||||||
|
android:textSize="16sp" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" |
||||||
|
app:layout_constraintStart_toStartOf="@+id/guidelineStart" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
tools:text="Data Type Title"/> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline |
||||||
|
android:id="@+id/guidelineStart" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layout_constraintGuide_begin="16dp"/> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline |
||||||
|
android:id="@+id/guidelineEnd" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layout_constraintGuide_end="16dp"/> |
||||||
|
<Switch |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:id="@+id/rowTitleSwitch.switch" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/rowTitleSwitch.title" |
||||||
|
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="356dp"/> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/rowTitleSwitch.separator" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="16dp" |
||||||
|
android:visibility="gone" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
tools:visibility="visible"> |
||||||
|
|
||||||
|
<View |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="1dp" |
||||||
|
android:layout_gravity="center" |
||||||
|
android:layout_marginStart="16dp" |
||||||
|
android:layout_marginEnd="16dp" |
||||||
|
android:background="@color/kaki" /> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
Loading…
Reference in new issue