diff --git a/presentation/build.gradle b/presentation/build.gradle index 34d09ce89..9e777d1dd 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -29,7 +29,7 @@ android { defaultConfig { applicationId "com.moez.QKSMS" - minSdkVersion 21 + minSdkVersion 25 targetSdkVersion 28 versionCode 193 versionName "3.6.3" @@ -105,6 +105,7 @@ configurations { } dependencies { + // lifecycle implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" @@ -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', { @@ -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') diff --git a/presentation/noAnalytics/release/output.json b/presentation/noAnalytics/release/output.json new file mode 100644 index 000000000..36b0a5fb9 --- /dev/null +++ b/presentation/noAnalytics/release/output.json @@ -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":{}}] \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkTextView.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkTextView.kt index 36c909003..c143417d7 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkTextView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkTextView.kt @@ -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) { @@ -43,5 +44,4 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu super.setTextColor(color) setLinkTextColor(color) } - } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/TightTextView.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/TightTextView.kt index 0c104b81c..a03eac6c3 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/TightTextView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/TightTextView.kt @@ -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, @@ -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) + } + } + } } \ No newline at end of file diff --git a/presentation/src/main/res/layout/message_list_item_in.xml b/presentation/src/main/res/layout/message_list_item_in.xml index 8d04274f2..10f721a99 100644 --- a/presentation/src/main/res/layout/message_list_item_in.xml +++ b/presentation/src/main/res/layout/message_list_item_in.xml @@ -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" diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index 04f599253..8fb1ad6c1 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -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"