|
|
|
@ -20,7 +20,8 @@ import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.fragment.components.PokerAnalyticsFragment |
|
|
|
import net.pokeranalytics.android.ui.fragment.components.PokerAnalyticsFragment |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SettingRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SettingRow |
|
|
|
import net.pokeranalytics.android.util.* |
|
|
|
import net.pokeranalytics.android.util.Preferences |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.URL |
|
|
|
import net.pokeranalytics.android.util.extensions.openContactMail |
|
|
|
import net.pokeranalytics.android.util.extensions.openContactMail |
|
|
|
import net.pokeranalytics.android.util.extensions.openPlayStorePage |
|
|
|
import net.pokeranalytics.android.util.extensions.openPlayStorePage |
|
|
|
import net.pokeranalytics.android.util.extensions.openUrl |
|
|
|
import net.pokeranalytics.android.util.extensions.openUrl |
|
|
|
@ -43,17 +44,17 @@ class SettingsFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Sta |
|
|
|
return fragment |
|
|
|
return fragment |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val rowRepresentation : List<RowRepresentable> by lazy { |
|
|
|
val rowRepresentation: List<RowRepresentable> by lazy { |
|
|
|
val rows = ArrayList<RowRepresentable>() |
|
|
|
val rows = ArrayList<RowRepresentable>() |
|
|
|
rows.addAll(SettingRow.getRows()) |
|
|
|
rows.addAll(SettingRow.getRows()) |
|
|
|
rows |
|
|
|
rows |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val REQUEST_CODE_CURRENCY : Int = 0 |
|
|
|
val REQUEST_CODE_CURRENCY: Int = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun stringForRow(row: RowRepresentable): String { |
|
|
|
override fun stringForRow(row: RowRepresentable): String { |
|
|
|
return when(row) { |
|
|
|
return when (row) { |
|
|
|
SettingRow.VERSION -> BuildConfig.VERSION_NAME + if (BuildConfig.DEBUG) " DEBUG" else "" |
|
|
|
SettingRow.VERSION -> BuildConfig.VERSION_NAME + if (BuildConfig.DEBUG) " DEBUG" else "" |
|
|
|
SettingRow.CURRENCY -> Currency.getInstance(Preferences.getCurrencyLocale(this.parentActivity)).symbol |
|
|
|
SettingRow.CURRENCY -> Currency.getInstance(Preferences.getCurrencyLocale(this.parentActivity)).symbol |
|
|
|
|
|
|
|
|
|
|
|
@ -89,13 +90,9 @@ class SettingsFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Sta |
|
|
|
SettingRow.RATE_APP -> parentActivity.openPlayStorePage() |
|
|
|
SettingRow.RATE_APP -> parentActivity.openPlayStorePage() |
|
|
|
SettingRow.CONTACT_US -> parentActivity.openContactMail(R.string.contact) |
|
|
|
SettingRow.CONTACT_US -> parentActivity.openContactMail(R.string.contact) |
|
|
|
SettingRow.BUG_REPORT -> parentActivity.openContactMail(R.string.bug_report_subject) |
|
|
|
SettingRow.BUG_REPORT -> parentActivity.openContactMail(R.string.bug_report_subject) |
|
|
|
SettingRow.CURRENCY -> { |
|
|
|
SettingRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@SettingsFragment, SettingsFragment.REQUEST_CODE_CURRENCY) |
|
|
|
val intent = Intent(context, CurrenciesActivity::class.java) |
|
|
|
|
|
|
|
this.startActivityForResult(intent, SettingsFragment.REQUEST_CODE_CURRENCY) |
|
|
|
|
|
|
|
// CurrenciesActivity.newInstance(requireContext()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SettingRow.FOLLOW_US -> { |
|
|
|
SettingRow.FOLLOW_US -> { |
|
|
|
when(position) { |
|
|
|
when (position) { |
|
|
|
0 -> parentActivity.openUrl(URL.BLOG.value) |
|
|
|
0 -> parentActivity.openUrl(URL.BLOG.value) |
|
|
|
1 -> parentActivity.openUrl(URL.INSTAGRAM.value) |
|
|
|
1 -> parentActivity.openUrl(URL.INSTAGRAM.value) |
|
|
|
2 -> parentActivity.openUrl(URL.TWITTER.value) |
|
|
|
2 -> parentActivity.openUrl(URL.TWITTER.value) |
|
|
|
|