mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-02 09:46:51 +01:00
Merge branch 'master' into develop
This commit is contained in:
commit
f0e873e393
@ -16,8 +16,8 @@ allprojects {
|
||||
|
||||
ext {
|
||||
projectGroupId = 'org.mariotaku.twidere'
|
||||
projectVersionCode = 393
|
||||
projectVersionName = '3.6.33'
|
||||
projectVersionCode = 394
|
||||
projectVersionName = '3.7.0'
|
||||
|
||||
globalCompileSdkVersion = 26
|
||||
globalBuildToolsVersion = '26.0.2'
|
||||
|
@ -19,20 +19,26 @@
|
||||
|
||||
package org.mariotaku.twidere.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Point
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.support.v4.content.res.ResourcesCompat
|
||||
import android.view.*
|
||||
import kotlinx.android.synthetic.fdroid.activity_osm_viewer.*
|
||||
import org.mariotaku.ktextension.preferExternalCacheDir
|
||||
import org.mariotaku.twidere.Constants
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_LATITUDE
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_LONGITUDE
|
||||
import org.mariotaku.twidere.util.DebugLog
|
||||
import org.osmdroid.api.IMapView
|
||||
import org.osmdroid.config.Configuration
|
||||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory
|
||||
import org.osmdroid.util.GeoPoint
|
||||
import org.osmdroid.views.overlay.ItemizedOverlay
|
||||
import org.osmdroid.views.overlay.OverlayItem
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class OpenStreetMapViewerFragment : BaseFragment(), Constants {
|
||||
@ -52,6 +58,7 @@ class OpenStreetMapViewerFragment : BaseFragment(), Constants {
|
||||
}
|
||||
this.latitude = latitude
|
||||
this.longitude = longitude
|
||||
mapView.setTileSource(TileSourceFactory.MAPNIK)
|
||||
mapView.setMultiTouchControls(true)
|
||||
mapView.setBuiltInZoomControls(true)
|
||||
mapView.isTilesScaledToDpi = true
|
||||
@ -70,6 +77,21 @@ class OpenStreetMapViewerFragment : BaseFragment(), Constants {
|
||||
return inflater.inflate(R.layout.activity_osm_viewer, container, false)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
Configuration.getInstance().apply {
|
||||
try {
|
||||
osmdroidBasePath = File(context.preferExternalCacheDir, "osmdroid")
|
||||
osmdroidTileCache = File(osmdroidBasePath, "tiles")
|
||||
|
||||
osmdroidBasePath.mkdirs()
|
||||
osmdroidTileCache.mkdirs()
|
||||
} catch (e: Exception) {
|
||||
DebugLog.w(tr = e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_osm_viewer, menu)
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/mapView"
|
||||
tilesource="Mapnik"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</FrameLayout>
|
@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.support.v4.content.ContextCompat
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2016/12/13.
|
||||
@ -26,3 +27,6 @@ fun Context.unregisterReceiverSafe(receiver: BroadcastReceiver?): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
val Context.preferExternalCacheDir: File
|
||||
get() = externalCacheDir ?: cacheDir
|
@ -208,8 +208,8 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
quotedNameView.visibility = View.VISIBLE
|
||||
quotedTextView.visibility = View.VISIBLE
|
||||
|
||||
val quoted_user_key = status.quoted_user_key!!
|
||||
quotedNameView.name = colorNameManager.getUserNickname(quoted_user_key,
|
||||
val quotedUserKey = status.quoted_user_key!!
|
||||
quotedNameView.name = colorNameManager.getUserNickname(quotedUserKey,
|
||||
status.quoted_user_name)
|
||||
quotedNameView.screenName = "@${status.quoted_user_acct}"
|
||||
|
||||
@ -231,9 +231,9 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
}
|
||||
quotedTextView.hideIfEmpty()
|
||||
|
||||
val quoted_user_color = colorNameManager.getUserColor(quoted_user_key)
|
||||
if (quoted_user_color != 0) {
|
||||
quotedView.drawStart(quoted_user_color)
|
||||
val quotedUserColor = colorNameManager.getUserColor(quotedUserKey)
|
||||
if (quotedUserColor != 0) {
|
||||
quotedView.drawStart(quotedUserColor)
|
||||
} else {
|
||||
quotedView.drawStart(ThemeUtils.getColorFromAttribute(context,
|
||||
R.attr.quoteIndicatorBackgroundColor))
|
||||
@ -275,12 +275,10 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
|
||||
if (status.is_retweet) {
|
||||
val retweetUserColor = colorNameManager.getUserColor(status.retweeted_by_user_key!!)
|
||||
if (retweetUserColor == 0) {
|
||||
itemContent.drawStart(userColor)
|
||||
} else if (userColor == 0) {
|
||||
itemContent.drawStart(retweetUserColor)
|
||||
} else {
|
||||
itemContent.drawStart(retweetUserColor, userColor)
|
||||
when {
|
||||
retweetUserColor == 0 -> itemContent.drawStart(userColor)
|
||||
userColor == 0 -> itemContent.drawStart(retweetUserColor)
|
||||
else -> itemContent.drawStart(retweetUserColor, userColor)
|
||||
}
|
||||
} else {
|
||||
itemContent.drawStart(userColor)
|
||||
@ -605,11 +603,13 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
private fun TextView.displayMediaLabel(cardName: String?, media: Array<ParcelableMedia?>?,
|
||||
location: ParcelableLocation?, placeFullName: String?, sensitive: Boolean): Boolean {
|
||||
var result = false
|
||||
if (media != null && media.isNotEmpty()) {
|
||||
if (sensitive) {
|
||||
when {
|
||||
media != null && media.isNotEmpty() -> {
|
||||
when {
|
||||
sensitive -> {
|
||||
setLabelIcon(R.drawable.ic_label_warning)
|
||||
setText(R.string.label_sensitive_content)
|
||||
} else when {
|
||||
}
|
||||
media.type in videoTypes -> {
|
||||
setLabelIcon(R.drawable.ic_label_video)
|
||||
setText(R.string.label_video)
|
||||
@ -624,12 +624,22 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
}
|
||||
}
|
||||
result = true
|
||||
} else if (cardName != null) {
|
||||
if (cardName.startsWith("poll")) {
|
||||
}
|
||||
cardName != null -> if (cardName.startsWith("poll")) {
|
||||
setLabelIcon(R.drawable.ic_label_poll)
|
||||
setText(R.string.label_poll)
|
||||
result = true
|
||||
}
|
||||
// placeFullName != null -> {
|
||||
// setLabelIcon(R.drawable.ic_label_location)
|
||||
// text = placeFullName
|
||||
// result = true
|
||||
// }
|
||||
// location != null -> {
|
||||
// setLabelIcon(R.drawable.ic_label_location)
|
||||
// setText(R.string.action_view_map)
|
||||
// result = true
|
||||
// }
|
||||
}
|
||||
refreshDrawableState()
|
||||
return result
|
||||
@ -646,14 +656,6 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
return 0
|
||||
}
|
||||
|
||||
private fun hasVideo(media: Array<ParcelableMedia?>?): Boolean {
|
||||
if (media == null) return false
|
||||
return media.any { item ->
|
||||
if (item == null) return@any false
|
||||
return@any videoTypes.contains(item.type)
|
||||
}
|
||||
}
|
||||
|
||||
internal class EventListener(holder: StatusViewHolder) : OnClickListener, OnLongClickListener {
|
||||
|
||||
private val holderRef = WeakReference(holder)
|
||||
|
13
twidere/src/main/svg/drawable/ic_label_location-mdpi.svg
Normal file
13
twidere/src/main/svg/drawable/ic_label_location-mdpi.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>ic_label_location-mdpi</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Action-Icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="ic_label_location-mdpi">
|
||||
<polygon id="Shape" points="2 2 22 2 22 22 2 22"></polygon>
|
||||
<path d="M11.95,4 C8.6605,4 6,6.6605 6,9.95 C6,14.4125 11.95,21 11.95,21 C11.95,21 17.9,14.4125 17.9,9.95 C17.9,6.6605 15.2395,4 11.95,4 L11.95,4 L11.95,4 Z M11.95,12.075 C10.777,12.075 9.825,11.123 9.825,9.95 C9.825,8.777 10.777,7.825 11.95,7.825 C13.123,7.825 14.075,8.777 14.075,9.95 C14.075,11.123 13.123,12.075 11.95,12.075 L11.95,12.075 L11.95,12.075 Z" id="Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1000 B |
Loading…
x
Reference in New Issue
Block a user