diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b23673a9e41af4e398fd78c381216969a43391a5..1d54747118022d5dcba2e1042ea90636c59968e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,11 +7,6 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - build: stage: build script: @@ -19,4 +14,4 @@ build: artifacts: paths: - app/build/outputs/apk/ - \ No newline at end of file + - app/build/reports/ \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index dd817fcb6cbd42f2463990911f9c53da8306bc17..72ab969a42cc297d9683b07872c99fcebae88c15 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,96 +1,122 @@ -apply plugin: 'com.android.application' - -apply plugin: 'kotlin-android' - -apply plugin: 'kotlin-android-extensions' +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-android-extensions' + id 'kotlin-kapt' +} android { - compileSdkVersion 28 - buildToolsVersion '28.0.3' + compileSdkVersion 29 + buildToolsVersion '29.0.2' + defaultConfig { applicationId "foundation.e.apps" - minSdkVersion 21 - targetSdkVersion 27 + minSdkVersion 25 + targetSdkVersion 29 versionCode 10 versionName "1.1.6" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - aaptOptions.cruncherEnabled = false + vectorDrawables.useSupportLibrary = true } + buildTypes { + debug { + applicationIdSuffix ".debug" + } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } - - } - dataBinding { - enabled = true } lintOptions { lintConfig file("lint.xml") disable 'MissingTranslation' } - defaultConfig { - vectorDrawables.useSupportLibrary = true - } - androidExtensions { experimental = true } - aaptOptions{ + aaptOptions { additionalParameters '-I', 'app/e-ui-sdk.jar' } - + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } } dependencies { - def lifecycle_version = "1.1.1" - implementation 'androidx.work:work-runtime:2.3.1' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.appcompat:appcompat:1.3.0-rc01' + implementation "com.google.android.material:material:1.3.0" + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.1.0-alpha01' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' -// implementation 'com.android.support:design:27.1.1' - implementation 'androidx.recyclerview:recyclerview:1.0.0' - implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' - testImplementation 'junit:junit:4.12' + + // eOS + compileOnly files("e-ui-sdk.jar") + + // Preference + implementation "androidx.preference:preference-ktx:1.1.1" + + // Lifecycle + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1" + + // Bouncy Castle implementation 'org.bouncycastle:bcpg-jdk15on:1.60' - implementation "androidx.vectordrawable:vectordrawable:1.0.0" - implementation "androidx.vectordrawable:vectordrawable-animated:1.0.0" - implementation 'com.google.android.material:material:1.1.0-alpha05' + // GSON + implementation 'com.google.code.gson:gson:2.8.6' - def nav_version = "1.0.0-alpha02" - implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0-rc02' -// use -ktx for Kotlin - implementation 'androidx.navigation:navigation-ui-ktx:2.0.0-rc02' + // EventBus + implementation 'org.greenrobot:eventbus:3.2.0' - implementation "androidx.preference:preference-ktx:1.1.0" + // Volley + implementation "com.android.volley:volley:1.2.0" - implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0' + // PhotoView + implementation "com.github.chrisbanes:PhotoView:2.3.0" + // RoundedImageView + implementation "com.makeramen:roundedimageview:2.3.0" + // RecyclerView + implementation 'androidx.recyclerview:recyclerview:1.2.0' - implementation 'com.google.code.gson:gson:2.8.2' - implementation 'com.google.android.material:material:1.0.0' + // WorkManager + implementation 'androidx.work:work-runtime:2.5.0' + + // Android-Iconics implementation 'com.mikepenz:iconics-core:3.1.0@aar' implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar' - implementation 'org.greenrobot:eventbus:3.1.1' - implementation 'com.trello.rxlifecycle3:rxlifecycle-android:3.1.0' - implementation 'com.trello.rxlifecycle3:rxlifecycle-components:3.1.0' - implementation 'com.trello.rxlifecycle3:rxlifecycle-components-preference:3.1.0' - implementation 'com.makeramen:roundedimageview:2.3.0' + // Vectordrawable + def vector_version = "1.1.0" + implementation "androidx.vectordrawable:vectordrawable:$vector_version" + implementation "androidx.vectordrawable:vectordrawable-animated:$vector_version" - // Jackson - implementation "com.fasterxml.jackson.core:jackson-core:2.11.1" - implementation "com.fasterxml.jackson.core:jackson-annotations:2.11.1" - implementation "com.fasterxml.jackson.core:jackson-databind:2.11.1" - implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1" + // Navigation component + def nav_version = "2.3.5" + implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" + implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - implementation 'com.android.volley:volley:1.1.1' + // RxLifecycle + def rxlifecycle_version = "3.1.0" + implementation "com.trello.rxlifecycle3:rxlifecycle-android:$rxlifecycle_version" + implementation "com.trello.rxlifecycle3:rxlifecycle-components:$rxlifecycle_version" + implementation "com.trello.rxlifecycle3:rxlifecycle-components-preference:$rxlifecycle_version" - implementation 'com.github.chrisbanes:PhotoView:2.3.0' - - compileOnly files("e-ui-sdk.jar") + // Jackson + def jackson_version = "2.12.2" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5df8a1836ec6177d0c7a2ac8cf5d51b8e35c48ff..e96f80be0e47936453c542836343f89016c0b9a4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,7 +21,7 @@ . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps -//import androidx.fragment.app.ListFragment import android.annotation.SuppressLint @@ -28,18 +27,14 @@ import android.database.Cursor import android.graphics.Color import android.os.Bundle import android.os.Handler -import android.preference.PreferenceManager -import android.util.Log -import android.util.TypedValue import android.view.MenuItem import android.widget.Toast -import androidx.annotation.ColorInt import androidx.annotation.ColorRes import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.view.ContextThemeWrapper import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import androidx.fragment.app.Fragment +import androidx.preference.PreferenceManager import com.google.android.material.bottomnavigation.BottomNavigationItemView import com.google.android.material.bottomnavigation.BottomNavigationMenuView import com.google.android.material.bottomnavigation.BottomNavigationView @@ -74,18 +69,30 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS private var isReceiverRegistered = false var accentColorOS = 0 + init { + instance = this + } companion object { + private var instance: MainActivity? = null + lateinit var mActivity: MainActivity var sharedPreferences : SharedPreferences?=null val sharedPrefFile = "kotlinsharedpreference" + + /* + * Provides the application context via MainActivity + * @return applicationContext + */ + fun applicationContext(): Context { + return instance!!.applicationContext + } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - //ThemeColors(this); setContentView(R.layout.activity_main) mActivity = this disableCategoryIfOpenSource() @@ -311,6 +318,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == Constants.STORAGE_PERMISSION_REQUEST_CODE && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_DENIED) { Snackbar.make(container, R.string.error_storage_permission_denied, @@ -320,7 +328,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - outState?.putInt(CURRENTLY_SELECTED_FRAGMENT_KEY, currentFragmentId) + outState.putInt(CURRENTLY_SELECTED_FRAGMENT_KEY, currentFragmentId) } override fun onDestroy() { @@ -357,7 +365,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS * */ private fun getAccentColor() { - accentColorOS=this.resources.getColor(R.color.colorAccent); + accentColorOS = this.getColor(R.color.colorAccent); diff --git a/app/src/main/java/foundation/e/apps/MicroGProvider.java b/app/src/main/java/foundation/e/apps/MicroGProvider.java index add8af1cc66a961ec3f9c3e96ffbf93409b887a9..554d81d536f17798bfe58c960bd39c8274597883 100644 --- a/app/src/main/java/foundation/e/apps/MicroGProvider.java +++ b/app/src/main/java/foundation/e/apps/MicroGProvider.java @@ -1,6 +1,21 @@ -package foundation.e.apps; +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ -import java.util.HashMap; +package foundation.e.apps; import android.content.ContentProvider; import android.content.ContentUris; @@ -14,6 +29,8 @@ import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; +import java.util.HashMap; + public class MicroGProvider extends ContentProvider { public static final String PROVIDER_NAME = "foundation.e.apps.micro.status"; diff --git a/app/src/main/java/foundation/e/apps/XAPK/ApkAssetBean.kt b/app/src/main/java/foundation/e/apps/XAPK/ApkAssetBean.kt index 7d8c5e42a3e7ba79e92db02651cf000e2bb8107d..ad8fffc32f1cec6519e5c4e3ad8a766117a39f6c 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/ApkAssetBean.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/ApkAssetBean.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK data class ApkAssetBean( diff --git a/app/src/main/java/foundation/e/apps/XAPK/ApkAssetType.kt b/app/src/main/java/foundation/e/apps/XAPK/ApkAssetType.kt index 311f2fd4e52fcd34e463de216334e4955108ff32..17b90c153f9a36e14dbe543aa087b96a45f38e34 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/ApkAssetType.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/ApkAssetType.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK enum class ApkAssetType(val suffix: String) { diff --git a/app/src/main/java/foundation/e/apps/XAPK/ApksBean.kt b/app/src/main/java/foundation/e/apps/XAPK/ApksBean.kt index 8ed2b54f3c4c04b89c8b3b8c803f6b5e975987fc..c389394de58ea13456fe1eae96ef5c6c1e57b470 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/ApksBean.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/ApksBean.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.annotation.SuppressLint diff --git a/app/src/main/java/foundation/e/apps/XAPK/AppFolder.kt b/app/src/main/java/foundation/e/apps/XAPK/AppFolder.kt index 9104b1bacd1a7d6b08ce9f66b7589fd2f9837cea..eb99f66e749eb8435884e2af88a2885a00850821 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/AppFolder.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/AppFolder.kt @@ -1,7 +1,25 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.os.Environment import foundation.e.apps.BuildConfig +import foundation.e.apps.MainActivity import java.io.File object AppFolder { @@ -34,7 +52,8 @@ object AppFolder { private val appFolder: File? get() { return if (FsUtils.isSdUsable) { - val appFolder = File(Environment.getExternalStorageDirectory(), APP_FOLDER_NAME) + val appContext = MainActivity.applicationContext() + val appFolder = File(appContext.getExternalFilesDir(null), APP_FOLDER_NAME) FsUtils.createOnNotFound(appFolder) } else { null diff --git a/app/src/main/java/foundation/e/apps/XAPK/BaseActivity.kt b/app/src/main/java/foundation/e/apps/XAPK/BaseActivity.kt index bc666485c187c9ad72e775661900e76f62fcba14..2777a2ecec7261959e7971960677e568ca591730 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/BaseActivity.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/BaseActivity.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.os.Bundle diff --git a/app/src/main/java/foundation/e/apps/XAPK/FileWriterUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/FileWriterUtils.kt index 93cdd00f0c9d7716d42d6003e6556c9d28366047..4dd10ad06919d1785285a7f0e49843aa2d6782ae 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/FileWriterUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/FileWriterUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import androidx.annotation.WorkerThread diff --git a/app/src/main/java/foundation/e/apps/XAPK/FormatUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/FormatUtils.kt index 6a938a9a8963a5bc3b3d48f69b462bea843676b8..e2f9a6b46db1e41956a2fdd30b53078a335750b9 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/FormatUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/FormatUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK object FormatUtils { diff --git a/app/src/main/java/foundation/e/apps/XAPK/FsUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/FsUtils.kt index 0b0bc436dd6f294d67aa07d84e9130bdf8ce4832..25fa0c379dae3d3bc1bb1e797021e80204e1e791 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/FsUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/FsUtils.kt @@ -1,7 +1,25 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.os.Environment import android.text.TextUtils +import foundation.e.apps.MainActivity import java.io.File object FsUtils { @@ -11,7 +29,8 @@ object FsUtils { fun getStorageDir(): File? { return if (isSdUsable) { - Environment.getExternalStorageDirectory() + val appContext = MainActivity.applicationContext() + appContext.getExternalFilesDir(null) } else { null } diff --git a/app/src/main/java/foundation/e/apps/XAPK/InstallSplitApksActivity.kt b/app/src/main/java/foundation/e/apps/XAPK/InstallSplitApksActivity.kt index 60f6e49d1135e53f1107ef206782796e42ef3919..dd8c4926be11c1c1e8cbe33041ab122dbccff5e9 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/InstallSplitApksActivity.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/InstallSplitApksActivity.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.app.PendingIntent @@ -8,14 +25,8 @@ import android.content.pm.PackageInstaller import android.os.Build import android.os.Handler import android.os.Looper -import android.text.TextUtils -import android.view.KeyEvent -import android.view.View -import android.widget.TextView import androidx.annotation.RequiresApi import com.makeramen.roundedimageview.BuildConfig -import com.makeramen.roundedimageview.RoundedImageView -import foundation.e.apps.R import java.io.File import java.io.FileInputStream import java.io.IOException @@ -43,7 +54,6 @@ class InstallSplitApksActivity : BaseActivity() { if (apksBean == null || apksBean!!.splitApkPaths.isNullOrEmpty() || apksBean!!.packageName.isEmpty()) { -// SimpleToast.defaultShow(mContext, R.string.install_failed) finish() return } @@ -69,7 +79,7 @@ class InstallSplitApksActivity : BaseActivity() { val pendingIntent = PendingIntent.getActivity(mActivity, 0, intent, 0) val statusReceiver = pendingIntent.intentSender // Commit the session (this will start the installation workflow). - session!!.commit(statusReceiver) + session.commit(statusReceiver) finish() } catch (e: IOException) { e.printStackTrace() @@ -106,7 +116,6 @@ class InstallSplitApksActivity : BaseActivity() { val extras = intent.extras if (PACKAGE_INSTALLED_ACTION == intent.action) { val status = extras!!.getInt(PackageInstaller.EXTRA_STATUS) - val message = extras.getString(PackageInstaller.EXTRA_STATUS_MESSAGE) when (status) { PackageInstaller.STATUS_PENDING_USER_ACTION -> { // This test app isn't privileged, so the user has to confirm the install. @@ -114,7 +123,6 @@ class InstallSplitApksActivity : BaseActivity() { startActivity(confirmIntent) } PackageInstaller.STATUS_SUCCESS -> { -// SimpleToast.defaultShow(this, R.string.install_success) finish() } PackageInstaller.STATUS_FAILURE, @@ -124,7 +132,6 @@ class InstallSplitApksActivity : BaseActivity() { PackageInstaller.STATUS_FAILURE_INCOMPATIBLE, PackageInstaller.STATUS_FAILURE_INVALID, PackageInstaller.STATUS_FAILURE_STORAGE -> { -// SimpleToast.defaultShow(this, R.string.install_failed) finish() } else -> {} @@ -147,16 +154,7 @@ class InstallSplitApksActivity : BaseActivity() { } } -// override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { -// return if (keyCode == KeyEvent.KEYCODE_BACK) { -// true -// } else { -// super.onKeyDown(keyCode, event) -// } -// } } -private fun Intent.putExtra(keY_PARAM: String, apksBean: ApksBean) { -} diff --git a/app/src/main/java/foundation/e/apps/XAPK/IntentUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/IntentUtils.kt index ac1da171b6a4fc5d1c03b196cb82c7544cfc03bf..079b591af6b7ec8003a79681782e74769abf7bce 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/IntentUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/IntentUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.content.Context @@ -11,9 +28,7 @@ object IntentUtils { Intent().apply { this.action = Intent.ACTION_VIEW this.flags = Intent.FLAG_ACTIVITY_NEW_TASK - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - this.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION - } + this.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION this.setDataAndType(UriUtils.fromFileProvider(mContext, File(filePath)), "application/vnd.android.package-archive") mContext.startActivity(this) } diff --git a/app/src/main/java/foundation/e/apps/XAPK/JsonUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/JsonUtils.kt index 3f01b62702da3faaa25f3b05c5ddd084a4bf0afe..74283eeb7e15c61158a3edf0da69b1812ced85e1 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/JsonUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/JsonUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import com.google.gson.GsonBuilder diff --git a/app/src/main/java/foundation/e/apps/XAPK/LaunchUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/LaunchUtils.kt index ad552b77ecf968927fbc1a2b67d8ee3c504df4cb..c6bc1f42f8d058dba9cdd792caf58ef03a51543d 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/LaunchUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/LaunchUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.content.Context diff --git a/app/src/main/java/foundation/e/apps/XAPK/LocaleUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/LocaleUtils.kt index e56118ebdd326b0f4d729ebf22a329b3f0452d80..2b8abdea318c89103afb2ae675b29f869db97474 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/LocaleUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/LocaleUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.os.Build @@ -7,44 +24,17 @@ import java.util.* class LocaleUtils { -// val appLocal: Locale -// get() { -// val localValue = Settings.languageValue -// return if (TextUtils.equals(localValue, MainActivity.mActivity.getString(R.string.language_auto_value))) { -// systemLocal -// } else { -// forLanguageTag(localValue) -// } -// } val systemLocal: Locale get() { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - LocaleList.getDefault().get(0) - } else { - Locale.getDefault() - } + return LocaleList.getDefault().get(0) } -// val appLocalTag: String -// get() { -// return toLanguageTag(appLocal) -// } private fun forLanguageTag(languageTag: String): Locale { - return if (Build.VERSION.SDK_INT >= 21) { - Locale.forLanguageTag(languageTag) - } else { - val parts = languageTag.split("-".toRegex()).toTypedArray() - if (parts.size == 1) - Locale(parts[0]) - else if (parts.size == 2 || parts.size == 3 && parts[2].startsWith("#")) - Locale(parts[0], parts[1]) - else - Locale(parts[0], parts[1], parts[2]) - } + return Locale.forLanguageTag(languageTag) } private fun toLanguageTag(locale: Locale): String { diff --git a/app/src/main/java/foundation/e/apps/XAPK/StringUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/StringUtils.kt index abb8ab733d123faffd78e6230b91236b83543b70..210211a3761c88a9499f9b79273a6c43bbb96773 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/StringUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/StringUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK diff --git a/app/src/main/java/foundation/e/apps/XAPK/UriUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/UriUtils.kt index 54742ec516a1825fb482873af57323cb241d23fd..72b06b44a36a0ac270c8a3656bb44abb9bdb81fe 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/UriUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/UriUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.content.Context @@ -11,10 +28,6 @@ object UriUtils { private val fileProviderPath by lazy { "${BuildConfig.APPLICATION_ID}.fileprovider" } fun fromFileProvider(mContext: Context, file: File): Uri { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - FileProvider.getUriForFile(mContext, fileProviderPath, file) - } else { - Uri.fromFile(file) - } + return FileProvider.getUriForFile(mContext, fileProviderPath, file) } } diff --git a/app/src/main/java/foundation/e/apps/XAPK/ViewUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/ViewUtils.kt index cf878be8b780ca21efc3b743a08860820a6e2493..6d59ca3c9a958899dd2458b9f25cc310057cb764 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/ViewUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/ViewUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.app.ProgressDialog @@ -68,12 +85,6 @@ object ViewUtils { this.dismiss() } } -// when (installError) { -// XApkInstallUtils.InstallError.ObbError -> SimpleToast.defaultShow(mContext, R.string.install_obb_failed) -// XApkInstallUtils.InstallError.LowerVersionError -> SimpleToast.defaultShow(mContext, R.string.xapk_lower_version_error) -// XApkInstallUtils.InstallError.LowerSdkError -> SimpleToast.defaultShow(mContext, R.string.part_xapk_sdk_lower_version_error) -// else -> SimpleToast.defaultShow(mContext, R.string.install_failed) -// } } }) } diff --git a/app/src/main/java/foundation/e/apps/XAPK/XAPKFile.kt b/app/src/main/java/foundation/e/apps/XAPK/XAPKFile.kt index 8c2466f8d534b6846d49db8d55b7c6d493b6856d..d84bff19e649202bc308c6ee9c9b9abb14a7e83d 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XAPKFile.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XAPKFile.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import foundation.e.apps.MainActivity.Companion.mActivity diff --git a/app/src/main/java/foundation/e/apps/XAPK/XApkExpansion.kt b/app/src/main/java/foundation/e/apps/XAPK/XApkExpansion.kt index 29172d9b90c8823f73b0b82b8a973888b2775ab6..72d31987c608618130c4a17fe94a3e5fa14c5f5a 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XApkExpansion.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XApkExpansion.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import com.google.gson.annotations.Expose diff --git a/app/src/main/java/foundation/e/apps/XAPK/XApkInfo.kt b/app/src/main/java/foundation/e/apps/XAPK/XApkInfo.kt index ebc124f4a970ad3d0b8d58e34b262f72e7b26d4e..3c895473d079972d77cd436aff211cd46506a30e 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XApkInfo.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XApkInfo.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK data class XApkInfo(var label: String, diff --git a/app/src/main/java/foundation/e/apps/XAPK/XApkInstallUtils.kt b/app/src/main/java/foundation/e/apps/XAPK/XApkInstallUtils.kt index 73d9a60a2217a783cdfaaf58723702397bdb959e..2b4e3805e12862fdc98c1a64c9070c641defc7a9 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XApkInstallUtils.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XApkInstallUtils.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import android.os.Build @@ -39,21 +56,12 @@ object XApkInstallUtils { } return@Runnable } - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && this.XSplitApks?.size ?: 0 > 1) { - handler.post { - xApkInstallProgressCallback?.onError(InstallError.LowerSdkError) - } - return@Runnable - } if (this.useObbs()) { installXApkObb(zipFile!!, this, xApkInstallProgressCallback) } if (this.useSplitApks()) { installSplitApks(xApkFile, zipFile!!,callback, this, xApkInstallProgressCallback) } -// else { -// installApk(zipFile!!, this, xApkInstallProgressCallback) -// } } } } catch (e: Exception) { @@ -130,8 +138,8 @@ object XApkInstallUtils { for (item in xApkManifest.expansionList!!) { val inputStream = getZipFileInputStream(zipFile, item.xFile, true)!! val obbFile = File(FsUtils.getStorageDir(), item.installPath) - if (!obbFile.parentFile.exists()) { - obbFile.parentFile.mkdirs() + if (obbFile.parentFile?.exists() == false) { + obbFile.parentFile?.mkdirs() } obbSuccess = FileWriterUtils.writeFileFromIS( obbFile, @@ -204,36 +212,6 @@ object XApkInstallUtils { } } -// private fun installApk(zipFile: ZipFile, xApkManifest: XApkManifest, -// xApkInstallProgressCallback: XApkInstallProgressCallback?){ -// val apkFileName = "${xApkManifest.packageName}.apk" -// var isApkSuccess = false -// val tempApk = File(AppFolder.tempFolder, apkFileName) -// val totalLength = getXApkTotalSize(zipFile, xApkManifest) -// getZipFileInputStream(zipFile, apkFileName)?.apply { -// isApkSuccess = FileWriterUtils.writeFileFromIS(tempApk, this, object : FileWriterUtils.FileWriterProgressCallback { -// var percent = 0 -// override fun onProgress(currentOffset: Long) { -// val percent1 = FormatUtils.formatPercent(currentOffset, totalLength) -// if (percent1 > percent) { -// percent = percent1 -// handler.post { -// xApkInstallProgressCallback?.onApkProgress(currentOffset, totalLength,percent) -// } -// } -// } -// }) -// } -// if (isApkSuccess) { -// handler.post { -// xApkInstallProgressCallback?.onCompedApk(tempApk) -// } -// } else { -// handler.post { -// xApkInstallProgressCallback?.onError(InstallError.ApkError) -// } -// } -// } @WorkerThread private fun getZipFileInputStream(zipFile: ZipFile, inputName: String, isRaw: Boolean = false): InputStream? { diff --git a/app/src/main/java/foundation/e/apps/XAPK/XApkManifest.kt b/app/src/main/java/foundation/e/apps/XAPK/XApkManifest.kt index a3ebe003d15698bb2361c271fb74318246e08b1d..1f2afb207946cf40e1f675668a5d215e25e87cc7 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XApkManifest.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XApkManifest.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import com.google.gson.annotations.Expose @@ -56,18 +73,6 @@ data class XApkManifest (@Expose fun useObbs() = !this.expansionList.isNullOrEmpty() -// fun getLocalLabel(): String { -// val localeTag = LocaleUtils().appLocalTag -// var label1 = this.label -// localesLabel?.let { -// if (it.containsKey(localeTag)) { -// it[localeTag]?.let { it2 -> -// label1 = it2 -// } -// } -// } -// return label1 -// } } diff --git a/app/src/main/java/foundation/e/apps/XAPK/XSplitApks.kt b/app/src/main/java/foundation/e/apps/XAPK/XSplitApks.kt index 1a60f8d0f737a07a440d8b54ba178375681412b5..ed952599d6a95acc2e27d7775b7f1fc2e9db68ac 100644 --- a/app/src/main/java/foundation/e/apps/XAPK/XSplitApks.kt +++ b/app/src/main/java/foundation/e/apps/XAPK/XSplitApks.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.XAPK import com.google.gson.annotations.Expose diff --git a/app/src/main/java/foundation/e/apps/api/AllAppsSearchRequest.kt b/app/src/main/java/foundation/e/apps/api/AllAppsSearchRequest.kt index 8a76063db721a480b5eff14a8b3da745e8f78d95..e00b0da5695946e3794debaf05de0a52e8af0a35 100644 --- a/app/src/main/java/foundation/e/apps/api/AllAppsSearchRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/AllAppsSearchRequest.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.api /* diff --git a/app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt b/app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt index ea37d0f6c8afbe1323eaa3ecd09601844016c909..cf7c005466dd0dbd73afb790ba6f4f34e2bb5cf3 100644 --- a/app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/AppDownloadedRequest.kt b/app/src/main/java/foundation/e/apps/api/AppDownloadedRequest.kt index aa652a5e59117f35958c94b6fc33df1f2b122384..29f78c0d1701d7f2105bc6d7f5e407d18275bb5f 100644 --- a/app/src/main/java/foundation/e/apps/api/AppDownloadedRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/AppDownloadedRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt b/app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt index 8271cf1e018c8c3f897fef3e2162fbd464207549..2dae45895a7878a4e439f0f23cf2c590f3e92571 100644 --- a/app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/GitlabDataRequest.kt b/app/src/main/java/foundation/e/apps/api/GitlabDataRequest.kt index 90a84c2b2a5bab4986aa5ab64936d7e51c75d2ae..7596e8b7166ff4cb86d522f92cc233fdedc4f274 100644 --- a/app/src/main/java/foundation/e/apps/api/GitlabDataRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/GitlabDataRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/HomePwaRequest.kt b/app/src/main/java/foundation/e/apps/api/HomePwaRequest.kt index a6fa023940b955d893c9d76ce31b5fcb89c0e99a..c6d2d86b28c6703770e5c397c6f8e6798fd7d044 100644 --- a/app/src/main/java/foundation/e/apps/api/HomePwaRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/HomePwaRequest.kt @@ -1,14 +1,26 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.api import android.content.Context -import android.util.Log -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.annotation.JsonProperty import foundation.e.apps.MainActivity import foundation.e.apps.application.model.Application -import foundation.e.apps.application.model.data.BasicData import foundation.e.apps.application.model.data.PwasBasicData import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.categories.model.Category diff --git a/app/src/main/java/foundation/e/apps/api/HomeRequest.kt b/app/src/main/java/foundation/e/apps/api/HomeRequest.kt index accc4001b7e7256240e55bf24ce3eb540a3b477d..280712b0a92c45b1e312a8461c3d19aef59162c7 100644 --- a/app/src/main/java/foundation/e/apps/api/HomeRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/HomeRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/ListApplicationsRequest.kt b/app/src/main/java/foundation/e/apps/api/ListApplicationsRequest.kt index e3646898312c18616bcfadf76a7a3326979ab785..49854b538e431aa5f9484b52d3021f68546a0d4e 100644 --- a/app/src/main/java/foundation/e/apps/api/ListApplicationsRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/ListApplicationsRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api @@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonProperty import foundation.e.apps.MainActivity.Companion.mActivity import foundation.e.apps.application.model.Application import foundation.e.apps.application.model.data.BasicData -import foundation.e.apps.application.model.release.ReleaseData import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.utils.ApplicationParser import foundation.e.apps.utils.Common diff --git a/app/src/main/java/foundation/e/apps/api/ListCategoriesRequest.kt b/app/src/main/java/foundation/e/apps/api/ListCategoriesRequest.kt index 3283dea051fbc11917767dfb44634e5000ffeece..899c735c2e7e13816cca99a726102eadbe933d1e 100644 --- a/app/src/main/java/foundation/e/apps/api/ListCategoriesRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/ListCategoriesRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/api/ListPwasRequest.kt b/app/src/main/java/foundation/e/apps/api/ListPwasRequest.kt index 87c9edbb962778ad979271cbd4aa6114607f1b5f..ae36c1db76bb19794d886886bd30fdb2d0afcf72 100644 --- a/app/src/main/java/foundation/e/apps/api/ListPwasRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/ListPwasRequest.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.api import android.content.Context diff --git a/app/src/main/java/foundation/e/apps/api/PackageNameSearchRequest.kt b/app/src/main/java/foundation/e/apps/api/PackageNameSearchRequest.kt index de119f1de8d958d0fd0c7d9e98f66e481ee380e4..745ca1a73a6a5919c65521e6e27bdc74d0adf58d 100644 --- a/app/src/main/java/foundation/e/apps/api/PackageNameSearchRequest.kt +++ b/app/src/main/java/foundation/e/apps/api/PackageNameSearchRequest.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.api diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationActivity.kt b/app/src/main/java/foundation/e/apps/application/ApplicationActivity.kt index 46709441ca0223af9b41a93504b8dfc3dd2ba87c..5f5a89f6d7334fabf78e58c1c820dc8f3f89f177 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationActivity.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationActivity.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application @@ -108,7 +108,7 @@ class ApplicationActivity : initialiseDimensions() val applicationPackageName: String? = intent.getStringExtra(APPLICATION_PACKAGE_NAME_KEY) if (!applicationPackageName.isNullOrEmpty()) { - this.applicationPackageName = applicationPackageName!! + this.applicationPackageName = applicationPackageName applicationManagerServiceConnection.bindService(this) } @@ -128,13 +128,11 @@ class ApplicationActivity : } else { toolbar.elevation = defaultElevation } - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - scroll_view.setOnScrollChangeListener { view, ia, ib, ic, id -> - if (view.scrollY == 0) { - toolbar.elevation = 0f - } else { - toolbar.elevation = defaultElevation - } + scroll_view.setOnScrollChangeListener { view, _, _, _, _ -> + if (view.scrollY == 0) { + toolbar.elevation = 0f + } else { + toolbar.elevation = defaultElevation } } } @@ -174,16 +172,6 @@ class ApplicationActivity : override fun onOptionsItemSelected(item: MenuItem?): Boolean { when (item?.itemId) { - /*R.id.action_share -> { - if (::application.isInitialized) { - val shareIntent = Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_TEXT, WEB_STORE_URL + application.basicData!!.id) - type = "text/plain" - } - startActivity(shareIntent) - } - }*/ android.R.id.home -> { finish() } @@ -236,7 +224,7 @@ class ApplicationActivity : // Set the app author - if (basicData.author!!.isNotEmpty()) { + if (basicData.author.isNotEmpty()) { app_author.text = basicData.author } else { app_author.visibility = View.GONE @@ -272,15 +260,14 @@ class ApplicationActivity : // Set the app rating val builder = textColorChange(getText(R.string.not_available).toString()) - if (basicData.ratings!!.rating != -1f) { + if (basicData.ratings.rating != -1f) { app_rating.text = basicData.ratings.rating.toString() + "/5" } else { app_rating.text = builder } - setRatingBorder(basicData.ratings!!.rating) + setRatingBorder(basicData.ratings.rating) app_rating_container.setOnClickListener { - val text = R.string.ok val alertDialog = AlertDialog.Builder(this).create() alertDialog.setIcon(R.drawable.ic_app_rating) @@ -515,7 +502,7 @@ class ApplicationActivity : // Set the app title if (pwasBasicData!!.name.isNotEmpty()) { - app_title.text = pwasBasicData!!.name + app_title.text = pwasBasicData.name } else { app_title.visibility = View.GONE } @@ -529,7 +516,7 @@ class ApplicationActivity : app_description_container.isEnabled = false } - if (pwaFullData!!.category.getTitle().isNotEmpty()) { + if (pwaFullData.category.getTitle().isNotEmpty()) { app_category.text = pwaFullData.category.getTitle() app_category.setOnClickListener { startActivity(Intent(this, CategoryActivity::class.java).apply { @@ -721,9 +708,7 @@ class ApplicationActivity : imageView.setImageBitmap(it) val outValue = TypedValue() theme.resolveAttribute(android.R.attr.selectableItemBackground, outValue, true) - if (android.os.Build.VERSION.SDK_INT >= 23) { - imageView.foreground = getDrawable(outValue.resourceId) - } + imageView.foreground = getDrawable(outValue.resourceId) app_images_container.addView(imageView) imageView.setOnClickListener { _ -> val intent = Intent(this, ScreenshotsActivity::class.java) @@ -737,6 +722,7 @@ class ApplicationActivity : } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == Constants.STORAGE_PERMISSION_REQUEST_CODE) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { application.buttonClicked(this, this) @@ -764,6 +750,6 @@ class ApplicationActivity : } private fun getAccentColor() { - accentColorOS = this.resources.getColor(R.color.colorAccent); + accentColorOS = this.getColor(R.color.colorAccent); } } diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationDescriptionActivity.kt b/app/src/main/java/foundation/e/apps/application/ApplicationDescriptionActivity.kt index 9110817a58927917aeadfa49083fb952cec831d9..2f627601d7690ad9e34d8ccdd63e3370098b9962 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationDescriptionActivity.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationDescriptionActivity.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationViewHolder.kt b/app/src/main/java/foundation/e/apps/application/ApplicationViewHolder.kt index 07626fa01b008462cc0d79e41b7f5cf43ccc4afa..08e6ff44989e50ad56d37da06d707abf71deeea7 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationViewHolder.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationViewHolder.kt @@ -1,25 +1,24 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application import android.annotation.SuppressLint import android.app.Activity -import android.content.Context import android.graphics.Bitmap import android.graphics.Color import android.view.Gravity @@ -28,6 +27,7 @@ import android.widget.Button import android.widget.ImageView import android.widget.RatingBar import android.widget.TextView +import androidx.appcompat.content.res.AppCompatResources import androidx.recyclerview.widget.RecyclerView import com.google.android.material.snackbar.Snackbar import foundation.e.apps.R @@ -45,7 +45,6 @@ import foundation.e.apps.utils.Error import foundation.e.apps.utils.Execute import kotlinx.android.synthetic.main.application_list_item.view.* import kotlinx.android.synthetic.main.install_button_layout.view.* -import java.lang.Exception class ApplicationViewHolder(private val activity: Activity, private val view: View, accentColorOS: Int) : @@ -82,7 +81,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi if (0 != this.accentColorOS) { installButton.setBackgroundColor(this.accentColorOS) } - installButton?.setOnClickListener { + installButton.setOnClickListener { if (application?.fullData != null && application!!.fullData!!.getLastVersion() == null) { Snackbar.make(view, activity.getString( @@ -107,14 +106,14 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi if (app.basicData != null) { this.application?.removeListener(this) this.application = app - icon.setImageDrawable(view.context.resources.getDrawable(R.drawable.ic_app_default)) + icon.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.ic_app_default)) application!!.loadIcon(this) application!!.addListener(this) title.text = application!!.basicData!!.name author.text = application!!.basicData!!.author - ratingBar.rating = application!!.basicData!!.ratings!!.rating!! - if (application!!.basicData!!.ratings!!.rating != -1f) { - rating.text = application!!.basicData!!.ratings!!.rating.toString() + ratingBar.rating = application!!.basicData!!.ratings.rating!! + if (application!!.basicData!!.ratings.rating != -1f) { + rating.text = application!!.basicData!!.ratings.rating.toString() } else { rating.text = activity.getString(R.string.not_available) } @@ -126,7 +125,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi } else { this.application?.removeListener(this) this.application = app - icon.setImageDrawable(view.context.resources.getDrawable(R.drawable.ic_app_default)) + icon.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.ic_app_default)) application!!.addListener(this) if (application!!.searchAppsBasicData != null) { if (application!!.searchAppsBasicData!!.is_pwa) { @@ -153,8 +152,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi override fun stateChanged(state: State) { Execute({}, { - // installButton.setBackgroundResource(R.drawable.app_install_border_simple) - installButton?.text = activity.getString(state.installButtonTextId) + installButton.text = activity.getString(state.installButtonTextId) when (state) { @@ -171,32 +169,32 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi State.INSTALLED -> { - installButton?.isEnabled = + installButton.isEnabled = Common.appHasLaunchActivity(activity, application!!.packageName) if (0 != this.accentColorOS) { - installButton!!.setBackgroundColor(this.accentColorOS) + installButton.setBackgroundColor(this.accentColorOS) } else { - installButton!!.setBackgroundResource(R.drawable.app_install_border) + installButton.setBackgroundResource(R.drawable.app_install_border) } installButton.setTextColor(Color.parseColor("#FAFAFA")) } State.INSTALLING -> { - installButton?.isEnabled = false + installButton.isEnabled = false } State.NOT_UPDATED -> { installButton.setTextColor(Color.parseColor("#FAFAFA")) if (0 != this.accentColorOS) { - installButton!!.setBackgroundColor(this.accentColorOS) + installButton.setBackgroundColor(this.accentColorOS) } else { - installButton!!.setBackgroundResource(R.drawable.app_install_border) + installButton.setBackgroundResource(R.drawable.app_install_border) } - installButton?.isEnabled = true + installButton.isEnabled = true } else -> { installButton.setTextColor(Color.parseColor("#0088ED")) - installButton?.isEnabled = true + installButton.isEnabled = true } } @@ -211,7 +209,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi @SuppressLint("SetTextI18n") override fun notifyDownloadProgress(count: Int, total: Int) { installButton.setGravity(Gravity.CENTER) - installButton?.text = ((toMiB(count) / toMiB(total)) * 100).toInt().toString() + "%" + installButton.text = ((toMiB(count) / toMiB(total)) * 100).toInt().toString() + "%" installButton.setTextColor(Color.parseColor("#0088ED")) installButton.setBackgroundResource(R.drawable.app_installing_border_simple) } diff --git a/app/src/main/java/foundation/e/apps/application/ScreenshotsActivity.kt b/app/src/main/java/foundation/e/apps/application/ScreenshotsActivity.kt index 25f6aba8c885ad4a978835ece75ae4aa65c38ce8..8dc9714be228cb8e7f2c7f91990c2238385422db 100644 --- a/app/src/main/java/foundation/e/apps/application/ScreenshotsActivity.kt +++ b/app/src/main/java/foundation/e/apps/application/ScreenshotsActivity.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application @@ -55,7 +55,7 @@ class ScreenshotsActivity : AppCompatActivity(), ApplicationManagerServiceConnec val applicationPackageName: String? = intent.getStringExtra(Constants.APPLICATION_PACKAGE_NAME_KEY) if (!applicationPackageName.isNullOrEmpty()) { - this.applicationPackageName = applicationPackageName!! + this.applicationPackageName = applicationPackageName applicationManagerServiceConnection.bindService(this) } } @@ -75,7 +75,7 @@ class ScreenshotsActivity : AppCompatActivity(), ApplicationManagerServiceConnec screenshotsCarousel = screenshots_carousel screenshotsCarousel.visibility = View.GONE - pwasBasicData!!.loadImagesAsyncly { + pwasBasicData.loadImagesAsyncly { if (it.isNotEmpty()) { screenshotsCarousel.adapter = ScreenshotsCarouselAdapter(this, it) screenshotsCarousel.setCurrentItem(lastSelectedScreenshotIndex, false) @@ -100,7 +100,7 @@ class ScreenshotsActivity : AppCompatActivity(), ApplicationManagerServiceConnec override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) if (::screenshotsCarousel.isInitialized) { - outState?.putInt(last_selected_screenshot_key, screenshotsCarousel.currentItem) + outState.putInt(last_selected_screenshot_key, screenshotsCarousel.currentItem) } } diff --git a/app/src/main/java/foundation/e/apps/application/ScreenshotsCarouselAdapter.kt b/app/src/main/java/foundation/e/apps/application/ScreenshotsCarouselAdapter.kt index 465f82e8d9a0b0649ed71f608e3ce45e184953f9..522f9a2c50e2fa4efcd1513a837f900469da9682 100644 --- a/app/src/main/java/foundation/e/apps/application/ScreenshotsCarouselAdapter.kt +++ b/app/src/main/java/foundation/e/apps/application/ScreenshotsCarouselAdapter.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application diff --git a/app/src/main/java/foundation/e/apps/application/SmallApplicationViewHolder.kt b/app/src/main/java/foundation/e/apps/application/SmallApplicationViewHolder.kt index f5d4934ae94924f9d686a87ac33b4b369056c9ee..7292b819dafd5a9cbde48dbefe9d269605aaeeb6 100644 --- a/app/src/main/java/foundation/e/apps/application/SmallApplicationViewHolder.kt +++ b/app/src/main/java/foundation/e/apps/application/SmallApplicationViewHolder.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application @@ -28,6 +28,7 @@ import android.view.animation.Animation import android.widget.Button import android.widget.ImageView import android.widget.TextView +import androidx.appcompat.content.res.AppCompatResources import androidx.recyclerview.widget.RecyclerView import com.google.android.material.snackbar.Snackbar import foundation.e.apps.R @@ -88,14 +89,14 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie if(app.basicData!=null) { this.application?.removeListener(this) this.application = app - icon.setImageDrawable(view.context.resources.getDrawable(R.drawable.ic_app_default)) + icon.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.ic_app_default)) application!!.loadIcon(this) application!!.addListener(this) title.text = application!!.basicData!!.name }else if(app.pwabasicdata!=null){ this.application?.removeListener(this) this.application = app - icon.setImageDrawable(view.context.resources.getDrawable(R.drawable.ic_app_default)) + icon.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.ic_app_default)) application!!.PwaloadIcon(this) application!!.addListener(this) title.text = application!!.pwabasicdata!!.name diff --git a/app/src/main/java/foundation/e/apps/application/model/Application.kt b/app/src/main/java/foundation/e/apps/application/model/Application.kt index af04748d4cf6ba4788017ee8664f3e6ec17d88f7..beb5706bc730344d3e06a3e25171dc2f44f3a849 100644 --- a/app/src/main/java/foundation/e/apps/application/model/Application.kt +++ b/app/src/main/java/foundation/e/apps/application/model/Application.kt @@ -1,35 +1,29 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model import android.Manifest -import android.R import android.app.Activity import android.app.DownloadManager import android.content.Context import android.content.Intent import android.content.pm.PackageManager -import android.util.Log -import android.util.TypedValue -import androidx.annotation.ColorInt -import androidx.appcompat.view.ContextThemeWrapper import foundation.e.apps.MainActivity.Companion.mActivity -import foundation.e.apps.pwa.PwaInstaller import foundation.e.apps.XAPK.XAPKFile import foundation.e.apps.api.AppDetailRequest import foundation.e.apps.api.AppDownloadedRequest @@ -38,6 +32,7 @@ import foundation.e.apps.application.model.State.* import foundation.e.apps.application.model.data.* import foundation.e.apps.application.model.release.ReleaseData import foundation.e.apps.applicationmanager.ApplicationManager +import foundation.e.apps.pwa.PwaInstaller import foundation.e.apps.utils.* import java.util.concurrent.atomic.AtomicInteger @@ -84,12 +79,10 @@ class Application(val packageName: String, private val applicationManager: Appli stateManager.find(context, basicData!!) } else if (searchAppsBasicData != null) { if (searchAppsBasicData!!.is_pwa) { -// stateManager.pwaFind() } else { stateManager.searchAppsFind(context, searchAppsBasicData!!) } } else if (pwabasicdata != null) { -// stateManager.pwaFind() } } @@ -100,7 +93,7 @@ class Application(val packageName: String, private val applicationManager: Appli } fun pwaInstall(context: Context) { - var error: Error? = null + var error: Error? Thread(Runnable { error = assertFullData(context) @@ -154,15 +147,11 @@ class Application(val packageName: String, private val applicationManager: Appli } private fun canWriteStorage(activity: Activity): Boolean { - return if (android.os.Build.VERSION.SDK_INT >= 23) { - if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) - != PackageManager.PERMISSION_GRANTED) { - activity.requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), - Constants.STORAGE_PERMISSION_REQUEST_CODE) - false - } else { - true - } + return if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED) { + activity.requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), + Constants.STORAGE_PERMISSION_REQUEST_CODE) + false } else { true } @@ -208,7 +197,6 @@ class Application(val packageName: String, private val applicationManager: Appli } else { true } - true } override fun onDownloadComplete(context: Context, status: Int) { @@ -219,7 +207,7 @@ class Application(val packageName: String, private val applicationManager: Appli Execute({ AppDownloadedRequest(basicData!!.id,fullData!!.getLastVersion()?.apkArchitecture).request() }, {}) - if(info.isXapk(fullData!!,basicData)){ + if(info.isXapk(fullData!!)){ isInstalling=true XAPKFile(info.getxApkFile(context,basicData!!),this) } @@ -290,7 +278,7 @@ class Application(val packageName: String, private val applicationManager: Appli private fun findBasicData(context: Context): Error? { var error: Error? = null if (Common.isNetworkAvailable(context)) { - PackageNameSearchRequest(packageName!!).request { applicationError, searchResult -> + PackageNameSearchRequest(packageName).request { applicationError, searchResult -> when (applicationError) { null -> { error = Error.NO_RESULTS @@ -480,7 +468,7 @@ class Application(val packageName: String, private val applicationManager: Appli */ fun getAccentColor(context: Context): Int { - val color =context.resources.getColor(foundation.e.apps.R.color.colorAccent); + val color = context.getColor(foundation.e.apps.R.color.colorAccent); return color; } diff --git a/app/src/main/java/foundation/e/apps/application/model/ApplicationInfo.kt b/app/src/main/java/foundation/e/apps/application/model/ApplicationInfo.kt index 47935086b0937e0a760036a60f8d2be161a06f89..ec6e30dda7f904318b81f5cd8c82d79b7da338f1 100644 --- a/app/src/main/java/foundation/e/apps/application/model/ApplicationInfo.kt +++ b/app/src/main/java/foundation/e/apps/application/model/ApplicationInfo.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model @@ -21,7 +21,7 @@ import android.content.Context import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.os.Environment -import android.util.Log +import androidx.core.content.pm.PackageInfoCompat import foundation.e.apps.application.model.data.BasicData import foundation.e.apps.application.model.data.FullData import foundation.e.apps.utils.Common @@ -63,7 +63,7 @@ class ApplicationInfo(private val packageName: String) { val updateVersionCode = matcher.group() .replace("(", "") .replace(")", "") - return (updateVersionCode.toInt() <= packageInfo.versionCode) + return updateVersionCode.toLong() <= PackageInfoCompat.getLongVersionCode(packageInfo) } catch (exception: Exception) { } } @@ -111,19 +111,19 @@ class ApplicationInfo(private val packageName: String) { Installer(data.packageName, getApkFile(context, data), callback).install(context) } - fun isXapk(fullData: FullData, basicData: BasicData?): Boolean { + fun isXapk(fullData: FullData): Boolean { return fullData.getLastVersion()!!.is_xapk && fullData.getLastVersion()?.downloadLink!!.endsWith(".xapk") } fun getApkOrXapkFileName(fullData: FullData, basicData: BasicData): String? { - if (isXapk(fullData, basicData)) { + if (isXapk(fullData)) { return getxApkFilename(basicData) } else return getApkFilename(basicData) } fun getApkOrXapkFile(context: Context, fullData: FullData, basicData: BasicData): File { - if (isXapk(fullData, basicData)) { + if (isXapk(fullData)) { return getxApkFile(context, basicData) } else return getApkFile(context, basicData) diff --git a/app/src/main/java/foundation/e/apps/application/model/ApplicationStateListener.kt b/app/src/main/java/foundation/e/apps/application/model/ApplicationStateListener.kt index 9f6cfcee64af87dbec231aed8c2cbc5bd3554a2e..0d4badcba97d6930aea986acde1c43cb3772fc18 100644 --- a/app/src/main/java/foundation/e/apps/application/model/ApplicationStateListener.kt +++ b/app/src/main/java/foundation/e/apps/application/model/ApplicationStateListener.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/Downloader.kt b/app/src/main/java/foundation/e/apps/application/model/Downloader.kt index 6c3b51bd3d024a09c40798a1fde6ad4ea7a93db1..39331aae7be280fe33ca110db18ea97d4ed5c83a 100644 --- a/app/src/main/java/foundation/e/apps/application/model/Downloader.kt +++ b/app/src/main/java/foundation/e/apps/application/model/Downloader.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model @@ -25,9 +25,7 @@ import android.content.IntentFilter import android.net.Uri import android.os.AsyncTask import android.os.Environment -import android.util.Log import foundation.e.apps.R -import foundation.e.apps.application.model.data.BasicData import foundation.e.apps.application.model.data.FullData import foundation.e.apps.utils.Constants @@ -60,7 +58,7 @@ class Downloader(private val applicationInfo: ApplicationInfo, } fun download(context: Context) { - if (fullData?.getLastVersion() != null) { + if (fullData.getLastVersion() != null) { downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager registerReceivers(context) initialiseDownloadManagerRequest(context) @@ -96,7 +94,7 @@ class Downloader(private val applicationInfo: ApplicationInfo, request = DownloadManager.Request( Uri.parse( - Constants.DOWNLOAD_URL + fullData?.getLastVersion()!!.downloadLink)) + Constants.DOWNLOAD_URL + fullData.getLastVersion()!!.downloadLink)) .apply { setTitle(fullData.basicData.name) setDescription(context.getString(R.string.download_notification_description)) @@ -158,7 +156,7 @@ class Downloader(private val applicationInfo: ApplicationInfo, unregisterReceivers(context) val status = getDownloadStatus() if (status != null && status == DownloadManager.STATUS_SUCCESSFUL) { - fullData?.let { + fullData.let { IntegrityVerificationTask( applicationInfo, it, diff --git a/app/src/main/java/foundation/e/apps/application/model/DownloaderInterface.kt b/app/src/main/java/foundation/e/apps/application/model/DownloaderInterface.kt index 7c2ddb12765f72afa303e2405e604d05b4cf3bda..12fe115de2fb6628853fb42e94da650d3dce5599 100644 --- a/app/src/main/java/foundation/e/apps/application/model/DownloaderInterface.kt +++ b/app/src/main/java/foundation/e/apps/application/model/DownloaderInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/Installer.kt b/app/src/main/java/foundation/e/apps/application/model/Installer.kt index 37f349adfc365238e1fed980769a3764a2b567c7..2aa4f615c6ff4a732a5e16ab3e0bd3e093a45f1b 100644 --- a/app/src/main/java/foundation/e/apps/application/model/Installer.kt +++ b/app/src/main/java/foundation/e/apps/application/model/Installer.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model @@ -61,11 +61,7 @@ class Installer(private val packageName: String, } private fun requestApplicationInstall(context: Context) { - val uri = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { - FileProvider.getUriForFile(context, context.packageName + ".provider", apk) - } else { - Uri.fromFile(apk) - } + val uri = FileProvider.getUriForFile(context, context.packageName + ".provider", apk) val intent = Intent(Intent.ACTION_INSTALL_PACKAGE) intent.action = Intent.ACTION_VIEW intent.setDataAndType(uri, "application/vnd.android.package-archive") @@ -141,7 +137,7 @@ class Installer(private val packageName: String, private var receiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action == Intent.ACTION_PACKAGE_ADDED && - (intent.data.encodedSchemeSpecificPart == packageName)) { + (intent.data?.encodedSchemeSpecificPart == packageName)) { Log.i(TAG, "Broadcast received") var path = apk.absolutePath.split("Download") //delete all APK file after install diff --git a/app/src/main/java/foundation/e/apps/application/model/InstallerInterface.kt b/app/src/main/java/foundation/e/apps/application/model/InstallerInterface.kt index 9455393be98826785fa29e84a83b7e56eecdf84d..3476e28aaa4b62fb1fce582618f1a45a7dadde42 100644 --- a/app/src/main/java/foundation/e/apps/application/model/InstallerInterface.kt +++ b/app/src/main/java/foundation/e/apps/application/model/InstallerInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt b/app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt index 3df24a406b8fef5091e6730e623b5e44691f5ff2..e018f6c723dfcd59eedd4d46f4c632c65bc05995 100644 --- a/app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt +++ b/app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/State.kt b/app/src/main/java/foundation/e/apps/application/model/State.kt index 6f7b877eaeeffe400785ba7d227604c92c32ada4..c1f7393888ee66ce700812da372f3397bd1e2139 100644 --- a/app/src/main/java/foundation/e/apps/application/model/State.kt +++ b/app/src/main/java/foundation/e/apps/application/model/State.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/StateManager.kt b/app/src/main/java/foundation/e/apps/application/model/StateManager.kt index d4183ec191adbd70c35bc9c50f40d655bf98fc40..7f4e3df51776d0bfca72b74239ff0d5ce22287c8 100644 --- a/app/src/main/java/foundation/e/apps/application/model/StateManager.kt +++ b/app/src/main/java/foundation/e/apps/application/model/StateManager.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model @@ -43,7 +43,7 @@ class StateManager(private val info: ApplicationInfo, private val app: Applicati } else if (appManager.isInstalling(app) && app.isInstalling) { State.INSTALLING } else if (PreferenceStorage(context).getBoolean(context.getString(R.string.prefs_microg_vrsn_installed), false)) { - if (info.isLastVersionInstalled(context, basicData.lastVersionNumber ?: "")) { + if (info.isLastVersionInstalled(context, basicData.lastVersionNumber)) { State.NOT_UPDATED } else { State.INSTALLED @@ -76,7 +76,7 @@ class StateManager(private val info: ApplicationInfo, private val app: Applicati } else if (appManager.isInstalling(app) && app.isInstalling) { State.INSTALLING } else if (PreferenceStorage(context).getBoolean(context.getString(R.string.prefs_microg_vrsn_installed), false)) { - if (info.isLastVersionInstalled(context, basicData.lastVersionNumber ?: "")) { + if (info.isLastVersionInstalled(context, basicData.lastVersionNumber)) { State.NOT_UPDATED } else { State.INSTALLED diff --git a/app/src/main/java/foundation/e/apps/application/model/ThreadedListeners.kt b/app/src/main/java/foundation/e/apps/application/model/ThreadedListeners.kt index c700a013246fcec2e6e49dd723823a4de843e3d8..da890ee03405173752ef3f1006abd17dcdc6204f 100644 --- a/app/src/main/java/foundation/e/apps/application/model/ThreadedListeners.kt +++ b/app/src/main/java/foundation/e/apps/application/model/ThreadedListeners.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/Version.kt b/app/src/main/java/foundation/e/apps/application/model/Version.kt index c5e801849b861468e3e5f4a048c9aa34ea140d2f..ae17ad069b3c707aad38cf17a333805b101d91a1 100644 --- a/app/src/main/java/foundation/e/apps/application/model/Version.kt +++ b/app/src/main/java/foundation/e/apps/application/model/Version.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model diff --git a/app/src/main/java/foundation/e/apps/application/model/data/BasicData.kt b/app/src/main/java/foundation/e/apps/application/model/data/BasicData.kt index ef5461b6202275335624e8a84020d20b4c0ed184..4921ec3a680c3a1b70bdafaa7016ffdfd34d026a 100644 --- a/app/src/main/java/foundation/e/apps/application/model/data/BasicData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/data/BasicData.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model.data diff --git a/app/src/main/java/foundation/e/apps/application/model/data/FullData.kt b/app/src/main/java/foundation/e/apps/application/model/data/FullData.kt index 62d58568f4cec5d23bc04b7e2749071192505658..eb352f707f2cd71c19f21ee0f307a0ad40c40050 100644 --- a/app/src/main/java/foundation/e/apps/application/model/data/FullData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/data/FullData.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.model.data @@ -74,7 +74,7 @@ constructor( var latestVersion: Version? = null; val packageName: String - get() = basicData.packageName!! + get() = basicData.packageName fun getLastVersion(): Version? { return if (basicData.latestDownloadableUpdate != "-1") { diff --git a/app/src/main/java/foundation/e/apps/application/model/data/PwaFullData.kt b/app/src/main/java/foundation/e/apps/application/model/data/PwaFullData.kt index 190bbbeb165d30c7751cf602d3d8409e53f3a1a4..83a0084e5232941c0424440200b854daef3514a2 100644 --- a/app/src/main/java/foundation/e/apps/application/model/data/PwaFullData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/data/PwaFullData.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.data import com.fasterxml.jackson.annotation.JsonCreator diff --git a/app/src/main/java/foundation/e/apps/application/model/data/PwasBasicData.kt b/app/src/main/java/foundation/e/apps/application/model/data/PwasBasicData.kt index dc093893058b3a6fd5b84abe83ec6094fdbdd998..6e4b9aa833cfd10254c1aac50f78a4b00f392666 100644 --- a/app/src/main/java/foundation/e/apps/application/model/data/PwasBasicData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/data/PwasBasicData.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.data import android.graphics.Bitmap diff --git a/app/src/main/java/foundation/e/apps/application/model/data/SearchAppsBasicData.kt b/app/src/main/java/foundation/e/apps/application/model/data/SearchAppsBasicData.kt index 18723cb4f6e6d55ab466cbd17338b91921537489..42b234ac530d81bbdc0d380e4cb8d2d4ad987251 100644 --- a/app/src/main/java/foundation/e/apps/application/model/data/SearchAppsBasicData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/data/SearchAppsBasicData.kt @@ -1,12 +1,26 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.data import android.graphics.Bitmap import android.graphics.BitmapFactory -import android.util.Log -import androidx.core.content.res.ResourcesCompat import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import foundation.e.apps.R import foundation.e.apps.application.model.Application import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Error diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Assets.kt b/app/src/main/java/foundation/e/apps/application/model/release/Assets.kt index e1345e5ce09a85847f61835015a5634efb8a8a71..2284c4b9a5df74eab43e7f34924b9bb7f609a5ff 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Assets.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Assets.kt @@ -1,7 +1,23 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName -import foundation.e.apps.application.model.release.Sources data class Assets ( diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Author.kt b/app/src/main/java/foundation/e/apps/application/model/release/Author.kt index ad1a48fd29865dd2833e028359df950f638f9cb3..9b0b630502626adaf275b086785dcbc810903c4c 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Author.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Author.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Commit.kt b/app/src/main/java/foundation/e/apps/application/model/release/Commit.kt index 14d1697615319e92bf5b2d0de3556a12d7558777..825ceb9915720c0203f99b089bfeca9b14d9419d 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Commit.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Commit.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Evidences.kt b/app/src/main/java/foundation/e/apps/application/model/release/Evidences.kt index c910b241eaf66b7e0a4cf42070e8d0862ddafc3d..d5f0e121dec3153930a65931d8f10f6e9c8d2fa2 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Evidences.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Evidences.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Links.kt b/app/src/main/java/foundation/e/apps/application/model/release/Links.kt index c49360291b88ec56535231ca6fe9b993c84e32ef..b6b823ac0c2cdc2f5c0a86f4e0e9640ac0c5d7de 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Links.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Links.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/ReleaseData.kt b/app/src/main/java/foundation/e/apps/application/model/release/ReleaseData.kt index 836861989535624b811cbf98852b0f93f7aae435..b5e826ff012661fc4cb44334955f7a2d3559a73e 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/ReleaseData.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/ReleaseData.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/Sources.kt b/app/src/main/java/foundation/e/apps/application/model/release/Sources.kt index 8444ed18adfe795607c3a1d6c4dfc76975a11b0c..02898941011d808b4d171ae2143a23d30cb0cfe7 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/Sources.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/Sources.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/model/release/_links.kt b/app/src/main/java/foundation/e/apps/application/model/release/_links.kt index fec4878db72d463e6ee4299aa7396a8ea560dd5a..2d894c3a6c50214f8ca5333fb3f78fdf1165faae 100644 --- a/app/src/main/java/foundation/e/apps/application/model/release/_links.kt +++ b/app/src/main/java/foundation/e/apps/application/model/release/_links.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.application.model.release import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModel.kt b/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModel.kt index 244474ea8f7f36e67c74f267cfca7c21c1f6eeaf..2e84c0e3330f845db8e3f33d0cd6faa73ff40757 100644 --- a/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModel.kt +++ b/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.viewmodel diff --git a/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModelInterface.kt b/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModelInterface.kt index d213eed76c3c7c5e8b0b66c897111210d5c17c9c..cf60fb5c466bae547557227f4f52d5a8b7acaa04 100644 --- a/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/application/viewmodel/ApplicationViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.application.viewmodel diff --git a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManager.kt b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManager.kt index 1fa9a1960916d19036a3f666fde00650613b987a..3cbb85320dd7512d554911e0b75caca98885ac5c 100644 --- a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManager.kt +++ b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManager.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.applicationmanager diff --git a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerService.kt b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerService.kt index a6e1009596e14af34b8ec8b7cb1599cae5549eb3..20c81aad655e7f198a28ecea8916b7f292714ce4 100644 --- a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerService.kt +++ b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerService.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.applicationmanager diff --git a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnection.kt b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnection.kt index aab4df5d142e0a3536fcb0b50f4e6ea2091ded31..3cdc90b2658877bf7f9fcba60192c0805dc9054d 100644 --- a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnection.kt +++ b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnection.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.applicationmanager diff --git a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnectionCallback.kt b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnectionCallback.kt index 1d6015b7fdd6bcbdc3492ac0495ca380e16f6210..9448cf2a118b6bbff034949082d8cec7322f71e3 100644 --- a/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnectionCallback.kt +++ b/app/src/main/java/foundation/e/apps/applicationmanager/ApplicationManagerServiceConnectionCallback.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.applicationmanager diff --git a/app/src/main/java/foundation/e/apps/categories/ApplicationsFragment.kt b/app/src/main/java/foundation/e/apps/categories/ApplicationsFragment.kt index f351e0ffa43ac1d289ef8f9653e0aff076b8c218..94aafebca3bbc40d28096cd08c6a862220658c40 100644 --- a/app/src/main/java/foundation/e/apps/categories/ApplicationsFragment.kt +++ b/app/src/main/java/foundation/e/apps/categories/ApplicationsFragment.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories @@ -25,7 +25,7 @@ import android.view.ViewGroup import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import foundation.e.apps.R import foundation.e.apps.categories.model.Category @@ -39,40 +39,38 @@ class ApplicationsFragment() : Fragment() { var color:Int = 0; override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - categoriesViewModel = ViewModelProviders.of(activity!!).get(CategoriesViewModel::class.java) + categoriesViewModel = ViewModelProvider(this).get(CategoriesViewModel::class.java) val view = inflater.inflate(R.layout.fragment_application_categories, container, false) view.categories_list.layoutManager = LinearLayoutManager(context) - color = arguments!!.getInt("color",0) + color = requireArguments().getInt("color",0) view.categories_list.visibility = View.GONE view.progress_bar.visibility = View.VISIBLE view.error_container.visibility = View.GONE view.findViewById(R.id.error_resolve).setOnClickListener { view.progress_bar.visibility = View.VISIBLE - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } view.error_resolve.setTextColor(Color.parseColor("#ffffff")) - if (color != null) { - view.error_resolve.setBackgroundColor(color) - } + view.error_resolve.setBackgroundColor(color) // Bind to the list of applications categories - categoriesViewModel.getApplicationsCategories().observe(this, Observer { + categoriesViewModel.getApplicationsCategories().observe(viewLifecycleOwner, Observer { if (it!!.isNotEmpty()) { //Add New Category if (!it.any { Category -> Category.id == "system_apps" }) it.add(Category("system_apps")) - view.categories_list.adapter = CategoriesListAdapter(it, color) + view.categories_list.adapter = context?.let { context -> CategoriesListAdapter(context, it, color) } view.categories_list.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } }) // Bind to the screen error - categoriesViewModel.getScreenError().observe(this, Observer { + categoriesViewModel.getScreenError().observe(viewLifecycleOwner, Observer { if (it != null) { - view.error_description.text = activity!!.getString(it.description) + view.error_description.text = requireActivity().getString(it.description) view.error_container.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } else { @@ -81,7 +79,7 @@ class ApplicationsFragment() : Fragment() { }) if (categoriesViewModel.getApplicationsCategories().value!!.isEmpty()) { - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } return view } diff --git a/app/src/main/java/foundation/e/apps/categories/CategoriesFragment.kt b/app/src/main/java/foundation/e/apps/categories/CategoriesFragment.kt index d202b2b2bb85a7f17027dace549ff567994848c8..12a24893e3f3f928ce90867595ef25d67b006c27 100644 --- a/app/src/main/java/foundation/e/apps/categories/CategoriesFragment.kt +++ b/app/src/main/java/foundation/e/apps/categories/CategoriesFragment.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories @@ -20,13 +20,9 @@ package foundation.e.apps.categories import android.content.Context import android.graphics.Color import android.os.Bundle -import android.util.Log -import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.annotation.ColorInt -import androidx.appcompat.view.ContextThemeWrapper import androidx.fragment.app.Fragment import androidx.viewpager.widget.ViewPager import com.google.android.material.tabs.TabLayout @@ -40,15 +36,12 @@ class CategoriesFragment : Fragment() { val view = inflater.inflate(R.layout.fragment_categories, container, false) val tabLayout = view.findViewById(R.id.tab_layout) val viewPager = view.findViewById(R.id.view_pager) - var color = getAccentColor(activity!!); - viewPager.adapter = CategoriesViewPagerAdapter(activity!!.supportFragmentManager, tabLayout.tabCount, color) + var color = getAccentColor(requireActivity()); + viewPager.adapter = CategoriesViewPagerAdapter(requireActivity().supportFragmentManager, tabLayout.tabCount, color) viewPager.addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener(tabLayout)) - if (color != null) { - tabLayout.setSelectedTabIndicatorColor(color); - tabLayout.setTabTextColors(Color.parseColor("#000000"), color); - - }; + tabLayout.setSelectedTabIndicatorColor(color); + tabLayout.setTabTextColors(Color.parseColor("#000000"), color); tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { @@ -73,7 +66,7 @@ class CategoriesFragment : Fragment() { */ fun getAccentColor(context: Context): Int { - val color =context.resources.getColor(R.color.colorAccent); + val color = context.getColor(R.color.colorAccent); return color; diff --git a/app/src/main/java/foundation/e/apps/categories/CategoriesListAdapter.kt b/app/src/main/java/foundation/e/apps/categories/CategoriesListAdapter.kt index 1fc5fe87a42c547fbf60f15f8d31eba6fd6975e5..8e58fb0b2f16b8d63320f25a7358e9745569e6b9 100644 --- a/app/src/main/java/foundation/e/apps/categories/CategoriesListAdapter.kt +++ b/app/src/main/java/foundation/e/apps/categories/CategoriesListAdapter.kt @@ -1,38 +1,39 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories import android.annotation.SuppressLint +import android.content.Context import android.content.Intent -import android.graphics.Color import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.RelativeLayout import android.widget.TextView +import androidx.appcompat.content.res.AppCompatResources import androidx.recyclerview.widget.RecyclerView import foundation.e.apps.R import foundation.e.apps.categories.category.CategoryActivity import foundation.e.apps.categories.model.Category import foundation.e.apps.utils.Constants -class CategoriesListAdapter(private var categories: ArrayList, color: Int?) +class CategoriesListAdapter(private val context: Context, private var categories: ArrayList, color: Int?) : RecyclerView.Adapter() { val color = color; @@ -63,8 +64,7 @@ class CategoriesListAdapter(private var categories: ArrayList, color: override fun onBindViewHolder(holder: CategoryViewHolder, position: Int) { - holder.categoryIcon.setImageDrawable(holder.categoryIcon.resources.getDrawable(categories[position].getIconResource())) - //holder.categoryIcon.setColorFilter(Color.parseColor("#0088ED")) + holder.categoryIcon.setImageDrawable(AppCompatResources.getDrawable(context, categories[position].getIconResource())) if (color != null) { holder.categoryIcon.setColorFilter(color) } diff --git a/app/src/main/java/foundation/e/apps/categories/CategoriesViewPagerAdapter.kt b/app/src/main/java/foundation/e/apps/categories/CategoriesViewPagerAdapter.kt index 076c806a6a1a8105c2a37fb41d5fbf540ddd48a5..9cc10baeb0d046ed9bb4be329435100d3cbf70f4 100644 --- a/app/src/main/java/foundation/e/apps/categories/CategoriesViewPagerAdapter.kt +++ b/app/src/main/java/foundation/e/apps/categories/CategoriesViewPagerAdapter.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories diff --git a/app/src/main/java/foundation/e/apps/categories/GamesFragment.kt b/app/src/main/java/foundation/e/apps/categories/GamesFragment.kt index ab675a803e6f55fdc33c3133f69604cad713ea10..6ee64105c02a88278a533979622cab26b5f71543 100644 --- a/app/src/main/java/foundation/e/apps/categories/GamesFragment.kt +++ b/app/src/main/java/foundation/e/apps/categories/GamesFragment.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories @@ -25,7 +25,7 @@ import android.view.ViewGroup import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import foundation.e.apps.R import foundation.e.apps.categories.viewmodel.CategoriesViewModel @@ -38,37 +38,35 @@ class GamesFragment() : Fragment() { var color:Int = 0; override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - categoriesViewModel = ViewModelProviders.of(activity!!).get(CategoriesViewModel::class.java) + categoriesViewModel = ViewModelProvider(this).get(CategoriesViewModel::class.java) val view = inflater.inflate(R.layout.fragment_games_categories, container, false) view.categories_list.layoutManager = LinearLayoutManager(context) - color = arguments!!.getInt("color",0) + color = requireArguments().getInt("color",0) view.categories_list.visibility = View.GONE view.progress_bar.visibility = View.VISIBLE view.error_container.visibility = View.GONE view.findViewById(R.id.error_resolve).setOnClickListener { view.progress_bar.visibility = View.VISIBLE - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } view.error_resolve.setTextColor(Color.parseColor("#ffffff")) - if (color != null) { - view.error_resolve.setBackgroundColor(color!!) - } + view.error_resolve.setBackgroundColor(color) // Bind to the list of games categories - categoriesViewModel.getGamesCategories().observe(this, Observer { + categoriesViewModel.getGamesCategories().observe(viewLifecycleOwner, Observer { if (it!!.isNotEmpty()) { - view.categories_list.adapter = CategoriesListAdapter(it, color) + view.categories_list.adapter = context?.let { context -> CategoriesListAdapter(context, it, color) } view.categories_list.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } }) // Bind to the screen error - categoriesViewModel.getScreenError().observe(this, Observer { + categoriesViewModel.getScreenError().observe(viewLifecycleOwner, Observer { if (it != null) { - view.error_description.text = activity!!.getString(it.description) + view.error_description.text = requireActivity().getString(it.description) view.error_container.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } else { @@ -77,7 +75,7 @@ class GamesFragment() : Fragment() { }) if (categoriesViewModel.getGamesCategories().value!!.isEmpty()) { - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } return view } diff --git a/app/src/main/java/foundation/e/apps/categories/PwasFragment.kt b/app/src/main/java/foundation/e/apps/categories/PwasFragment.kt index 260dacd830fc748fd5de5003adc12fe194bc3273..9313ad736ae5c4631e8aa1907acf5f9c812c3a67 100644 --- a/app/src/main/java/foundation/e/apps/categories/PwasFragment.kt +++ b/app/src/main/java/foundation/e/apps/categories/PwasFragment.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.categories import android.os.Bundle @@ -7,7 +24,7 @@ import android.view.ViewGroup import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import foundation.e.apps.R import foundation.e.apps.categories.viewmodel.CategoriesViewModel @@ -18,7 +35,7 @@ class PwasFragment : Fragment() { private lateinit var categoriesViewModel: CategoriesViewModel override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - categoriesViewModel = ViewModelProviders.of(activity!!).get(CategoriesViewModel::class.java) + categoriesViewModel = ViewModelProvider(this).get(CategoriesViewModel::class.java) val view = inflater.inflate(R.layout.fragment_application_categories, container, false) view.categories_list.layoutManager = LinearLayoutManager(context) @@ -28,22 +45,22 @@ class PwasFragment : Fragment() { view.error_container.visibility = View.GONE view.findViewById(R.id.error_resolve).setOnClickListener { view.progress_bar.visibility = View.VISIBLE - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } // Bind to the list of pwas categories - categoriesViewModel.getPwasCategories().observe(this, Observer { + categoriesViewModel.getPwasCategories().observe(viewLifecycleOwner, Observer { if (it!!.isNotEmpty()) { - view.categories_list.adapter = CategoriesListAdapter(it, null) + view.categories_list.adapter = context?.let { context -> CategoriesListAdapter(context, it, null) } view.categories_list.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } }) // Bind to the screen error - categoriesViewModel.getScreenError().observe(this, Observer { + categoriesViewModel.getScreenError().observe(viewLifecycleOwner, Observer { if (it != null) { - view.error_description.text = activity!!.getString(it.description) + view.error_description.text = requireActivity().getString(it.description) view.error_container.visibility = View.VISIBLE view.progress_bar.visibility = View.GONE } else { @@ -52,7 +69,7 @@ class PwasFragment : Fragment() { }) if (categoriesViewModel.getPwasCategories().value!!.isEmpty()) { - categoriesViewModel.loadCategories(context!!) + categoriesViewModel.loadCategories(requireContext()) } return view } diff --git a/app/src/main/java/foundation/e/apps/categories/category/CategoryActivity.kt b/app/src/main/java/foundation/e/apps/categories/category/CategoryActivity.kt index 0de57c59af427f624723de8ffc23cf6bb8ae2349..085b0907ac93aca6bc7da9be14af67df86d3ad4b 100644 --- a/app/src/main/java/foundation/e/apps/categories/category/CategoryActivity.kt +++ b/app/src/main/java/foundation/e/apps/categories/category/CategoryActivity.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.category @@ -20,23 +20,19 @@ package foundation.e.apps.categories.category import android.content.pm.PackageManager import android.graphics.Color import android.os.Bundle -import android.util.TypedValue import android.view.MenuItem import android.view.View import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.RelativeLayout import android.widget.TextView -import androidx.annotation.ColorInt import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.view.ContextThemeWrapper import androidx.appcompat.widget.Toolbar import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.snackbar.Snackbar -import foundation.e.apps.MainActivity import foundation.e.apps.R import foundation.e.apps.application.model.Application import foundation.e.apps.applicationmanager.ApplicationManager @@ -71,11 +67,10 @@ class CategoryActivity : AppCompatActivity(), ApplicationManagerServiceConnectio val toolbar = findViewById(R.id.toolbar) setSupportActionBar(toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) - val extras = intent.extras category = intent.getSerializableExtra(CATEGORY_KEY) as Category supportActionBar?.title = category.getTitle() - categoryViewModel = ViewModelProviders.of(this).get(CategoryViewModel::class.java) + categoryViewModel = ViewModelProvider(this).get(CategoryViewModel::class.java) recyclerView = findViewById(R.id.app_list) val loadMoreContainer = findViewById(R.id.load_more_container) progressBar = findViewById(R.id.progress_bar) @@ -168,6 +163,7 @@ class CategoryActivity : AppCompatActivity(), ApplicationManagerServiceConnectio override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == Constants.STORAGE_PERMISSION_REQUEST_CODE && grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_DENIED) { Snackbar.make(container, R.string.error_storage_permission_denied, @@ -202,6 +198,6 @@ class CategoryActivity : AppCompatActivity(), ApplicationManagerServiceConnectio * */ private fun getAccentColor() { - accentColorOS=this.resources.getColor(R.color.colorAccent); + accentColorOS = this.getColor(R.color.colorAccent); } } diff --git a/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModel.kt b/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModel.kt index 999be771bf5fac85c4df6bfaef7b2631f65b88fb..4d89430202103dc306e087c9a8f27fad5ad3764c 100644 --- a/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModel.kt +++ b/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.category.model @@ -20,9 +20,9 @@ package foundation.e.apps.categories.category.model import android.content.Context import androidx.lifecycle.MutableLiveData import foundation.e.apps.MainActivity +import foundation.e.apps.api.GitlabDataRequest import foundation.e.apps.api.ListApplicationsRequest import foundation.e.apps.api.ListPwasRequest -import foundation.e.apps.api.GitlabDataRequest import foundation.e.apps.application.model.Application import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.utils.Common diff --git a/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModelInterface.kt b/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModelInterface.kt index 1e88f5f8a2ee24e162a128dc3ba1d880dca29af8..22a0c647a8e65ebc4e040ab422e17deca036732e 100644 --- a/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/categories/category/model/CategoryModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.category.model diff --git a/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModel.kt b/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModel.kt index 0da34f20df7f7921f2596e4fc5f0ccf417ae7ccd..3a4f296eda8032781e83e4e07c463d6a2d02e542 100644 --- a/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModel.kt +++ b/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.category.viewmodel diff --git a/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModelInterface.kt b/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModelInterface.kt index e6a963bed4d04f0df8696c3d7119edd3f0330387..84212d09d8a6054011b159896136f14b74a78135 100644 --- a/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/categories/category/viewmodel/CategoryViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.category.viewmodel diff --git a/app/src/main/java/foundation/e/apps/categories/model/CategoriesModel.kt b/app/src/main/java/foundation/e/apps/categories/model/CategoriesModel.kt index 7d03951b5c0430e11c6193fca89c0bc05c6fbc62..80b42e9f19c8e11877d7c442af25aa041a31cac1 100644 --- a/app/src/main/java/foundation/e/apps/categories/model/CategoriesModel.kt +++ b/app/src/main/java/foundation/e/apps/categories/model/CategoriesModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.model diff --git a/app/src/main/java/foundation/e/apps/categories/model/CategoriesModelInterface.kt b/app/src/main/java/foundation/e/apps/categories/model/CategoriesModelInterface.kt index 7f4a61f8a1a57e55349811dc1497361b6ea80b36..e84282c77ebd6e19c6f0814cc2728f2a64775793 100644 --- a/app/src/main/java/foundation/e/apps/categories/model/CategoriesModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/categories/model/CategoriesModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.model diff --git a/app/src/main/java/foundation/e/apps/categories/model/Category.kt b/app/src/main/java/foundation/e/apps/categories/model/Category.kt index f19cc271e8be2482beb2b400cbcaf9b872b477dc..d6a81f6c70a988a301bffaf706f8b9225edcfe11 100644 --- a/app/src/main/java/foundation/e/apps/categories/model/Category.kt +++ b/app/src/main/java/foundation/e/apps/categories/model/Category.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.model diff --git a/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModel.kt b/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModel.kt index 62b33e391d11c494bcc2d8a15cd99343887e2d25..4bcc5f293d7269598e2340dda14578e000e5f1ae 100644 --- a/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModel.kt +++ b/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.viewmodel diff --git a/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModelInterface.kt b/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModelInterface.kt index f293201a6ab76901f61350edd474b36286ca2fa4..d312e2379eca874c4e4951f1d068fa192595440d 100644 --- a/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/categories/viewmodel/CategoriesViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.categories.viewmodel diff --git a/app/src/main/java/foundation/e/apps/common/ApplicationListAdapter.kt b/app/src/main/java/foundation/e/apps/common/ApplicationListAdapter.kt index 337dbb1f50a0f133c687e6e4ac01fdb034ddcbe5..02892bfa6a97e18e5de9b853546d4d72133327e5 100644 --- a/app/src/main/java/foundation/e/apps/common/ApplicationListAdapter.kt +++ b/app/src/main/java/foundation/e/apps/common/ApplicationListAdapter.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.common diff --git a/app/src/main/java/foundation/e/apps/common/SmallApplicationListAdapter.kt b/app/src/main/java/foundation/e/apps/common/SmallApplicationListAdapter.kt index a95ee9a20e99f4297f577bef17c385b83623eb46..fcf47b779b9709dfb283fa2eed801759e3289210 100644 --- a/app/src/main/java/foundation/e/apps/common/SmallApplicationListAdapter.kt +++ b/app/src/main/java/foundation/e/apps/common/SmallApplicationListAdapter.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.common diff --git a/app/src/main/java/foundation/e/apps/home/HomeCategory.kt b/app/src/main/java/foundation/e/apps/home/HomeCategory.kt index e7f9903da974db6bd20af5512f56e83341b451ad..0552454fd73098e0d49d11ca4b2e5a8363272078 100644 --- a/app/src/main/java/foundation/e/apps/home/HomeCategory.kt +++ b/app/src/main/java/foundation/e/apps/home/HomeCategory.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home diff --git a/app/src/main/java/foundation/e/apps/home/HomeFragment.kt b/app/src/main/java/foundation/e/apps/home/HomeFragment.kt index e9c5a1ce255eb781f300a7b1e29300d56ac77db9..ec67ec1dd1499a8783f185751ad8bebb826b3a19 100644 --- a/app/src/main/java/foundation/e/apps/home/HomeFragment.kt +++ b/app/src/main/java/foundation/e/apps/home/HomeFragment.kt @@ -1,36 +1,33 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home -//import java.awt.font.ShapeGraphicAttribute.STROKE -//import java.awt.AlphaComposite.SRC_IN import android.graphics.Color import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.viewpager.widget.ViewPager @@ -40,8 +37,6 @@ import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.categories.model.Category import foundation.e.apps.common.SmallApplicationListAdapter import foundation.e.apps.home.viewmodel.HomeViewModel -import kotlinx.android.synthetic.main.error_layout.* -import kotlinx.android.synthetic.main.install_button_layout.* class HomeFragment : Fragment() { @@ -65,12 +60,8 @@ class HomeFragment : Fragment() { } val view = inflater.inflate(R.layout.fragment_home, container, false) - /* if(accentColorOS!=0){ - - view.findViewById(R.id.tv_featured).setTextColor(accentColorOS); - }*/ - homeViewModel = ViewModelProviders.of(activity!!).get(HomeViewModel::class.java) + homeViewModel = ViewModelProvider(this).get(HomeViewModel::class.java) imageCarousel = view.findViewById(R.id.image_carousel) divider = view.findViewById(R.id.divider) categoryList = view.findViewById(R.id.category_list) @@ -92,13 +83,13 @@ class HomeFragment : Fragment() { errorContainer.visibility = View.GONE view.findViewById(R.id.error_resolve).setOnClickListener { progressBar.visibility = View.VISIBLE - homeViewModel.loadCategories(context!!) + homeViewModel.loadCategories(requireContext()) } // Bind image carousel adapter to banner images in view model - homeViewModel.getBannerApplications().observe(this, Observer { + homeViewModel.getBannerApplications().observe(viewLifecycleOwner, Observer { if (homeViewModel.getBannerApplications().value!!.isNotEmpty()) { - imageCarousel.adapter = ImageCarouselAdapter(activity!!, homeViewModel.getBannerApplications().value!!) + imageCarousel.adapter = ImageCarouselAdapter(requireActivity(), homeViewModel.getBannerApplications().value!!) imageCarousel.clipToPadding = false; imageCarousel.setPadding(170, 10, 170, 10); imageCarousel.pageMargin =50 @@ -110,7 +101,7 @@ class HomeFragment : Fragment() { }) // Bind categories adapter to categories in view model - homeViewModel.getCategories().observe(this, Observer { + homeViewModel.getCategories().observe(viewLifecycleOwner, Observer { if (homeViewModel.getCategories().value!!.isNotEmpty()) { showCategories(it!!) categoryList.visibility = View.VISIBLE @@ -120,9 +111,9 @@ class HomeFragment : Fragment() { }) // Bind to the screen error - homeViewModel.getScreenError().observe(this, Observer { + homeViewModel.getScreenError().observe(viewLifecycleOwner, Observer { if (it != null) { - errorDescription.text = activity!!.getString(it.description) + errorDescription.text = requireActivity().getString(it.description) errorContainer.visibility = View.VISIBLE progressBar.visibility = View.GONE } else { @@ -132,7 +123,7 @@ class HomeFragment : Fragment() { if (homeViewModel.getBannerApplications().value!!.isEmpty() || homeViewModel.getCategories().value!!.isEmpty()) { - homeViewModel.loadCategories(context!!) + homeViewModel.loadCategories(requireContext()) } return view } @@ -140,16 +131,16 @@ class HomeFragment : Fragment() { private fun setCustomScroller() { val scroller = ViewPager::class.java.getDeclaredField("mScroller") scroller.isAccessible = true - scroller.set(imageCarousel, ImageCarouselScroller(context!!)) + scroller.set(imageCarousel, ImageCarouselScroller(requireContext())) } private fun showCategories(categories: LinkedHashMap>) { categoryList.removeAllViews() categories.forEach { - val homeCategory = HomeCategory(context!!, it.key) + val homeCategory = HomeCategory(requireContext(), it.key) val applicationList = homeCategory.findViewById(R.id.application_list) applicationList.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) - applicationList.adapter = SmallApplicationListAdapter(activity!!, it.value) + applicationList.adapter = SmallApplicationListAdapter(requireActivity(), it.value) categoryList.addView(homeCategory) } } @@ -159,7 +150,7 @@ class HomeFragment : Fragment() { if (::homeViewModel.isInitialized) { homeViewModel.getCategories().value!!.values.forEach { it.forEach { application -> - application.checkForStateUpdate(context!!) + application.checkForStateUpdate(requireContext()) } } } @@ -174,7 +165,7 @@ class HomeFragment : Fragment() { } homeViewModel.getBannerApplications().value!!.forEach { if(it.application!=null) - it.application!!.decrementUses() + it.application.decrementUses() } } } diff --git a/app/src/main/java/foundation/e/apps/home/ImageCarouselAdapter.kt b/app/src/main/java/foundation/e/apps/home/ImageCarouselAdapter.kt index 5641cfc96cffe3be475786b98108005c620a074e..ac5ebf7bb4926ae2ebb51344be8b54f499c37272 100644 --- a/app/src/main/java/foundation/e/apps/home/ImageCarouselAdapter.kt +++ b/app/src/main/java/foundation/e/apps/home/ImageCarouselAdapter.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home @@ -50,7 +50,6 @@ class ImageCarouselAdapter(context: Context, private val bannerApplications: Arr val view = layoutInflater.inflate(R.layout.image_carousel_item, container, false) val wideImage = view.image val image = getRoundedCornerBitmap(bannerApplications[position].image,mActivity) -// val resizedImage=reSizeImage(image) wideImage.setImageBitmap(image) wideImage.setOnClickListener { if(mActivity.showApplicationTypePreference()=="open" || mActivity.showApplicationTypePreference()=="pwa"){ diff --git a/app/src/main/java/foundation/e/apps/home/ImageCarouselScroller.kt b/app/src/main/java/foundation/e/apps/home/ImageCarouselScroller.kt index 1e4fd351a987a69700622c6b05064a74cc0f8237..def0c5eb699b5c4f329dc0a57d8949fadec6a5d6 100644 --- a/app/src/main/java/foundation/e/apps/home/ImageCarouselScroller.kt +++ b/app/src/main/java/foundation/e/apps/home/ImageCarouselScroller.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home diff --git a/app/src/main/java/foundation/e/apps/home/ImageCarouselSwitcher.kt b/app/src/main/java/foundation/e/apps/home/ImageCarouselSwitcher.kt index 9ef80767c370db3c8edf286b84174adb997f5fe0..3afb8599d6f246f4f189b495f9698fd002f61f65 100644 --- a/app/src/main/java/foundation/e/apps/home/ImageCarouselSwitcher.kt +++ b/app/src/main/java/foundation/e/apps/home/ImageCarouselSwitcher.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home diff --git a/app/src/main/java/foundation/e/apps/home/model/ApplicationsLoader.kt b/app/src/main/java/foundation/e/apps/home/model/ApplicationsLoader.kt index 3c20fb456291d5c1fa9d18f2affe7503ba45d48c..86561aafa8d9a1385a88f03b9d1e085cd867e294 100644 --- a/app/src/main/java/foundation/e/apps/home/model/ApplicationsLoader.kt +++ b/app/src/main/java/foundation/e/apps/home/model/ApplicationsLoader.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.model diff --git a/app/src/main/java/foundation/e/apps/home/model/BannerApplication.kt b/app/src/main/java/foundation/e/apps/home/model/BannerApplication.kt index cff11e790dd75597ca34558541c0bc18f538f191..66409fbad76e959f55f951366a8183ad3cbfeb1a 100644 --- a/app/src/main/java/foundation/e/apps/home/model/BannerApplication.kt +++ b/app/src/main/java/foundation/e/apps/home/model/BannerApplication.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.model diff --git a/app/src/main/java/foundation/e/apps/home/model/BannerApplicationLoader.kt b/app/src/main/java/foundation/e/apps/home/model/BannerApplicationLoader.kt index db7aff575723d7b5a5e18f6187110cf5ff3151d8..774520821d97e61ceeedc403512ac5377d62f2bb 100644 --- a/app/src/main/java/foundation/e/apps/home/model/BannerApplicationLoader.kt +++ b/app/src/main/java/foundation/e/apps/home/model/BannerApplicationLoader.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.model diff --git a/app/src/main/java/foundation/e/apps/home/model/HomeModel.kt b/app/src/main/java/foundation/e/apps/home/model/HomeModel.kt index 8dee30eb561376e0db8e9be1a9964edb9dec8717..d4f81b73f9af17d5e829e4b9361f919b1e484ef2 100644 --- a/app/src/main/java/foundation/e/apps/home/model/HomeModel.kt +++ b/app/src/main/java/foundation/e/apps/home/model/HomeModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.model diff --git a/app/src/main/java/foundation/e/apps/home/model/HomeModelInterface.kt b/app/src/main/java/foundation/e/apps/home/model/HomeModelInterface.kt index 4120703208ecaffbb5918fcd64fcc8224f2baa5f..512cf98922c13838751e1e71a251c65b8e61360b 100644 --- a/app/src/main/java/foundation/e/apps/home/model/HomeModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/home/model/HomeModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.model diff --git a/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModel.kt b/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModel.kt index 1e3918e40cd0ce6cf56a34d159643a6fb977cf10..aa3525557237723198e19006177dc67168c61f2d 100644 --- a/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModel.kt +++ b/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.viewmodel diff --git a/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModelInterface.kt b/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModelInterface.kt index daf573f9ac87a7165cf5e9e15b7a3a5cadceb5b2..cb0bfabe437e731deade2415772d1497dbd40dc8 100644 --- a/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/home/viewmodel/HomeViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.home.viewmodel diff --git a/app/src/main/java/foundation/e/apps/pwa/Extensions.kt b/app/src/main/java/foundation/e/apps/pwa/Extensions.kt index b38a5900b0a55467d4ddddc5390d839015c8cab6..4194b507d5adc8df71fb08b68b171436522bac26 100644 --- a/app/src/main/java/foundation/e/apps/pwa/Extensions.kt +++ b/app/src/main/java/foundation/e/apps/pwa/Extensions.kt @@ -1,6 +1,22 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.pwa -import android.R.attr.bitmap import android.graphics.Bitmap import android.util.Log import java.io.ByteArrayOutputStream diff --git a/app/src/main/java/foundation/e/apps/pwa/PwaInstaller.kt b/app/src/main/java/foundation/e/apps/pwa/PwaInstaller.kt index c31b91dc5ee29ee981e928fd63f337bf24c66046..40478cef8e2e5dc903f513d0afee2c72666aae3c 100644 --- a/app/src/main/java/foundation/e/apps/pwa/PwaInstaller.kt +++ b/app/src/main/java/foundation/e/apps/pwa/PwaInstaller.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.pwa import android.annotation.SuppressLint @@ -75,12 +92,10 @@ class PwaInstaller : AppCompatActivity() { urlConnection.connectTimeout = Constants.CONNECT_TIMEOUT urlConnection.readTimeout = Constants.READ_TIMEOUT icon = BitmapFactory.decodeStream(urlConnection.inputStream) - //scaledBitmap = Bitmap.createScaledBitmap(icon, 128, 128, true) } catch (e: FileNotFoundException) { val x = R.drawable.pwa_default_icon icon = BitmapFactory.decodeResource(mActivity.getResources(), x) - //scaledBitmap = Bitmap.createScaledBitmap(icon, 128, 128, true) } val intent = Intent() intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) diff --git a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt index c880059b27149fa1a5e4962f50ff3b93a8c84716..57b9212b0f660e2df96d3652a34c3dc4cef57744 100644 --- a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt +++ b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search @@ -28,12 +28,11 @@ import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import android.widget.* import androidx.appcompat.widget.SearchView -import androidx.core.content.ContextCompat import androidx.cursoradapter.widget.CursorAdapter import androidx.cursoradapter.widget.SimpleCursorAdapter import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import foundation.e.apps.R @@ -71,7 +70,7 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On val view = inflater.inflate(R.layout.fragment_search, container, false) - searchViewModel = ViewModelProviders.of(activity!!).get(SearchViewModel::class.java) + searchViewModel = ViewModelProvider(this).get(SearchViewModel::class.java) focusView = view.findViewById(R.id.view) searchView = view.findViewById(R.id.search_view) recyclerView = view.findViewById(R.id.app_list) @@ -113,7 +112,7 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On // Initialise recycler view recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(context) - recyclerView.adapter = ApplicationListAdapter(activity!!, applicationList, 0) + recyclerView.adapter = ApplicationListAdapter(requireActivity(), applicationList, 0) loadMoreContainer.visibility = View.GONE recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { @@ -132,12 +131,12 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On }) // Bind search view suggestions adapter to search suggestions list in view model - searchViewModel.getSuggestions().observe(this, Observer { + searchViewModel.getSuggestions().observe(viewLifecycleOwner, Observer { populateSuggestionsAdapter(it) }) // Bind recycler view adapter to search results list in view model - searchViewModel.getApplications().observe(this, Observer { + searchViewModel.getApplications().observe(viewLifecycleOwner, Observer { if (it != null) { applicationList.clear() applicationList.addAll(it) @@ -157,11 +156,11 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On }) // Bind to the screen error - searchViewModel.getScreenError().observe(this, Observer { + searchViewModel.getScreenError().observe(viewLifecycleOwner, Observer { if (it != null) { if (!isLoadingMoreApplications) { applicationList.clear() - errorDescription.text = activity!!.getString(it.description) + errorDescription.text = requireActivity().getString(it.description) errorContainer.visibility = View.VISIBLE progressBar.visibility = View.GONE loadMoreContainer.visibility = View.GONE @@ -195,7 +194,7 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On recyclerView.visibility = View.GONE progressBar.visibility = View.VISIBLE splashContainer.visibility = View.GONE - searchViewModel.onSearchQuerySubmitted(context!!,query) + searchViewModel.onSearchQuerySubmitted(requireContext(),query) } } @@ -207,14 +206,14 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On recyclerView.visibility = View.GONE progressBar.visibility = View.VISIBLE splashContainer.visibility = View.GONE - searchViewModel.onSearchQuerySubmitted(context!!, it) + searchViewModel.onSearchQuerySubmitted(requireContext(), it) } return false } override fun onQueryTextChange(newText: String?): Boolean { searchView.query?.let { - searchViewModel.onSearchQueryChanged(context!!, it.toString()) + searchViewModel.onSearchQueryChanged(requireContext(), it.toString()) } return true } @@ -266,7 +265,7 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On if (::searchViewModel.isInitialized) { searchViewModel.getApplications().value?.let { it.forEach { application -> - application.checkForStateUpdate(context!!) + application.checkForStateUpdate(requireContext()) } } } diff --git a/app/src/main/java/foundation/e/apps/search/model/SearchElement.kt b/app/src/main/java/foundation/e/apps/search/model/SearchElement.kt index 9b99a22eb118540cf7fb786f29ba5c01b2811dd5..54479dbe3e59db84252bde0078feacff4022eea7 100644 --- a/app/src/main/java/foundation/e/apps/search/model/SearchElement.kt +++ b/app/src/main/java/foundation/e/apps/search/model/SearchElement.kt @@ -1,33 +1,30 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.model import android.content.Context import android.os.AsyncTask -import foundation.e.apps.R import foundation.e.apps.api.AllAppsSearchRequest import foundation.e.apps.api.GitlabDataRequest import foundation.e.apps.application.model.Application -import foundation.e.apps.application.model.State import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Error -import foundation.e.apps.utils.PreferenceStorage class SearchElement(private val query: String, private val pageNumber: Int, private val applicationManager: ApplicationManager, diff --git a/app/src/main/java/foundation/e/apps/search/model/SearchModel.kt b/app/src/main/java/foundation/e/apps/search/model/SearchModel.kt index 380285cd2a056229662b55bbde2657950ea33740..b56add468aeb1ab546fdea684f4455bbaef1fcd1 100644 --- a/app/src/main/java/foundation/e/apps/search/model/SearchModel.kt +++ b/app/src/main/java/foundation/e/apps/search/model/SearchModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.model @@ -20,13 +20,11 @@ package foundation.e.apps.search.model import android.content.Context import android.os.AsyncTask import androidx.lifecycle.MutableLiveData -import foundation.e.apps.api.GitlabDataRequest import foundation.e.apps.application.model.Application import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.utils.Common import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Error -import foundation.e.apps.utils.Execute class SearchModel : SearchModelInterface { @@ -48,7 +46,7 @@ class SearchModel : SearchModelInterface { this.context = context if (searchQuery.length >= Constants.MIN_SEARCH_TERM_LENGTH) { if (Common.isNetworkAvailable(context)) { - SearchSuggestionsTask(searchQuery, applicationManager!!, this) + SearchSuggestionsTask(searchQuery, applicationManager, this) .executeOnExecutor(Common.EXECUTOR, context) } } else { @@ -76,7 +74,7 @@ class SearchModel : SearchModelInterface { override fun loadMore(context: Context) { if (Common.isNetworkAvailable(context)) { pageNumber++ - SearchElement(searchQuery, pageNumber, applicationManager!!, this) + SearchElement(searchQuery, pageNumber, applicationManager, this) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, context) } else { screenError.value = Error.NO_INTERNET diff --git a/app/src/main/java/foundation/e/apps/search/model/SearchModelInterface.kt b/app/src/main/java/foundation/e/apps/search/model/SearchModelInterface.kt index 8412f82624c81fe70d1be58061df7c3bff61ac5f..90bab0725c0e64dfb1975ae97a44b781c9c4d2dd 100644 --- a/app/src/main/java/foundation/e/apps/search/model/SearchModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/search/model/SearchModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.model diff --git a/app/src/main/java/foundation/e/apps/search/model/SearchSuggestionsTask.kt b/app/src/main/java/foundation/e/apps/search/model/SearchSuggestionsTask.kt index 3d144aa44f9754c902066c1ae73cd93e2dbb3e15..f89c03447a9622b6ff86e288c6136606469ed74d 100644 --- a/app/src/main/java/foundation/e/apps/search/model/SearchSuggestionsTask.kt +++ b/app/src/main/java/foundation/e/apps/search/model/SearchSuggestionsTask.kt @@ -1,25 +1,24 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.model import android.content.Context import android.os.AsyncTask -import android.util.Log import foundation.e.apps.api.AllAppsSearchRequest import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.utils.Constants diff --git a/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModel.kt b/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModel.kt index 4311c06e3aa4815d706c86c5a8f37bf0eeece87b..a447c7e5781c20c969e3d64e7c2cfce11f222588 100644 --- a/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModel.kt +++ b/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.viewmodel diff --git a/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModelInterface.kt b/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModelInterface.kt index b299307afbc75b32ba8f4d4005b24b00c2e75f6c..d3b1852ac7926ff6676a9b6609c2982394c7731a 100644 --- a/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/search/viewmodel/SearchViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.search.viewmodel diff --git a/app/src/main/java/foundation/e/apps/settings/AppRequestActivity.kt b/app/src/main/java/foundation/e/apps/settings/AppRequestActivity.kt index c97bef5859b8136e747d629480ea7c346d879dec..03b2ac10074ac49f6d23d6cddbb86a743bf60c58 100644 --- a/app/src/main/java/foundation/e/apps/settings/AppRequestActivity.kt +++ b/app/src/main/java/foundation/e/apps/settings/AppRequestActivity.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings @@ -25,7 +25,7 @@ import android.view.View import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import foundation.e.apps.R import foundation.e.apps.settings.viewmodel.AppRequestViewModel import foundation.e.apps.utils.Error @@ -43,7 +43,7 @@ class AppRequestActivity : AppCompatActivity(), TextWatcher { setSupportActionBar(toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) - viewModel = ViewModelProviders.of(this).get(AppRequestViewModel::class.java) + viewModel = ViewModelProvider(this).get(AppRequestViewModel::class.java) progress_bar.visibility = View.GONE app_request_error_text_view.visibility = View.GONE package_name_edit_text.addTextChangedListener(this) diff --git a/app/src/main/java/foundation/e/apps/settings/RadioButtonPreference.kt b/app/src/main/java/foundation/e/apps/settings/RadioButtonPreference.kt index fa521028d00c932d9c20aaf85d3de21cae89fa8b..9ecb8bef2ffc29fb0b5f5a10c9897ceeb9f83dc1 100644 --- a/app/src/main/java/foundation/e/apps/settings/RadioButtonPreference.kt +++ b/app/src/main/java/foundation/e/apps/settings/RadioButtonPreference.kt @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package foundation.e.apps.settings import android.content.Context @@ -19,7 +36,6 @@ class RadioButtonPreference : CheckBoxPreference { override fun onClick() { if (this.isChecked) return -// mActivity.recreate() super.onClick() } diff --git a/app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt b/app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt index b66033b7e3c8ff7bd05e155d52be736a164dbfe2..16538d8b8abd4ecafa89d2f8b82de87c9a93066e 100644 --- a/app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt +++ b/app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings @@ -54,7 +54,7 @@ class SettingsFragment : PreferenceFragmentCompat() { val updateCheckInterval = preferenceManager.findPreference(getString(R.string.pref_update_interval_key)) as ListPreference updateCheckInterval.setOnPreferenceChangeListener { _, newValue -> - UpdatesManager(activity!!.applicationContext).replaceWorker(newValue.toString().toInt()) + UpdatesManager(requireActivity().applicationContext).replaceWorker(newValue.toString().toInt()) true } @@ -84,21 +84,21 @@ class SettingsFragment : PreferenceFragmentCompat() { //Show only pwas when checked var z = preferenceManager.findPreference(getString(R.string.show_only_pwa_apps_key)) as RadioButtonPreference - x.setOnPreferenceChangeListener { _, newValue -> + x.setOnPreferenceChangeListener { _, _ -> y.isChecked = false z.isChecked = false backToMainActivity() true } - y.setOnPreferenceChangeListener { _, newValue -> + y.setOnPreferenceChangeListener { _, _ -> x.isChecked = false z.isChecked = false backToMainActivity() true } - z.setOnPreferenceChangeListener { _, newValue -> + z.setOnPreferenceChangeListener { _, _ -> y.isChecked = false x.isChecked = false backToMainActivity() @@ -119,7 +119,7 @@ class SettingsFragment : PreferenceFragmentCompat() { intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK Intent.FLAG_ACTIVITY_NEW_TASK startActivity(intent) - activity!!.finish() + requireActivity().finish() } } worker.schedule(task, 1, TimeUnit.SECONDS) diff --git a/app/src/main/java/foundation/e/apps/settings/model/AppRequestModel.kt b/app/src/main/java/foundation/e/apps/settings/model/AppRequestModel.kt index f1d3ac881f22ecc6344b8e21f06df155e49aaf38..c20fe3825008254e79af69374b0ee4a32048c73d 100644 --- a/app/src/main/java/foundation/e/apps/settings/model/AppRequestModel.kt +++ b/app/src/main/java/foundation/e/apps/settings/model/AppRequestModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings.model diff --git a/app/src/main/java/foundation/e/apps/settings/model/AppRequestModelInterface.kt b/app/src/main/java/foundation/e/apps/settings/model/AppRequestModelInterface.kt index ca5251b112cb6cf900930b4597753a0399d3b8ca..6593a407789dd16d73fd97b787fc26674af48781 100644 --- a/app/src/main/java/foundation/e/apps/settings/model/AppRequestModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/settings/model/AppRequestModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings.model diff --git a/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModel.kt b/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModel.kt index 018d16fbeb15af09f1d559db12a50c1b3b75ad3a..b469c0b5c9060dd531f1695c6a3485f838ddeea9 100644 --- a/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModel.kt +++ b/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModel.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings.viewmodel diff --git a/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModelInterface.kt b/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModelInterface.kt index ddeb4e4f57e97047bcf6fec99ae2ae8f735714c9..1702b9210336997866703ea91035f72689363c85 100644 --- a/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModelInterface.kt +++ b/app/src/main/java/foundation/e/apps/settings/viewmodel/AppRequestViewModelInterface.kt @@ -1,18 +1,18 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.settings.viewmodel diff --git a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt index e202493ff38635d8ea2a45051c84aff34d8c5537..227d12436060afcd4f36a985a3fc549964e4012d 100644 --- a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt @@ -1,25 +1,25 @@ /* - Copyright (C) 2019 e Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + * Copyright (C) 2019-2021 E FOUNDATION + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package foundation.e.apps.updates -import android.content.res.ColorStateList import android.graphics.Color import android.graphics.PorterDuff +import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.os.Handler import android.view.LayoutInflater @@ -31,7 +31,7 @@ import android.widget.ProgressBar import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import foundation.e.apps.R @@ -40,8 +40,6 @@ import foundation.e.apps.application.model.State import foundation.e.apps.applicationmanager.ApplicationManager import foundation.e.apps.common.ApplicationListAdapter import foundation.e.apps.updates.viewmodel.UpdatesViewModel -import kotlinx.android.synthetic.main.error_layout.* -import kotlinx.android.synthetic.main.fragment_updates.* class UpdatesFragment() : Fragment() { @@ -64,17 +62,16 @@ class UpdatesFragment() : Fragment() { val view = inflater.inflate(R.layout.fragment_updates, container, false) - updatesViewModel = ViewModelProviders.of(activity!!).get(UpdatesViewModel::class.java) + updatesViewModel = ViewModelProvider(this).get(UpdatesViewModel::class.java) recyclerView = view.findViewById(R.id.app_list) progressBar2 = view.findViewById(R.id.progress_bar2) val updateAll = view.findViewById