Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GPS hyperlinks #1388

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {

defaultConfig {
applicationId "com.moez.QKSMS"
minSdkVersion 21
minSdkVersion 25
targetSdkVersion 28
versionCode 193
versionName "3.6.3"
Expand Down Expand Up @@ -105,6 +105,7 @@ configurations {
}

dependencies {

// lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
Expand Down Expand Up @@ -146,7 +147,7 @@ dependencies {
implementation "com.google.dagger:dagger-android-support:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
compileOnly "javax.annotation:jsr250-api:1.0"
compileOnly 'javax.annotation:jsr250-api:1.0'

// ezvcard
implementation('com.googlecode.ez-vcard:ez-vcard:0.10.4', {
Expand Down Expand Up @@ -174,18 +175,17 @@ dependencies {
testImplementation "androidx.test:runner:$androidx_testrunner_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.mockito:mockito-core:$mockito_version"

implementation "com.android.billingclient:billing:1.0"
implementation "com.bugsnag:bugsnag-android:4.1.1"
implementation "com.github.chrisbanes:PhotoView:2.0.0"
implementation 'com.android.billingclient:billing:1.0'
implementation 'com.bugsnag:bugsnag-android:4.1.1'
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
implementation "com.google.android:flexbox:0.3.1"
implementation 'com.google.android:flexbox:0.3.1'
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "me.leolin:ShortcutBadger:1.1.21"
implementation 'me.leolin:ShortcutBadger:1.1.21'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(":android-smsmms")
implementation project(":common")
implementation project(':android-smsmms')
implementation project(':common')
implementation project(':data')
implementation project(':domain')
noAnalyticsDebug project(path: ':data', configuration: 'noAnalyticsDebug')
Expand Down
1 change: 1 addition & 0 deletions presentation/noAnalytics/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"armeabi-v7a"}],"versionCode":1193,"versionName":"3.6.3","enabled":true,"filterName":"armeabi-v7a","outputFile":"presentation-noAnalytics-armeabi-v7a-release.apk","fullName":"noAnalyticsArmeabi-v7aRelease","baseName":"noAnalytics-armeabi-v7a-release"},"path":"presentation-noAnalytics-armeabi-v7a-release.apk","properties":{}},{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"arm64-v8a"}],"versionCode":2193,"versionName":"3.6.3","enabled":true,"filterName":"arm64-v8a","outputFile":"presentation-noAnalytics-arm64-v8a-release.apk","fullName":"noAnalyticsArm64-v8aRelease","baseName":"noAnalytics-arm64-v8a-release"},"path":"presentation-noAnalytics-arm64-v8a-release.apk","properties":{}},{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[],"versionCode":193,"versionName":"3.6.3","enabled":true,"filterName":"universal","outputFile":"presentation-noAnalytics-universal-release.apk","fullName":"noAnalyticsUniversalRelease","baseName":"noAnalytics-universal-release"},"path":"presentation-noAnalytics-universal-release.apk","properties":{}}]
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.moez.QKSMS.common.util.TextViewStyler
import com.moez.QKSMS.injection.appComponent
import javax.inject.Inject


open class QkTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
: EmojiAppCompatTextView(context, attrs) {

Expand All @@ -43,5 +44,4 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
super.setTextColor(color)
setLinkTextColor(color)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@
package com.moez.QKSMS.common.widget

import android.content.Context
import android.text.SpannableString
import android.text.method.LinkMovementMethod
import android.text.util.Linkify
import android.util.AttributeSet
import java.util.regex.Pattern


val GPS_NW_DMS : Pattern = Pattern.compile(
"N([0-9]+)[^a-zA-Z0-9]+([0-9]+)[^a-zA-Z0-9]+([0-9]+)[^yza-wA-Z0-9]+W([0-9]+)[^a-zA-Z0-9]+([0-9]+)[^a-zA-Z0-9]+([0-9]+)"
)

private fun ordinalFromStrings(s_degrees: String, s_minutes: String, s_seconds: String): String {
val degrees = Integer.parseInt(s_degrees).toFloat()
val minutes = Integer.parseInt(s_minutes).toFloat()
val seconds = Integer.parseInt(s_seconds).toFloat()
return java.lang.Float.toString(degrees + minutes / 60.0f + seconds / 3600.0f)
}


class TightTextView @JvmOverloads constructor(
context: Context,
Expand All @@ -46,4 +63,29 @@ class TightTextView @JvmOverloads constructor(
}
}


override fun setText(text: CharSequence?, type: BufferType?) {
super.setText(text, type)
if(text != null) {
var added = false
var not_linked = false
val spannable = SpannableString.valueOf(this.text)
val m = this.movementMethod
if ((m == null || m !is LinkMovementMethod) && this.linksClickable) {
not_linked = true
added = Linkify.addLinks(spannable, GPS_NW_DMS, "geo:0,0?q=", null, null,
{ matcher, _ ->
ordinalFromStrings(matcher.group(1), matcher.group(2), matcher.group(3)) +
",-" +
ordinalFromStrings(matcher.group(4), matcher.group(5), matcher.group(6))
})
}
if (added) {
this.movementMethod = LinkMovementMethod.getInstance()
this.text = spannable
} else if (not_linked) {
Linkify.addLinks(this, Linkify.EMAIL_ADDRESSES or Linkify.PHONE_NUMBERS or Linkify.WEB_URLS)
}
}
}
}
2 changes: 1 addition & 1 deletion presentation/src/main/res/layout/message_list_item_in.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="2dp"
android:autoLink="email|phone|web"
android:autoLink=""
android:background="@drawable/message_only"
android:gravity="start|center_vertical"
android:minHeight="36dp"
Expand Down
2 changes: 1 addition & 1 deletion presentation/src/main/res/layout/message_list_item_out.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
android:layout_marginEnd="12dp"
android:layout_marginStart="60dp"
android:layout_marginTop="2dp"
android:autoLink="email|phone|web"
android:autoLink=""
android:background="@drawable/message_only"
android:backgroundTint="?attr/bubbleColor"
android:gravity="start|center_vertical"
Expand Down