|
|
|
@ -3,7 +3,6 @@ package net.pokeranalytics.android.ui.activity |
|
|
|
import android.app.KeyguardManager |
|
|
|
import android.app.KeyguardManager |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.Intent |
|
|
|
import android.content.Intent |
|
|
|
import android.net.Uri |
|
|
|
|
|
|
|
import android.os.Build |
|
|
|
import android.os.Build |
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView |
|
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView |
|
|
|
@ -11,15 +10,10 @@ import io.realm.RealmResults |
|
|
|
import kotlinx.android.synthetic.main.activity_home.* |
|
|
|
import kotlinx.android.synthetic.main.activity_home.* |
|
|
|
import net.pokeranalytics.android.BuildConfig |
|
|
|
import net.pokeranalytics.android.BuildConfig |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.realm.Currency |
|
|
|
import net.pokeranalytics.android.model.realm.Currency |
|
|
|
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity |
|
|
|
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity |
|
|
|
import net.pokeranalytics.android.ui.activity.components.RequestCode |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.activity.components.ResultCode |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.adapter.HomePagerAdapter |
|
|
|
import net.pokeranalytics.android.ui.adapter.HomePagerAdapter |
|
|
|
import net.pokeranalytics.android.ui.extensions.showAlertDialog |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
import timber.log.Timber |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HomeActivity : PokerAnalyticsActivity() { |
|
|
|
class HomeActivity : PokerAnalyticsActivity() { |
|
|
|
@ -49,7 +43,7 @@ class HomeActivity : PokerAnalyticsActivity() { |
|
|
|
R.id.navigation_reports -> { |
|
|
|
R.id.navigation_reports -> { |
|
|
|
displayFragment(3) |
|
|
|
displayFragment(3) |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.navigation_more -> { |
|
|
|
R.id.navigation_settings -> { |
|
|
|
displayFragment(4) |
|
|
|
displayFragment(4) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -81,50 +75,50 @@ class HomeActivity : PokerAnalyticsActivity() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onNewIntent(intent: Intent?) { |
|
|
|
// override fun onNewIntent(intent: Intent?) { |
|
|
|
super.onNewIntent(intent) |
|
|
|
// super.onNewIntent(intent) |
|
|
|
|
|
|
|
// |
|
|
|
setIntent(intent) |
|
|
|
// setIntent(intent) |
|
|
|
intent?.let { |
|
|
|
// intent?.let { |
|
|
|
|
|
|
|
// |
|
|
|
when (intent.action) { |
|
|
|
// when (intent.action) { |
|
|
|
"android.intent.action.VIEW" -> { // import |
|
|
|
// "android.intent.action.VIEW" -> { // import |
|
|
|
val data = it.data |
|
|
|
// val data = it.data |
|
|
|
if (data != null) { |
|
|
|
// if (data != null) { |
|
|
|
this.requestImportConfirmation(data) |
|
|
|
// this.requestImportConfirmation(data) |
|
|
|
} else { |
|
|
|
// } else { |
|
|
|
throw PAIllegalStateException("URI null on import") |
|
|
|
// throw PAIllegalStateException("URI null on import") |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
else -> { |
|
|
|
// else -> { |
|
|
|
Timber.w("Intent ${intent.action} unmanaged") |
|
|
|
// Timber.w("Intent ${intent.action} unmanaged") |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
// |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
// super.onActivityResult(requestCode, resultCode, data) |
|
|
|
|
|
|
|
// |
|
|
|
when (requestCode) { |
|
|
|
// when (requestCode) { |
|
|
|
RequestCode.IMPORT.value -> { |
|
|
|
// RequestCode.IMPORT.value -> { |
|
|
|
if (resultCode == ResultCode.IMPORT_UNRECOGNIZED_FORMAT.value) { |
|
|
|
// if (resultCode == ResultCode.IMPORT_UNRECOGNIZED_FORMAT.value) { |
|
|
|
showAlertDialog(context = this, message = R.string.unknown_import_format_popup_message) |
|
|
|
// showAlertDialog(context = this, message = R.string.unknown_import_format_popup_message) |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// Import |
|
|
|
// Import |
|
|
|
|
|
|
|
|
|
|
|
private fun requestImportConfirmation(uri: Uri) { |
|
|
|
// private fun requestImportConfirmation(uri: Uri) { |
|
|
|
|
|
|
|
// |
|
|
|
showAlertDialog(context = this, title = R.string.import_confirmation, showCancelButton = true, positiveAction = { |
|
|
|
// showAlertDialog(context = this, title = R.string.import_confirmation, showCancelButton = true, positiveAction = { |
|
|
|
ImportActivity.newInstanceForResult(this, uri) |
|
|
|
// ImportActivity.newInstanceForResult(this, uri) |
|
|
|
}) |
|
|
|
// }) |
|
|
|
|
|
|
|
// |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
private fun observeRealmObjects() { |
|
|
|
private fun observeRealmObjects() { |
|
|
|
|
|
|
|
|
|
|
|
|