Merge branch 'master' of gitlab.com:stax-river/poker-analytics

feature/top10
Razmig Sarkissian 7 years ago
commit de3ab3312f
  1. 8
      .gitlab-ci.yml
  2. 2
      app/build.gradle
  3. 13
      app/src/main/java/net/pokeranalytics/android/ui/activity/components/PokerAnalyticsActivity.kt
  4. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/LocationDataFragment.kt
  5. 1
      app/src/main/java/net/pokeranalytics/android/util/FormatUtils.kt
  6. 2
      app/src/test/java/net/pokeranalytics/android/ExampleUnitTest.kt

@ -38,7 +38,7 @@ assembleDebug:
paths: paths:
- app/build/outputs/ - app/build/outputs/
debugTests: #debugTests:
stage: test # stage: test
script: # script:
- ./gradlew -Pci --console=plain :app:testDebug # - ./gradlew -Pci --console=plain :app:testDebug

@ -34,7 +34,7 @@ android {
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }

@ -18,6 +18,7 @@ open class PokerAnalyticsActivity : AppCompatActivity() {
companion object { companion object {
const val PERMISSION_REQUEST_ACCESS_FINE_LOCATION = 1000 const val PERMISSION_REQUEST_ACCESS_FINE_LOCATION = 1000
const val PLAY_SERVICES_RESOLUTION_REQUEST = 2000
} }
private val realm = Realm.getDefaultInstance() private val realm = Realm.getDefaultInstance()
@ -71,7 +72,7 @@ open class PokerAnalyticsActivity : AppCompatActivity() {
/** /**
* Return if the location permission has been granted by the user * Return if the location permission has been granted by the user
*/ */
fun hasLocationPermissionGranted() : Boolean { fun hasLocationPermissionGranted(): Boolean {
return ContextCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED return ContextCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
} }
@ -127,22 +128,18 @@ open class PokerAnalyticsActivity : AppCompatActivity() {
/** /**
* Find the current location * Find the current location
*/ */
fun findCurrentLocation(callback: ((location: Location?) -> Unit)?) { fun findCurrentLocation(callback: ((location: android.location.Location?) -> Unit)?) {
if (LocationManager(this).databaseContainsLocationsWithCoordinates()) {
if (ContextCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
LocationManager(this).findNearestLocationFromUser(callback) LocationManager(this).findCurrentLocation(callback)
} else { } else {
askForLocationPermission { granted -> askForLocationPermission { granted ->
if (granted) { if (granted) {
LocationManager(this).findNearestLocationFromUser(callback) LocationManager(this).findCurrentLocation(callback)
} else { } else {
callback?.invoke(null) callback?.invoke(null)
} }
} }
} }
} else {
callback?.invoke(null)
}
} }
} }

@ -14,7 +14,6 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepres
import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import timber.log.Timber
/** /**
* Custom EditableDataFragment to manage the LOCATE_ME case * Custom EditableDataFragment to manage the LOCATE_ME case
@ -181,7 +180,6 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
// Try to get the location of the user // Try to get the location of the user
parentActivity.findCurrentLocation {currentLocation -> parentActivity.findCurrentLocation {currentLocation ->
currentLocation?.let { currentLocation?.let {
Timber.d("Current location: ${it.latitude}, ${it.longitude}")
location.latitude = currentLocation.latitude location.latitude = currentLocation.latitude
location.longitude = currentLocation.longitude location.longitude = currentLocation.longitude
} }

@ -15,6 +15,8 @@ class ExampleUnitTest : RealmUnitTest() {
class Grade(someValue: Double) : SessionInterface { class Grade(someValue: Double) : SessionInterface {
override var bbPer100Hands: Double = 0.0
override var ratedNet: Double = 0.0
override var value: Double = someValue override var value: Double = someValue
override var sessionSet: SessionSet? = SessionSet() override var sessionSet: SessionSet? = SessionSet()

Loading…
Cancel
Save