Skip to content

Commit

Permalink
fix badge and futher code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed May 30, 2019
1 parent 88ae551 commit 1ecbbca
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 28 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fbab98f82eed4a9e9b0cd4af593dbe73)](https://app.codacy.com/app/wuan/bo-android?utm_source=github.com&utm_medium=referral&utm_content=wuan/bo-android&utm_campaign=Badge_Grade_Dashboard)
# About [![Build Status](https://travis-ci.org/wuan/bo-android.svg?branch=master)](https://travis-ci.org/wuan/bo-android) [![Coverage Status](https://coveralls.io/repos/github/wuan/bo-android/badge.svg?branch=master)](https://coveralls.io/github/wuan/bo-android?branch=master) [![Stories in Ready](https://badge.waffle.io/wuan/bo-android.svg?label=ready&title=Ready)](http://waffle.io/wuan/bo-android)
[![Build Status](https://travis-ci.org/wuan/bo-android.svg?branch=master)](https://travis-ci.org/wuan/bo-android) [![Coverage Status](https://coveralls.io/repos/github/wuan/bo-android/badge.svg?branch=master)](https://coveralls.io/github/wuan/bo-android?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fbab98f82eed4a9e9b0cd4af593dbe73)](https://app.codacy.com/app/wuan/bo-android?utm_source=github.com&utm_medium=referral&utm_content=wuan/bo-android&utm_campaign=Badge_Grade_Dashboard)

The Android App
[*Blitzortung Lightning Monitor*](https://play.google.com/store/apps/details?id=org.blitzortung.android.app)
built from these sources visualizes lightning data provided by the blitzortung.org network.
# About

The Android App *Blitzortung Lightning Monitor built from these sources visualizes lightning data provided by the blitzortung.org network.

[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/org.blitzortung.android.app/)

## Project Metrics

[![Throughput Graph](https://graphs.waffle.io/wuan/bo-android/throughput.svg)](https://waffle.io/wuan/bo-android/metrics)

## Translation offers are welcome

We are still looking forward to volunteers preparing a translation for the following languages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ abstract class ManagerLocationProvider(
}

private fun updateToLastKnown() {
val location = locationManager.getLastKnownLocation(type)
val location = try {
locationManager.getLastKnownLocation(type)
} catch (securityException: SecurityException) {
null
}
Log.v(LOG_TAG, "ManagerLocationProvider: last known $location")
if (location != null) {
onLocationChanged(location)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/blitzortung/android/map/OwnMapView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class OwnMapView(context: Context) : MapView(context) {
return gestureDetector.onTouchEvent(event)
}



val popup: View by lazy { LayoutInflater.from(context).inflate(R.layout.popup, this, false) }

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class OwnLocationOverlay(
init {
layerOverlayComponent = LayerOverlayComponent(context.resources.getString(R.string.own_location_layer))

item = null

populate()

sizeFactor = ViewHelper.pxFromDp(context, 1.0f) * TabletAwareView.sizeFactor(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,20 @@ class StrikeListOverlay(private val mapFragment: MapFragment, val colorHandler:

val strikeTapped = strikeList.firstOrNull { it.pointIsInside(point, mapView.projection) }

val popup = (mapView as OwnMapView).popup
mapView.removeView(popup)
if (mapView is OwnMapView) {
val popup = mapView.popup
mapView.removeView(popup)

if (strikeTapped != null) {
val newPopup = createStrikePopUp(popup, strikeTapped)
if (strikeTapped != null) {
val newPopup = createStrikePopUp(popup, strikeTapped)

val mapParams = MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
point, 0, 0, MapView.LayoutParams.BOTTOM_CENTER)
val mapParams = MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
point, 0, 0, MapView.LayoutParams.BOTTOM_CENTER)

mapView.addView(newPopup, mapParams)
mapView.addView(newPopup, mapParams)

return true
return true
}
}
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class SlidePreferences(context: Context, attrs: AttributeSet) : DialogPreference
private val unitSuffix: String
private val defaultValue: Int
private val maximumValue: Int
private var valueText: TextView? = null
private var slider: SeekBar? = null
private lateinit var valueText: TextView
private lateinit var slider: SeekBar
private var currentValue: Int
private var minimumValue: Int

Expand All @@ -60,7 +60,7 @@ class SlidePreferences(context: Context, attrs: AttributeSet) : DialogPreference
valueText.gravity = Gravity.CENTER_HORIZONTAL
valueText.textSize = 32f
//Set initial text
valueText.text = "$currentValue $unitSuffix"
valueText.text = "$currentValue $unitSuffix"
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT)
Expand All @@ -82,9 +82,9 @@ class SlidePreferences(context: Context, attrs: AttributeSet) : DialogPreference
override fun onBindDialogView(v: View) {
super.onBindDialogView(v)

slider!!.max = maximumValue
slider.max = maximumValue
//We need to adapt the value of the SeekBar to our Minimum-Value
slider!!.progress = currentValue - minimumValue
slider.progress = currentValue - minimumValue
}

override fun onSetInitialValue(should_restore: Boolean, defaultValue: Any?) {
Expand All @@ -99,19 +99,20 @@ class SlidePreferences(context: Context, attrs: AttributeSet) : DialogPreference

override fun onProgressChanged(seekBar: SeekBar, seekBarValue: Int, fromTouch: Boolean) {
//Ignore events that wasn't done by the user
if(!fromTouch)
if (!fromTouch) {
return
}

//We need to adapt the value of the SeekBar to our Minimum-Value
currentValue = seekBarValue + minimumValue

valueText!!.text = "$currentValue $unitSuffix"
valueText.text = "$currentValue $unitSuffix"

callChangeListener(currentValue)
}

override fun onDialogClosed(positiveResult: Boolean) {
if(positiveResult) {
if (positiveResult) {
if (shouldPersist())
persistInt(currentValue)
} else {
Expand Down

0 comments on commit 1ecbbca

Please sign in to comment.