|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package net.pokeranalytics.android.ui.activity |
|
|
|
package net.pokeranalytics.android.ui.activity |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.Manifest |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.Intent |
|
|
|
import android.content.Intent |
|
|
|
import android.net.Uri |
|
|
|
import android.net.Uri |
|
|
|
@ -37,7 +38,7 @@ class ImportActivity : PokerAnalyticsActivity() { |
|
|
|
|
|
|
|
|
|
|
|
private fun getIntent(context: Context, uri: Uri): Intent { |
|
|
|
private fun getIntent(context: Context, uri: Uri): Intent { |
|
|
|
val intent = Intent(context, ImportActivity::class.java) |
|
|
|
val intent = Intent(context, ImportActivity::class.java) |
|
|
|
intent.putExtra(ImportActivity.IntentKey.URI.keyName, uri) |
|
|
|
intent.putExtra(IntentKey.URI.keyName, uri) |
|
|
|
return intent |
|
|
|
return intent |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -48,7 +49,7 @@ class ImportActivity : PokerAnalyticsActivity() { |
|
|
|
intent?.data?.let { |
|
|
|
intent?.data?.let { |
|
|
|
this.fileURI = it |
|
|
|
this.fileURI = it |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
this.fileURI = intent.getParcelableExtra(ImportActivity.IntentKey.URI.keyName) as Uri |
|
|
|
this.fileURI = intent.getParcelableExtra(IntentKey.URI.keyName) as Uri |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setContentView(R.layout.activity_import) |
|
|
|
setContentView(R.layout.activity_import) |
|
|
|
@ -57,6 +58,8 @@ class ImportActivity : PokerAnalyticsActivity() { |
|
|
|
|
|
|
|
|
|
|
|
private fun initUI() { |
|
|
|
private fun initUI() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
askForPermission(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), RequestCode.PERMISSION_WRITE_EXTERNAL_STORAGE.value) { |
|
|
|
|
|
|
|
|
|
|
|
val fragmentTransaction = supportFragmentManager.beginTransaction() |
|
|
|
val fragmentTransaction = supportFragmentManager.beginTransaction() |
|
|
|
val fragment = ImportFragment() |
|
|
|
val fragment = ImportFragment() |
|
|
|
|
|
|
|
|
|
|
|
@ -71,30 +74,7 @@ class ImportActivity : PokerAnalyticsActivity() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// override fun onNewIntent(intent: Intent?) { |
|
|
|
} |
|
|
|
// super.onNewIntent(intent) |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// Timber.d("++++++ data = ${intent?.data}") |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// setIntent(intent) |
|
|
|
|
|
|
|
// intent?.let { |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// when (intent.action) { |
|
|
|
|
|
|
|
// "android.intent.action.VIEW" -> { // import |
|
|
|
|
|
|
|
// val data = it.data |
|
|
|
|
|
|
|
// if (data != null) { |
|
|
|
|
|
|
|
// this.requestImportConfirmation(data) |
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
// throw PAIllegalStateException("URI null on import") |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// else -> { |
|
|
|
|
|
|
|
// 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) |
|
|
|
|