forked from commons-app/apps-android-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Circular-Progress-bar-nomination-for-deletion-…
- Loading branch information
Showing
311 changed files
with
6,213 additions
and
4,936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package fr.free.nrw.commons | ||
|
||
import android.content.Context | ||
import android.graphics.Bitmap | ||
import android.graphics.Canvas | ||
import android.graphics.drawable.BitmapDrawable | ||
import android.graphics.drawable.Drawable | ||
import fr.free.nrw.commons.location.LatLng | ||
import fr.free.nrw.commons.nearby.Place | ||
|
||
class BaseMarker { | ||
private var _position: LatLng = LatLng(0.0, 0.0, 0f) | ||
private var _title: String = "" | ||
private var _place: Place = Place() | ||
private var _icon: Bitmap? = null | ||
|
||
var position: LatLng | ||
get() = _position | ||
set(value) { | ||
_position = value | ||
} | ||
var title: String | ||
get() = _title | ||
set(value) { | ||
_title = value | ||
} | ||
|
||
var place: Place | ||
get() = _place | ||
set(value) { | ||
_place = value | ||
} | ||
var icon: Bitmap? | ||
get() = _icon | ||
set(value) { | ||
_icon = value | ||
} | ||
|
||
constructor() { | ||
} | ||
|
||
fun fromResource(context: Context, drawableResId: Int) { | ||
val drawable: Drawable = context.resources.getDrawable(drawableResId) | ||
icon = if (drawable is BitmapDrawable) { | ||
(drawable as BitmapDrawable).bitmap | ||
} else { | ||
val bitmap = Bitmap.createBitmap( | ||
drawable.intrinsicWidth, | ||
drawable.intrinsicHeight, Bitmap.Config.ARGB_8888 | ||
) | ||
val canvas = Canvas(bitmap) | ||
drawable.setBounds(0, 0, canvas.width, canvas.height) | ||
drawable.draw(canvas) | ||
bitmap | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package fr.free.nrw.commons | ||
|
||
import android.os.Parcel | ||
import android.os.Parcelable | ||
|
||
class CameraPosition(val latitude: Double, val longitude: Double, val zoom: Double) : Parcelable { | ||
|
||
constructor(parcel: Parcel) : this( | ||
parcel.readDouble(), | ||
parcel.readDouble(), | ||
parcel.readDouble() | ||
) | ||
|
||
override fun writeToParcel(parcel: Parcel, flags: Int) { | ||
parcel.writeDouble(latitude) | ||
parcel.writeDouble(longitude) | ||
parcel.writeDouble(zoom) | ||
} | ||
|
||
override fun describeContents(): Int { | ||
return 0 | ||
} | ||
|
||
companion object CREATOR : Parcelable.Creator<CameraPosition> { | ||
override fun createFromParcel(parcel: Parcel): CameraPosition { | ||
return CameraPosition(parcel) | ||
} | ||
|
||
override fun newArray(size: Int): Array<CameraPosition?> { | ||
return arrayOfNulls(size) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.