Commit 24107a8d authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Apps: Bump to v1.3.0

parent 6374a3af
plugins { plugins {
id 'com.android.application' id 'com.android.application'
id 'kotlin-android' id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt' id 'kotlin-kapt'
id 'kotlin-parcelize'
} }
android { android {
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion '29.0.2' buildToolsVersion '30.0.3'
defaultConfig { defaultConfig {
applicationId "foundation.e.apps" applicationId "foundation.e.apps"
minSdkVersion 25 minSdkVersion 25
targetSdkVersion 29 targetSdkVersion 29
versionCode 10 versionCode 10
versionName "1.2.0" versionName "1.3.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
} }
signingConfigs { signingConfigs {
...@@ -47,9 +46,7 @@ android { ...@@ -47,9 +46,7 @@ android {
lintOptions { lintOptions {
lintConfig file("lint.xml") lintConfig file("lint.xml")
disable 'MissingTranslation' disable 'MissingTranslation'
} disable 'NullSafeMutableLiveData'
androidExtensions {
experimental = true
} }
aaptOptions { aaptOptions {
additionalParameters '-I', 'app/e-ui-sdk.jar' additionalParameters '-I', 'app/e-ui-sdk.jar'
...@@ -81,41 +78,25 @@ dependencies { ...@@ -81,41 +78,25 @@ dependencies {
// Preference // Preference
implementation "androidx.preference:preference-ktx:1.1.1" implementation "androidx.preference:preference-ktx:1.1.1"
// Lifecycle
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
// Bouncy Castle // Bouncy Castle
implementation 'org.bouncycastle:bcpg-jdk15on:1.60' implementation 'org.bouncycastle:bcpg-jdk15on:1.60'
// GSON // GSON
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
// EventBus
implementation 'org.greenrobot:eventbus:3.2.0'
// Volley
implementation "com.android.volley:volley:1.2.0"
// PhotoView // PhotoView
implementation "com.github.chrisbanes:PhotoView:2.3.0" implementation "com.github.chrisbanes:PhotoView:2.3.0"
// RoundedImageView
implementation "com.makeramen:roundedimageview:2.3.0"
// RecyclerView // RecyclerView
implementation 'androidx.recyclerview:recyclerview:1.2.0' implementation 'androidx.recyclerview:recyclerview:1.2.0'
// WorkManager // WorkManager
implementation 'androidx.work:work-runtime:2.5.0' implementation 'androidx.work:work-runtime-ktx:2.5.0'
// Android-Iconics // Lifecycle
implementation 'com.mikepenz:iconics-core:3.1.0@aar' def lifecycle_version = "2.3.1"
implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar' implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Vectordrawable
def vector_version = "1.1.0"
implementation "androidx.vectordrawable:vectordrawable:$vector_version"
implementation "androidx.vectordrawable:vectordrawable-animated:$vector_version"
// Navigation component // Navigation component
def nav_version = "2.3.5" def nav_version = "2.3.5"
......
...@@ -75,6 +75,13 @@ ...@@ -75,6 +75,13 @@
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/AppTheme1" android:theme="@style/AppTheme1"
android:windowSoftInputMode="adjustResize" /> android:windowSoftInputMode="adjustResize" />
<receiver android:name=".updates.UpdatesManager">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -52,7 +52,7 @@ import foundation.e.apps.updates.UpdatesManager ...@@ -52,7 +52,7 @@ import foundation.e.apps.updates.UpdatesManager
import foundation.e.apps.utils.Common import foundation.e.apps.utils.Common
import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Constants
import foundation.e.apps.utils.Constants.CURRENTLY_SELECTED_FRAGMENT_KEY import foundation.e.apps.utils.Constants.CURRENTLY_SELECTED_FRAGMENT_KEY
import kotlin.properties.Delegates
class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener, class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener,
ApplicationManagerServiceConnectionCallback { ApplicationManagerServiceConnectionCallback {
...@@ -67,7 +67,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -67,7 +67,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
private val codeRequestPermissions = 9527 private val codeRequestPermissions = 9527
var doubleBackToExitPressedOnce = false; var doubleBackToExitPressedOnce = false;
private var isReceiverRegistered = false private var isReceiverRegistered = false
var accentColorOS = 0 private var accentColorOS by Delegates.notNull<Int>()
init { init {
instance = this instance = this
...@@ -96,6 +96,9 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -96,6 +96,9 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(binding.root) setContentView(binding.root)
accentColorOS = Common.getAccentColor(this)
mActivity = this mActivity = this
disableCategoryIfOpenSource() disableCategoryIfOpenSource()
...@@ -114,9 +117,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -114,9 +117,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
Common.updateMicroGStatus(this) Common.updateMicroGStatus(this)
initialiseUpdatesWorker()
// Show the home fragment by default // Show the home fragment by default
currentFragmentId = if (savedInstanceState != null && currentFragmentId = if (savedInstanceState != null &&
savedInstanceState.containsKey(CURRENTLY_SELECTED_FRAGMENT_KEY)) { savedInstanceState.containsKey(CURRENTLY_SELECTED_FRAGMENT_KEY)) {
...@@ -129,7 +129,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -129,7 +129,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
setupLangReceiver() setupLangReceiver()
applicationManagerServiceConnection.bindService(this) applicationManagerServiceConnection.bindService(this)
getAccentColor();
bottom_navigation_view_color() bottom_navigation_view_color()
openSearchFragment() openSearchFragment()
} }
...@@ -168,12 +167,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -168,12 +167,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
} }
private fun initialiseUpdatesWorker() {
UpdatesManager(applicationContext).startWorker()
}
override fun onServiceBind(applicationManager: ApplicationManager) { override fun onServiceBind(applicationManager: ApplicationManager) {
initialiseFragments(applicationManager) initialiseFragments(applicationManager)
selectFragment(currentFragmentId, null) selectFragment(currentFragmentId, null)
...@@ -341,17 +334,4 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -341,17 +334,4 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
} }
}, 2000) }, 2000)
} }
/*
* get Accent color from OS
*
* */
private fun getAccentColor() {
accentColorOS = this.getColor(R.color.colorAccent);
}
} }
...@@ -19,7 +19,7 @@ package foundation.e.apps.XAPK ...@@ -19,7 +19,7 @@ package foundation.e.apps.XAPK
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.os.Parcelable import android.os.Parcelable
import kotlinx.android.parcel.Parcelize import kotlinx.parcelize.Parcelize
@SuppressLint("ParcelCreator") @SuppressLint("ParcelCreator")
@Parcelize @Parcelize
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Environment
import foundation.e.apps.BuildConfig import foundation.e.apps.BuildConfig
import foundation.e.apps.MainActivity import foundation.e.apps.MainActivity
import java.io.File import java.io.File
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Environment import android.os.Environment
import android.text.TextUtils
import foundation.e.apps.MainActivity import foundation.e.apps.MainActivity
import java.io.File import java.io.File
...@@ -37,7 +36,7 @@ object FsUtils { ...@@ -37,7 +36,7 @@ object FsUtils {
} }
fun exists(filePath: String?): Boolean { fun exists(filePath: String?): Boolean {
return !TextUtils.isEmpty(filePath) && exists(File(filePath)) return if (!filePath.isNullOrEmpty()) exists(File(filePath)) else false
} }
fun exists(file: File?): Boolean { fun exists(file: File?): Boolean {
......
...@@ -26,7 +26,7 @@ import android.os.Build ...@@ -26,7 +26,7 @@ import android.os.Build
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.makeramen.roundedimageview.BuildConfig import foundation.e.apps.BuildConfig
import java.io.File import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
import java.io.IOException import java.io.IOException
......
...@@ -19,7 +19,6 @@ package foundation.e.apps.XAPK ...@@ -19,7 +19,6 @@ package foundation.e.apps.XAPK
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Build
import java.io.File import java.io.File
object IntentUtils { object IntentUtils {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Build
import android.os.LocaleList import android.os.LocaleList
import android.text.TextUtils import android.text.TextUtils
import java.util.* import java.util.*
......
...@@ -19,7 +19,6 @@ package foundation.e.apps.XAPK ...@@ -19,7 +19,6 @@ package foundation.e.apps.XAPK
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import android.os.Build
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import foundation.e.apps.BuildConfig import foundation.e.apps.BuildConfig
import java.io.File import java.io.File
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Build
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import androidx.annotation.MainThread import androidx.annotation.MainThread
......
...@@ -19,7 +19,7 @@ package foundation.e.apps.api ...@@ -19,7 +19,7 @@ package foundation.e.apps.api
import android.content.Context import android.content.Context
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.JsonParser import com.google.gson.JsonParser.parseReader
import foundation.e.apps.application.model.Application import foundation.e.apps.application.model.Application
import foundation.e.apps.application.model.data.BasicData import foundation.e.apps.application.model.data.BasicData
import foundation.e.apps.application.model.release.ReleaseData import foundation.e.apps.application.model.release.ReleaseData
...@@ -35,7 +35,7 @@ class GitlabDataRequest { ...@@ -35,7 +35,7 @@ class GitlabDataRequest {
val url = Constants.RELEASE_API + Constants.MICROG_ID + Constants.RELEASE_ENDPOINT val url = Constants.RELEASE_API + Constants.MICROG_ID + Constants.RELEASE_ENDPOINT
val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET) val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET)
val isr = InputStreamReader(urlConnection.inputStream) val isr = InputStreamReader(urlConnection.inputStream)
val element = JsonParser().parse(isr) val element = parseReader(isr)
val releaseList: List<ReleaseData> = Gson().fromJson(element.toString(), val releaseList: List<ReleaseData> = Gson().fromJson(element.toString(),
Array<ReleaseData>::class.java).toList() Array<ReleaseData>::class.java).toList()
......
...@@ -21,31 +21,32 @@ import android.os.Bundle ...@@ -21,31 +21,32 @@ import android.os.Bundle
import android.text.util.Linkify import android.text.util.Linkify
import android.view.MenuItem import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import foundation.e.apps.R import foundation.e.apps.R
import foundation.e.apps.databinding.ActivityApplicationDescriptionBinding
import foundation.e.apps.utils.Constants.APPLICATION_DESCRIPTION_KEY import foundation.e.apps.utils.Constants.APPLICATION_DESCRIPTION_KEY
import kotlinx.android.synthetic.main.activity_application_description.*
class ApplicationDescriptionActivity : AppCompatActivity() { class ApplicationDescriptionActivity : AppCompatActivity() {
private lateinit var binding: ActivityApplicationDescriptionBinding
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
binding = ActivityApplicationDescriptionBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_application_description) setContentView(binding.root)
val toolbar = findViewById<Toolbar>(R.id.toolbar) val toolbar = binding.toolbar
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setTitle(R.string.application_description_activity_title) supportActionBar?.setTitle(R.string.application_description_activity_title)
if (intent != null) { if (intent != null) {
app_description.text = intent.getStringExtra(APPLICATION_DESCRIPTION_KEY) binding.appDescription.text = intent.getStringExtra(APPLICATION_DESCRIPTION_KEY)
Linkify.addLinks(app_description, Linkify.ALL) Linkify.addLinks(binding.appDescription, Linkify.ALL)
} }
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when { when {
item?.itemId == android.R.id.home -> { item.itemId == android.R.id.home -> {
finish() finish()
} }
else -> { else -> {
......
...@@ -21,12 +21,14 @@ import android.annotation.SuppressLint ...@@ -21,12 +21,14 @@ import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.graphics.drawable.GradientDrawable
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.widget.Button import android.view.animation.AlphaAnimation
import android.widget.ImageView import android.view.animation.Animation
import android.widget.RatingBar import android.widget.RatingBar
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.content.res.AppCompatResources
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
...@@ -38,37 +40,36 @@ import foundation.e.apps.application.model.State ...@@ -38,37 +40,36 @@ import foundation.e.apps.application.model.State
import foundation.e.apps.application.model.data.BasicData import foundation.e.apps.application.model.data.BasicData
import foundation.e.apps.application.model.data.PwasBasicData import foundation.e.apps.application.model.data.PwasBasicData
import foundation.e.apps.application.viewmodel.ApplicationViewModel import foundation.e.apps.application.viewmodel.ApplicationViewModel
import foundation.e.apps.databinding.ApplicationListItemBinding
import foundation.e.apps.utils.Common import foundation.e.apps.utils.Common
import foundation.e.apps.utils.Common.toMiB import foundation.e.apps.utils.Common.toMiB
import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Constants
import foundation.e.apps.utils.Error import foundation.e.apps.utils.Error
import foundation.e.apps.utils.Execute import foundation.e.apps.utils.Execute
import kotlinx.android.synthetic.main.application_list_item.view.*
import kotlinx.android.synthetic.main.install_button_layout.view.*
class ApplicationViewHolder(private val activity: Activity, private val view: View, accentColorOS: Int) : class ApplicationViewHolder(private val activity: Activity, binding: ApplicationListItemBinding, private val accentColorOS: Int) :
RecyclerView.ViewHolder(view), RecyclerView.ViewHolder(binding.root),
ApplicationStateListener, ApplicationStateListener,
Downloader.DownloadProgressCallback, Downloader.DownloadProgressCallback,
BasicData.IconLoaderCallback, BasicData.IconLoaderCallback,
PwasBasicData.IconLoaderCallback { PwasBasicData.IconLoaderCallback {
private val icon: ImageView = view.app_icon private val view = binding.root
private val title: TextView = view.app_title private val icon = binding.appIcon
private val pwa_icon: TextView = view.pwa_sympol private val title = binding.appTitle
private val author: TextView = view.app_author private val pwaSympol = binding.pwaSympol
private val ratingBar: RatingBar = view.app_rating_bar private val author = binding.appAuthor
private val rating: TextView = view.app_rating private val ratingBar = binding.appRatingBar
private val privacyScore: TextView = view.app_privacy_score private val rating = binding.appRating
private var installButton: Button = view.app_install private val privacyScore = binding.appPrivacyScore
private var installButton = binding.simpleInstallButtonLayout.appInstall
private var application: Application? = null private var application: Application? = null
private val applicationViewModel = ApplicationViewModel() private val applicationViewModel = ApplicationViewModel()
private var downloader: Downloader? = null private var downloader: Downloader? = null
var accentColorOS = accentColorOS;
init { init {
pwa_icon.visibility = View.GONE pwaSympol.visibility = View.GONE
view.setOnClickListener { view.setOnClickListener {
if (application != null) { if (application != null) {
if (application!!.packageName != Constants.MICROG_PACKAGE) if (application!!.packageName != Constants.MICROG_PACKAGE)
...@@ -76,11 +77,6 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi ...@@ -76,11 +77,6 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
} }
} }
installButton.setTextColor(Color.parseColor("#ffffff"))
if (0 != this.accentColorOS) {
installButton.setBackgroundColor(this.accentColorOS)
}
installButton.setOnClickListener { installButton.setOnClickListener {
if (application?.fullData != null && if (application?.fullData != null &&
application!!.fullData!!.getLastVersion() == null) { application!!.fullData!!.getLastVersion() == null) {
...@@ -100,7 +96,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi ...@@ -100,7 +96,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
fun createApplicationView(app: Application) { fun createApplicationView(app: Application) {
pwa_icon.visibility = View.GONE pwaSympol.visibility = View.GONE
this.application = app this.application = app
if (app.basicData != null) { if (app.basicData != null) {
...@@ -111,7 +107,11 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi ...@@ -111,7 +107,11 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
application!!.addListener(this) application!!.addListener(this)
title.text = application!!.basicData!!.name title.text = application!!.basicData!!.name
author.text = application!!.basicData!!.author author.text = application!!.basicData!!.author
val drawable = ratingBar.progressDrawable
drawable.colorFilter = PorterDuffColorFilter(accentColorOS, PorterDuff.Mode.SRC_IN)
ratingBar.rating = application!!.basicData!!.ratings.rating!! ratingBar.rating = application!!.basicData!!.ratings.rating!!
if (application!!.basicData!!.ratings.rating != -1f) { if (application!!.basicData!!.ratings.rating != -1f) {
rating.text = application!!.basicData!!.ratings.rating.toString() rating.text = application!!.basicData!!.ratings.rating.toString()
} else {