Commit b007795d authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Update check improvements, minor UI changes

parent 9e766489
......@@ -7,16 +7,28 @@ import android.os.Environment
import foundation.e.apps.application.model.data.BasicData
import foundation.e.apps.utils.Common
import java.io.File
import java.util.regex.Pattern
class ApplicationInfo(private val packageName: String) {
fun isLastVersionInstalled(context: Context, lastVersionNumber: String): Boolean {
val packageInfo = getPackageInfo(context) ?: return false
if (lastVersionNumber.isBlank() ||
!lastVersionNumber.contains("(") ||
!lastVersionNumber.contains(")")) {
return true
}
if (!Common.isSystemApp(context.packageManager, packageName)) {
val packageInfo = getPackageInfo(context) ?: return false
if (lastVersionNumber.isEmpty()) {
return true
try {
val pattern = Pattern.compile("[(]\\d+[)]")
val matcher = pattern.matcher(lastVersionNumber)
matcher.find()
val updateVersionCode = matcher.group()
.replace("(", "")
.replace(")", "")
return (updateVersionCode.toInt() <= packageInfo.versionCode)
} catch (exception: Exception) {
}
return lastVersionNumber.contains("(${packageInfo.versionCode})")
}
return true
}
......
......@@ -114,6 +114,7 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -542,6 +543,13 @@
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/default_divider_height"
android:layout_marginStart="@dimen/layout_margin_medium"
android:layout_marginEnd="@dimen/layout_margin_medium"
android:background="@color/colorDivider" />
<RelativeLayout
android:id="@+id/app_trackers_container"
android:layout_width="match_parent"
......@@ -576,6 +584,13 @@
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/default_divider_height"
android:layout_marginStart="@dimen/layout_margin_medium"
android:layout_marginEnd="@dimen/layout_margin_medium"
android:background="@color/colorDivider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment