commit
6e685a5e77
@ -0,0 +1,67 @@ |
|||||||
|
package net.pokeranalytics.android.ui.activity |
||||||
|
|
||||||
|
import android.Manifest |
||||||
|
import android.content.Intent |
||||||
|
import android.os.Bundle |
||||||
|
import android.os.PersistableBundle |
||||||
|
import androidx.core.app.ActivityCompat |
||||||
|
import io.realm.Realm |
||||||
|
import net.pokeranalytics.android.R |
||||||
|
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity |
||||||
|
import net.pokeranalytics.android.ui.fragment.ImportFragment |
||||||
|
import net.pokeranalytics.android.util.csv.CSVImporter |
||||||
|
import timber.log.Timber |
||||||
|
|
||||||
|
class ImportActivity : PokerAnalyticsActivity() { |
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { |
||||||
|
super.onCreate(savedInstanceState, persistentState) |
||||||
|
|
||||||
|
initUI() |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
override fun onStop() { |
||||||
|
super.onStop() |
||||||
|
|
||||||
|
val realm = Realm.getDefaultInstance() |
||||||
|
realm.refresh() |
||||||
|
realm.close() |
||||||
|
} |
||||||
|
|
||||||
|
private fun initUI() { |
||||||
|
|
||||||
|
val fragmentTransaction = supportFragmentManager.beginTransaction() |
||||||
|
val fragment = ImportFragment() |
||||||
|
|
||||||
|
fragmentTransaction.add(R.id.container, fragment) |
||||||
|
fragmentTransaction.commit() |
||||||
|
} |
||||||
|
|
||||||
|
private fun csv() { |
||||||
|
|
||||||
|
val path = "sdcard/Download/RunGoodSessions1.csv" |
||||||
|
val csv = CSVImporter(path) |
||||||
|
csv.start() |
||||||
|
|
||||||
|
ActivityCompat.requestPermissions( |
||||||
|
this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), PERMISSION_REQUEST_ACCESS_FINE_LOCATION |
||||||
|
) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
override fun onNewIntent(intent: Intent?) { |
||||||
|
super.onNewIntent(intent) |
||||||
|
|
||||||
|
val f = intent?.data |
||||||
|
val uri = f.toString() |
||||||
|
Timber.d("!!!Intent!!! uri = $uri") |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) { |
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package net.pokeranalytics.android.ui.fragment |
||||||
|
|
||||||
|
import net.pokeranalytics.android.ui.fragment.components.RealmFragment |
||||||
|
|
||||||
|
class ImportFragment : RealmFragment() { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue