parent
44d1c5fa03
commit
ea6b0a29d5
@ -1,2 +1,52 @@ |
||||
package net.pokeranalytics.android.ui.fragment |
||||
|
||||
import android.os.Bundle |
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import androidx.fragment.app.DialogFragment |
||||
import kotlinx.android.synthetic.main.fragment_data_selection_dialog.* |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
||||
|
||||
class DataSelectionDialogFragment : DialogFragment() { |
||||
|
||||
private enum class BundleKey(var value: String) { |
||||
DATA_TYPE("data_type") |
||||
} |
||||
|
||||
companion object { |
||||
|
||||
fun newInstance(dataType: Int): DataSelectionDialogFragment { |
||||
val df = DataSelectionDialogFragment() |
||||
val bundle = Bundle() |
||||
bundle.putSerializable(BundleKey.DATA_TYPE.value, dataType) |
||||
df.arguments = bundle |
||||
return df |
||||
} |
||||
|
||||
} |
||||
|
||||
override fun onCreateView( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup?, |
||||
savedInstanceState: Bundle? |
||||
): View? { |
||||
super.onCreateView(inflater, container, savedInstanceState) |
||||
return inflater.inflate(R.layout.fragment_data_selection_dialog, container, false) |
||||
} |
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
||||
super.onViewCreated(view, savedInstanceState) |
||||
initDataListFragment() |
||||
} |
||||
|
||||
private fun initDataListFragment() { |
||||
|
||||
val dataListFragment = this.dataListFragment as DataListFragment |
||||
val dataType = this.arguments?.getInt(BundleKey.DATA_TYPE.value) ?: throw PAIllegalStateException("undefined datatype") |
||||
dataListFragment.setData(dataType) |
||||
|
||||
} |
||||
|
||||
} |
||||
@ -1,11 +1,15 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
<shape |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="oval"> |
||||
|
||||
<solid android:color="@color/green" /> |
||||
<!-- <solid android:color="@color/black" />--> |
||||
|
||||
<stroke android:color="@color/kaki_light" android:width="2dp"/> |
||||
<solid android:color="@color/transparent"/> |
||||
|
||||
<size |
||||
android:width="32dp" |
||||
android:height="32dp" /> |
||||
android:width="48dp" |
||||
android:height="48dp"/> |
||||
|
||||
</shape> |
||||
@ -1,6 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" android:layout_width="match_parent" |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
</LinearLayout> |
||||
<fragment |
||||
android:id="@+id/dataListFragment" |
||||
android:name="net.pokeranalytics.android.ui.fragment.DataListFragment" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
|
||||
</FrameLayout> |
||||
Loading…
Reference in new issue