Skip to content

Commit

Permalink
Build132
Browse files Browse the repository at this point in the history
  - Added Russian translation
  - Fixed "Paris" issue 🤷
  • Loading branch information
Hamza417 committed Aug 8, 2021
1 parent c7987ef commit 1ce66cf
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ On top of all the core functionality Positional is a highly polished app and pro
[![Free](https://img.shields.io/badge/Free%20Version-Play%20Store-839192?style=flat&logo=google%20play)](https://play.google.com/store/apps/details?id=app.simple.positional.lite)
[![Full](https://img.shields.io/badge/Full%20Version-Play%20Store-2E86C1?style=flat&logo=google%20play)](https://play.google.com/store/apps/details?id=app.simple.positional)

[![From Github](https://img.shields.io/github/downloads/Hamza417/Positional/total?color=white&label=Free%20Version%20%28GitHub%29&logo=github)](https://github.com/Hamza417/Positional/releases/download/Build125/app-lite-release.apk)
[![From Github](https://img.shields.io/github/downloads/Hamza417/Positional/total?color=white&label=Free%20Version%20%28GitHub%29&logo=github)](https://github.com/Hamza417/Positional/releases/download/Build132/app-lite-release.apk)

[![Intro](https://img.shields.io/youtube/views/34iuIlusrcs?label=Watch%20App%20Intro&logo=Youtube&logoColor=red&style=social)](https://youtu.be/34iuIlusrcs)

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {

compileSdkVersion 30

def appVersionCode = 131
def appVersionCode = 132
def appVersionName = "positional_build_${appVersionCode}_final"

defaultConfig {
Expand Down
38 changes: 34 additions & 4 deletions app/src/main/assets/html/translators.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ <h3>Romanian</h3>
</div>
</div>

<!-- Russian -->

<div class="entry">
<div class="title">
<h3>Russian</h3>
<p>100%</p>
</div>
<div class="body">
<p>Этот язык переведен</p>
<ul>
<li>Consumer</li>
</ul>
</div>
</div>

<!-- Urdu -->

<div class="entry">
Expand Down Expand Up @@ -123,7 +138,7 @@ <h1>Excluded Translations</h1>
<div class="entry">
<div class="title">
<h3>German</h3>
<p>69%</p>
<p>67%</p>
</div>
<div class="body">
<p>Diese Sprache wird übersetzt von</p>
Expand All @@ -138,7 +153,7 @@ <h3>German</h3>
<div class="entry">
<div class="title">
<h3>Spanish</h3>
<p>54%</p>
<p>53%</p>
</div>
<div class="body">
<p>Este idioma es traducido por</p>
Expand All @@ -153,7 +168,7 @@ <h3>Spanish</h3>
<div class="entry">
<div class="title">
<h3>Korean</h3>
<p>50%</p>
<p>48%</p>
</div>
<div class="body">
<p>이 언어는 다음에 의해 번역됩니다</p>
Expand All @@ -178,12 +193,27 @@ <h3>Polish</h3>
</div>
</div>

<!-- Portuguese, Brazilian -->

<div class="entry">
<div class="title">
<h3>Portuguese, Brazilian</h3>
<p>5%</p>
</div>
<div class="body">
<p>Este idioma é traduzido por</p>
<ul>
<li>Ely Carlos Dias</li>
</ul>
</div>
</div>

<!-- Serbian (Cyrillic) -->

<div class="entry">
<div class="title">
<h3>Serbian (Cyrillic)</h3>
<p>57%</p>
<p>56%</p>
</div>
<div class="body">
<p>превео је овај језик</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ import java.util.*
class LocaleAdapter : RecyclerView.Adapter<LocaleAdapter.Holder>() {

var localeCallback: LocaleCallback? = null
private var localeList: MutableList<Locales> = LocaleHelper.localeList

private var localeList: MutableList<Locales> = LocaleHelper.localeList.also { it ->
it.subList(1, it.size).sortBy {
it.language
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
localeList.sortBy { it.language.lowercase(Locale.ROOT) }
return Holder(LayoutInflater.from(parent.context).inflate(R.layout.adapter_locales, parent, false))
}

Expand Down
52 changes: 39 additions & 13 deletions app/src/main/java/app/simple/positional/decorations/maps/Maps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext

class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attributeSet),
OnMapReadyCallback, SharedPreferences.OnSharedPreferenceChangeListener,
CoroutineScope {
OnMapReadyCallback, SharedPreferences.OnSharedPreferenceChangeListener,
CoroutineScope {

private val cameraSpeed = 1000
private var googleMap: GoogleMap? = null
Expand All @@ -38,6 +38,7 @@ class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attr

private var isCustomCoordinate = false
private var isBearingRotation = false
private var isFirstLocation = true

private var customLatitude = 0.0
private var customLongitude = 0.0
Expand All @@ -64,12 +65,12 @@ class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attr
}

viewHandler.postDelayed({
/**
* This prevents the lag when fragment is switched
*/
this.alpha = 0F
getMapAsync(this)
}, 500)
/**
* This prevents the lag when fragment is switched
*/
this.alpha = 0F
getMapAsync(this)
}, 500)
}

override fun onMapReady(googleMap: GoogleMap) {
Expand All @@ -92,6 +93,13 @@ class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attr
this.googleMap = googleMap

addMarker(latLng!!)

if(!isCustomCoordinate) {
if(location.isNotNull()) {
setFirstLocation(location!!)
}
}

setMapStyle(GPSPreferences.isLabelOn())
setSatellite()
setBuildings(GPSPreferences.getShowBuildingsOnMap())
Expand Down Expand Up @@ -268,11 +276,11 @@ class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attr
if (googleMap.isNull()) return

googleMap?.animateCamera(CameraUpdateFactory.newCameraPosition(CameraPosition.builder()
.target(latLng)
.tilt(GPSPreferences.getMapTilt())
.zoom(zoom)
.bearing(if (isBearingRotation) bearing else 0F)
.build()), cameraSpeed, null)
.target(latLng)
.tilt(GPSPreferences.getMapTilt())
.zoom(zoom)
.bearing(if (isBearingRotation) bearing else 0F)
.build()), cameraSpeed, null)
}

fun getCamera(): CameraPosition? {
Expand All @@ -284,6 +292,24 @@ class Maps(context: Context, attributeSet: AttributeSet) : MapView(context, attr
googleMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
}

fun setFirstLocation(location: Location?) {
if(googleMap.isNotNull() && isFirstLocation) {
this.location = location

with(LatLng(location!!.latitude, location.longitude)) {
addMarker(this)
googleMap?.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(
this,
GPSPreferences.getMapZoom(),
GPSPreferences.getMapTilt(),
0F)))

latLng = this
isFirstLocation = false
}
}
}

fun setOnMapsCallbackListener(mapsCallbacks: MapsCallbacks) {
this.mapsCallbacks = mapsCallbacks
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import app.simple.positional.math.CompassAzimuth
import app.simple.positional.math.LowPassFilter
import app.simple.positional.math.Vector3
import app.simple.positional.model.TrailData
import app.simple.positional.preferences.GPSPreferences
import app.simple.positional.preferences.MainPreferences
import app.simple.positional.preferences.TrailPreferences
import app.simple.positional.singleton.SharedPreferences.getSharedPreferences
Expand Down Expand Up @@ -67,6 +68,7 @@ class TrailMaps(context: Context, attributeSet: AttributeSet) : MapView(context,
private val polylines = arrayListOf<Polyline>()
private var trailData = arrayListOf<TrailData>()
private var isWrapped = false
private var isFirstLocation = true
private var lastZoom = 20F
private var lastTilt = 0F
private var options: PolylineOptions? = null
Expand Down Expand Up @@ -130,6 +132,10 @@ class TrailMaps(context: Context, attributeSet: AttributeSet) : MapView(context,
setSatellite()
setBuildings(TrailPreferences.getShowBuildingsOnMap())

if(location.isNotNull()) {
setFirstLocation(location)
}

if (!TrailPreferences.arePolylinesWrapped()) {
this.googleMap?.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(
latLng!!,
Expand Down Expand Up @@ -460,13 +466,33 @@ class TrailMaps(context: Context, attributeSet: AttributeSet) : MapView(context,
TrailPreferences.setWrapStatus(false)
}

fun getCamera(): CameraPosition = googleMap?.cameraPosition!!
fun getCamera(): CameraPosition? {
return googleMap?.cameraPosition
}

fun setCamera(cameraPosition: CameraPosition?) {
cameraPosition ?: return
googleMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
}

fun setFirstLocation(location: Location?) {
if(googleMap.isNotNull() && isFirstLocation) {
this.location = location

with(LatLng(location!!.latitude, location.longitude)) {
addMarker(this)
googleMap?.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(
this,
GPSPreferences.getMapZoom(),
GPSPreferences.getMapTilt(),
0F)))

latLng = this
isFirstLocation = false
}
}
}

private val mapMoved = object : Runnable {
override fun run() {
if (TrailPreferences.getMapAutoCenter() && !isWrapped) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ object FragmentPreferences {
}

fun getCurrentTag(): String {
return getSharedPreferences().getString(currentTag, "gps")!!
return getSharedPreferences().getString(currentTag, "location")!!
}
}
1 change: 1 addition & 0 deletions app/src/main/java/app/simple/positional/ui/panels/GPS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class GPS : ScopedFragment() {

if (!isCustomCoordinate) {
updateViews(location!!.latitude, location!!.longitude)
maps?.setFirstLocation(location)
maps?.location = location
maps?.addMarker(LatLng(location!!.latitude, location!!.longitude))
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/app/simple/positional/ui/panels/Trail.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class Trail : ScopedFragment() {
MainPreferences.setLastLongitude(location!!.longitude.toFloat())

withContext(Dispatchers.Main) {
maps?.setFirstLocation(location)
maps?.location = location
maps?.addMarker(LatLng(location!!.latitude, location!!.longitude))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ object LocaleHelper {
// Locales("Deutsch", "de"),
Locales("हिन्दी", "hi"),
Locales("Romanian", "ro"),
Locales("русский язык", "ru"),
Locales("اردو", "ur"))

fun getSystemLanguageCode(): String {
Expand Down

0 comments on commit 1ce66cf

Please sign in to comment.