mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
decrease spotbugs warnings
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
60827afe5c
commit
fdf6b04fb8
@ -36,5 +36,3 @@ class GeocodingAdapter(context: Context, val dataSource: List<Address>) : BaseAd
|
|||||||
return rowView
|
return rowView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,7 +182,9 @@ class IncomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
|||||||
for (key in messageParameters.keys) {
|
for (key in messageParameters.keys) {
|
||||||
val individualHashMap = message.messageParameters[key]
|
val individualHashMap = message.messageParameters[key]
|
||||||
if (individualHashMap != null) {
|
if (individualHashMap != null) {
|
||||||
if (individualHashMap["type"] == "user" || individualHashMap["type"] == "guest" || individualHashMap["type"] == "call") {
|
if (individualHashMap["type"] == "user"
|
||||||
|
|| individualHashMap["type"] == "guest"
|
||||||
|
|| individualHashMap["type"] == "call") {
|
||||||
if (individualHashMap["id"] == message.activeUser!!.userId) {
|
if (individualHashMap["id"] == message.activeUser!!.userId) {
|
||||||
messageString = DisplayUtils.searchAndReplaceWithMentionSpan(
|
messageString = DisplayUtils.searchAndReplaceWithMentionSpan(
|
||||||
messageText!!.context,
|
messageText!!.context,
|
||||||
|
@ -107,8 +107,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
|||||||
val individualHashMap: HashMap<String, String>? = message.messageParameters[key]
|
val individualHashMap: HashMap<String, String>? = message.messageParameters[key]
|
||||||
if (individualHashMap != null) {
|
if (individualHashMap != null) {
|
||||||
if (individualHashMap["type"] == "user" || (
|
if (individualHashMap["type"] == "user" || (
|
||||||
individualHashMap["type"] == "guest"
|
individualHashMap["type"] == "guest") || individualHashMap["type"] == "call"
|
||||||
) || individualHashMap["type"] == "call"
|
|
||||||
) {
|
) {
|
||||||
messageString = DisplayUtils.searchAndReplaceWithMentionSpan(
|
messageString = DisplayUtils.searchAndReplaceWithMentionSpan(
|
||||||
messageText!!.context,
|
messageText!!.context,
|
||||||
@ -242,8 +241,14 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
|||||||
|
|
||||||
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
||||||
urlStringBuffer.append("?mapProviderUrl=" + URLEncoder.encode(context!!.getString(R.string.osm_tile_server_url)))
|
urlStringBuffer.append("?mapProviderUrl=" + URLEncoder.encode(context!!.getString(R.string.osm_tile_server_url)))
|
||||||
urlStringBuffer.append("&mapProviderAttribution=" + URLEncoder.encode(context!!.getString(R.string
|
urlStringBuffer.append(
|
||||||
.osm_tile_server_attributation)))
|
"&mapProviderAttribution=" + URLEncoder.encode(
|
||||||
|
context!!.getString(
|
||||||
|
R.string
|
||||||
|
.osm_tile_server_attributation
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
urlStringBuffer.append("&locationLat=" + URLEncoder.encode(locationLat))
|
urlStringBuffer.append("&locationLat=" + URLEncoder.encode(locationLat))
|
||||||
urlStringBuffer.append("&locationLon=" + URLEncoder.encode(locationLon))
|
urlStringBuffer.append("&locationLon=" + URLEncoder.encode(locationLon))
|
||||||
urlStringBuffer.append("&locationName=" + URLEncoder.encode(locationName))
|
urlStringBuffer.append("&locationName=" + URLEncoder.encode(locationName))
|
||||||
|
@ -69,7 +69,9 @@ import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class LocationPickerController(args: Bundle) : BaseController(args), SearchView.OnQueryTextListener,
|
class LocationPickerController(args: Bundle) :
|
||||||
|
BaseController(args),
|
||||||
|
SearchView.OnQueryTextListener,
|
||||||
GeocodingController.GeocodingResultListener {
|
GeocodingController.GeocodingResultListener {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -257,7 +259,9 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
|
|||||||
moveToCurrentLocationWasClicked = true
|
moveToCurrentLocationWasClicked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
map?.addMapListener(DelayedMapListener(object : MapListener {
|
map?.addMapListener(
|
||||||
|
DelayedMapListener(
|
||||||
|
object : MapListener {
|
||||||
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
||||||
if (moveToCurrentLocationWasClicked) {
|
if (moveToCurrentLocationWasClicked) {
|
||||||
setLocationDescription(true, false)
|
setLocationDescription(true, false)
|
||||||
@ -277,7 +281,8 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
|
|||||||
override fun onZoom(event: ZoomEvent): Boolean {
|
override fun onZoom(event: ZoomEvent): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}))
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLocationDescription(isGpsLocation: Boolean, isGeocodedResult: Boolean) {
|
private fun setLocationDescription(isGpsLocation: Boolean, isGeocodedResult: Boolean) {
|
||||||
@ -376,7 +381,8 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
|
|||||||
if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE && grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (requestCode == REQUEST_PERMISSIONS_REQUEST_CODE && grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
initMap()
|
initMap()
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, context!!.getString(R.string.nc_location_permission_required), Toast.LENGTH_LONG).show()
|
Toast.makeText(context, context!!.getString(R.string.nc_location_permission_required), Toast.LENGTH_LONG)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ import com.stfalcon.chatkit.commons.models.IMessage
|
|||||||
|
|
||||||
interface ExtendedIMessage : IMessage {
|
interface ExtendedIMessage : IMessage {
|
||||||
|
|
||||||
// var isLocationMessage: Boolean
|
|
||||||
|
|
||||||
fun isLocationMessage() : Boolean
|
fun isLocationMessage() : Boolean
|
||||||
|
|
||||||
}
|
}
|
@ -45,6 +45,7 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import kotlin.text.Charsets;
|
||||||
|
|
||||||
@Parcel
|
@Parcel
|
||||||
@JsonObject
|
@JsonObject
|
||||||
@ -104,8 +105,8 @@ public class ChatMessage implements ExtendedIMessage, MessageContentType, Messag
|
|||||||
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
if(MessageDigest.isEqual(
|
if(MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("file").getBytes())) {
|
("file").getBytes(Charsets.UTF_8))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,8 +120,8 @@ public class ChatMessage implements ExtendedIMessage, MessageContentType, Messag
|
|||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
|
|
||||||
if(MessageDigest.isEqual(
|
if(MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("geo-location").getBytes())) {
|
("geo-location").getBytes(Charsets.UTF_8))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,8 +137,8 @@ public class ChatMessage implements ExtendedIMessage, MessageContentType, Messag
|
|||||||
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
if(MessageDigest.isEqual(
|
if(MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("file").getBytes())) {
|
("file").getBytes(Charsets.UTF_8))) {
|
||||||
selectedIndividualHashMap = individualHashMap;
|
selectedIndividualHashMap = individualHashMap;
|
||||||
return (ApiUtils.getUrlForFilePreviewWithFileId(getActiveUser().getBaseUrl(),
|
return (ApiUtils.getUrlForFilePreviewWithFileId(getActiveUser().getBaseUrl(),
|
||||||
individualHashMap.get("id"), NextcloudTalkApplication.Companion.getSharedApplication().getResources().getDimensionPixelSize(R.dimen.maximum_file_preview_size)));
|
individualHashMap.get("id"), NextcloudTalkApplication.Companion.getSharedApplication().getResources().getDimensionPixelSize(R.dimen.maximum_file_preview_size)));
|
||||||
|
Loading…
Reference in New Issue
Block a user