|
|
|
|
@ -1,16 +1,11 @@ |
|
|
|
|
package net.pokeranalytics.android.ui.fragment |
|
|
|
|
|
|
|
|
|
import android.Manifest |
|
|
|
|
import android.app.Activity.RESULT_OK |
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.content.pm.PackageManager |
|
|
|
|
import android.net.Uri |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.view.* |
|
|
|
|
import android.widget.Toast |
|
|
|
|
import androidx.core.app.ActivityCompat |
|
|
|
|
import androidx.core.app.ActivityOptionsCompat |
|
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
|
import androidx.core.view.isVisible |
|
|
|
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator |
|
|
|
|
import com.google.android.material.tabs.TabLayout |
|
|
|
|
@ -39,7 +34,6 @@ import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager |
|
|
|
|
import net.pokeranalytics.android.util.Preferences |
|
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
|
import net.pokeranalytics.android.util.extensions.count |
|
|
|
|
import java.io.File |
|
|
|
|
import java.text.SimpleDateFormat |
|
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
@ -124,7 +118,7 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
|
if (sessionId != null) { |
|
|
|
|
createNewSession(true, sessionId = sessionId, duplicate = true) |
|
|
|
|
} else { |
|
|
|
|
throw PAIllegalStateException("Session not found for duplicate at position: ${menuPosition}") |
|
|
|
|
throw PAIllegalStateException("Session not found for duplicate at position: $menuPosition") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
@ -139,31 +133,31 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
|
initUI() |
|
|
|
|
initData() |
|
|
|
|
|
|
|
|
|
if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) |
|
|
|
|
!= PackageManager.PERMISSION_GRANTED) { |
|
|
|
|
|
|
|
|
|
if (ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(), |
|
|
|
|
Manifest.permission.READ_EXTERNAL_STORAGE)) { |
|
|
|
|
// Show an explanation to the user *asynchronously* -- don't block |
|
|
|
|
// this thread waiting for the user's response! After the user |
|
|
|
|
// sees the explanation, try again to request the permission. |
|
|
|
|
} else { |
|
|
|
|
// No explanation needed, we can request the permission. |
|
|
|
|
ActivityCompat.requestPermissions(requireActivity(), |
|
|
|
|
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), |
|
|
|
|
12) |
|
|
|
|
|
|
|
|
|
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an |
|
|
|
|
// app-defined int constant. The callback method gets the |
|
|
|
|
// result of the request. |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
val uri = Uri.fromFile(File("sdcard/Download/Results_0802.csv")) |
|
|
|
|
ImportActivity.newInstanceForResult(requireActivity(), uri) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) |
|
|
|
|
// != PackageManager.PERMISSION_GRANTED) { |
|
|
|
|
// |
|
|
|
|
// if (ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(), |
|
|
|
|
// Manifest.permission.READ_EXTERNAL_STORAGE)) { |
|
|
|
|
// // Show an explanation to the user *asynchronously* -- don't block |
|
|
|
|
// // this thread waiting for the user's response! After the user |
|
|
|
|
// // sees the explanation, try again to request the permission. |
|
|
|
|
// } else { |
|
|
|
|
// // No explanation needed, we can request the permission. |
|
|
|
|
// ActivityCompat.requestPermissions(requireActivity(), |
|
|
|
|
// arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), |
|
|
|
|
// 12) |
|
|
|
|
// |
|
|
|
|
// // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an |
|
|
|
|
// // app-defined int constant. The callback method gets the |
|
|
|
|
// // result of the request. |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// } else { |
|
|
|
|
// |
|
|
|
|
// val uri = Uri.fromFile(File("sdcard/Download/Results_0802.csv")) |
|
|
|
|
// ImportActivity.newInstanceForResult(requireActivity(), uri) |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|