Commit 5c74f501 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge branch 'aayush_test' into 'master'

Multiple improvements to Apps

See merge request e/apps/apps!60
parents d80fd6b4 8c1a6964
Pipeline #110832 passed with stage
in 4 minutes and 9 seconds
...@@ -7,11 +7,6 @@ before_script: ...@@ -7,11 +7,6 @@ before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle - export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew - chmod +x ./gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
build: build:
stage: build stage: build
script: script:
...@@ -19,4 +14,4 @@ build: ...@@ -19,4 +14,4 @@ build:
artifacts: artifacts:
paths: paths:
- app/build/outputs/apk/ - app/build/outputs/apk/
- app/build/reports/
\ No newline at end of file \ No newline at end of file
apply plugin: 'com.android.application' plugins {
id 'com.android.application'
apply plugin: 'kotlin-android' id 'kotlin-android'
id 'kotlin-android-extensions'
apply plugin: 'kotlin-android-extensions' id 'kotlin-kapt'
}
android { android {
compileSdkVersion 28 compileSdkVersion 29
buildToolsVersion '28.0.3' buildToolsVersion '29.0.2'
defaultConfig { defaultConfig {
applicationId "foundation.e.apps" applicationId "foundation.e.apps"
minSdkVersion 21 minSdkVersion 25
targetSdkVersion 27 targetSdkVersion 29
versionCode 10 versionCode 10
versionName "1.1.6" versionName "1.1.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions.cruncherEnabled = false vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {
debug {
applicationIdSuffix ".debug"
}
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
}
dataBinding {
enabled = true
} }
lintOptions { lintOptions {
lintConfig file("lint.xml") lintConfig file("lint.xml")
disable 'MissingTranslation' disable 'MissingTranslation'
} }
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
androidExtensions { androidExtensions {
experimental = true experimental = true
} }
aaptOptions{ aaptOptions {
additionalParameters '-I', 'app/e-ui-sdk.jar' additionalParameters '-I', 'app/e-ui-sdk.jar'
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
} }
dependencies { dependencies {
def lifecycle_version = "1.1.1" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.work:work-runtime:2.3.1' 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 fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01' // eOS
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' compileOnly files("e-ui-sdk.jar")
// implementation 'com.android.support:design:27.1.1'
implementation 'androidx.recyclerview:recyclerview:1.0.0' // Preference
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' implementation "androidx.preference:preference-ktx:1.1.1"
testImplementation 'junit:junit:4.12'
// Lifecycle
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
// Bouncy Castle
implementation 'org.bouncycastle:bcpg-jdk15on:1.60' implementation 'org.bouncycastle:bcpg-jdk15on:1.60'
implementation "androidx.vectordrawable:vectordrawable:1.0.0" // GSON
implementation "androidx.vectordrawable:vectordrawable-animated:1.0.0" implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.material:material:1.1.0-alpha05'
def nav_version = "1.0.0-alpha02" // EventBus
implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0-rc02' implementation 'org.greenrobot:eventbus:3.2.0'
// use -ktx for Kotlin
implementation 'androidx.navigation:navigation-ui-ktx:2.0.0-rc02'
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' // WorkManager
implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.work:work-runtime:2.5.0'
// Android-Iconics
implementation 'com.mikepenz:iconics-core:3.1.0@aar' implementation 'com.mikepenz:iconics-core:3.1.0@aar'
implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@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' // Vectordrawable
implementation 'com.trello.rxlifecycle3:rxlifecycle-components:3.1.0' def vector_version = "1.1.0"
implementation 'com.trello.rxlifecycle3:rxlifecycle-components-preference:3.1.0' implementation "androidx.vectordrawable:vectordrawable:$vector_version"
implementation 'com.makeramen:roundedimageview:2.3.0' implementation "androidx.vectordrawable:vectordrawable-animated:$vector_version"
// Jackson // Navigation component
implementation "com.fasterxml.jackson.core:jackson-core:2.11.1" def nav_version = "2.3.5"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.11.1" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.1" implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1"
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' // Jackson
def jackson_version = "2.12.2"
compileOnly files("e-ui-sdk.jar") 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"
} }
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<uses-permission android:name="foundation.e.apps.micro.status.READ_WRITE" /> <uses-permission android:name="foundation.e.apps.micro.status.READ_WRITE" />
<application <application
android:allowBackup="true" android:allowBackup="false"
android:alwaysRetainTaskState="true" android:alwaysRetainTaskState="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
......
/* /*
Copyright (C) 2019 e Foundation * Copyright (C) 2019-2021 E FOUNDATION
*
This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package foundation.e.apps package foundation.e.apps
//import androidx.fragment.app.ListFragment
import android.annotation.SuppressLint import android.annotation.SuppressLint
...@@ -28,18 +27,14 @@ import android.database.Cursor ...@@ -28,18 +27,14 @@ import android.database.Cursor
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.preference.PreferenceManager
import android.util.Log
import android.util.TypedValue
import android.view.MenuItem import android.view.MenuItem
import android.widget.Toast import android.widget.Toast
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes import androidx.annotation.ColorRes
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager
import com.google.android.material.bottomnavigation.BottomNavigationItemView import com.google.android.material.bottomnavigation.BottomNavigationItemView
import com.google.android.material.bottomnavigation.BottomNavigationMenuView import com.google.android.material.bottomnavigation.BottomNavigationMenuView
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
...@@ -74,18 +69,30 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -74,18 +69,30 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
private var isReceiverRegistered = false private var isReceiverRegistered = false
var accentColorOS = 0 var accentColorOS = 0
init {
instance = this
}
companion object { companion object {
private var instance: MainActivity? = null
lateinit var mActivity: MainActivity lateinit var mActivity: MainActivity
var sharedPreferences : SharedPreferences?=null var sharedPreferences : SharedPreferences?=null
val sharedPrefFile = "kotlinsharedpreference" val sharedPrefFile = "kotlinsharedpreference"
/*
* Provides the application context via MainActivity
* @return applicationContext
*/
fun applicationContext(): Context {
return instance!!.applicationContext
}
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
//ThemeColors(this);
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
mActivity = this mActivity = this
disableCategoryIfOpenSource() disableCategoryIfOpenSource()
...@@ -311,6 +318,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -311,6 +318,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>,
grantResults: IntArray) { grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == Constants.STORAGE_PERMISSION_REQUEST_CODE && if (requestCode == Constants.STORAGE_PERMISSION_REQUEST_CODE &&
grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_DENIED) { grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_DENIED) {
Snackbar.make(container, R.string.error_storage_permission_denied, Snackbar.make(container, R.string.error_storage_permission_denied,
...@@ -320,7 +328,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -320,7 +328,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
outState?.putInt(CURRENTLY_SELECTED_FRAGMENT_KEY, currentFragmentId) outState.putInt(CURRENTLY_SELECTED_FRAGMENT_KEY, currentFragmentId)
} }
override fun onDestroy() { override fun onDestroy() {
...@@ -357,7 +365,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS ...@@ -357,7 +365,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
* */ * */
private fun getAccentColor() { private fun getAccentColor() {
accentColorOS=this.resources.getColor(R.color.colorAccent); accentColorOS = this.getColor(R.color.colorAccent);
......
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 <https://www.gnu.org/licenses/>.
*/
import java.util.HashMap; package foundation.e.apps;
import android.content.ContentProvider; import android.content.ContentProvider;
import android.content.ContentUris; import android.content.ContentUris;
...@@ -14,6 +29,8 @@ import android.database.sqlite.SQLiteOpenHelper; ...@@ -14,6 +29,8 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder; import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri; import android.net.Uri;
import java.util.HashMap;
public class MicroGProvider extends ContentProvider { public class MicroGProvider extends ContentProvider {
public static final String PROVIDER_NAME = "foundation.e.apps.micro.status"; public static final String PROVIDER_NAME = "foundation.e.apps.micro.status";
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
data class ApkAssetBean( data class ApkAssetBean(
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
enum class ApkAssetType(val suffix: String) { enum class ApkAssetType(val suffix: String) {
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.annotation.SuppressLint import android.annotation.SuppressLint
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Environment import android.os.Environment
import foundation.e.apps.BuildConfig import foundation.e.apps.BuildConfig
import foundation.e.apps.MainActivity
import java.io.File import java.io.File
object AppFolder { object AppFolder {
...@@ -34,7 +52,8 @@ object AppFolder { ...@@ -34,7 +52,8 @@ object AppFolder {
private val appFolder: File? private val appFolder: File?
get() { get() {
return if (FsUtils.isSdUsable) { 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) FsUtils.createOnNotFound(appFolder)
} else { } else {
null null
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import android.os.Bundle import android.os.Bundle
......
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package foundation.e.apps.XAPK package foundation.e.apps.XAPK
import androidx.annotation.WorkerThread import androidx.annotation.WorkerThread
......
/*
* 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.
*