init
11
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
.idea
|
||||
.DS_Store
|
||||
build
|
||||
release
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
172
LICENSE
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
Open Software License ("OSL") v. 3.0
|
||||
|
||||
This Open Software License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following licensing notice adjacent to the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Open Software License version 3.0
|
||||
|
||||
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free,
|
||||
non-exclusive, sublicensable license, for the duration of the copyright, to do
|
||||
the following:
|
||||
|
||||
a) to reproduce the Original Work in copies, either alone or as part of a
|
||||
collective work;
|
||||
|
||||
b) to translate, adapt, alter, transform, modify, or arrange the Original
|
||||
Work, thereby creating derivative works ("Derivative Works") based upon the
|
||||
Original Work;
|
||||
|
||||
c) to distribute or communicate copies of the Original Work and Derivative
|
||||
Works to the public, with the proviso that copies of Original Work or
|
||||
Derivative Works that You distribute or communicate shall be licensed under
|
||||
this Open Software License;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free,
|
||||
non-exclusive, sublicensable license, under patent claims owned or controlled
|
||||
by the Licensor that are embodied in the Original Work as furnished by the
|
||||
Licensor, for the duration of the patents, to make, use, sell, offer for sale,
|
||||
have made, and import the Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor agrees to
|
||||
provide a machine-readable copy of the Source Code of the Original Work along
|
||||
with each copy of the Original Work that Licensor distributes. Licensor
|
||||
reserves the right to satisfy this obligation by placing a machine-readable
|
||||
copy of the Source Code in an information repository reasonably calculated to
|
||||
permit inexpensive and convenient access by You for as long as Licensor
|
||||
continues to distribute the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior permission of the Licensor. Except as
|
||||
expressly stated herein, nothing in this License grants any license to
|
||||
Licensor's trademarks, copyrights, patents, trade secrets or any other
|
||||
intellectual property. No patent license is granted to make, use, sell, offer
|
||||
for sale, have made, or import embodiments of any patent claims other than the
|
||||
licensed claims defined in Section 2. No license is granted to the trademarks
|
||||
of Licensor even if such marks are included in the Original Work. Nothing in
|
||||
this License shall be interpreted to prohibit Licensor from licensing under
|
||||
terms different from this License any Original Work that Licensor otherwise
|
||||
would have a right to license.
|
||||
|
||||
5) External Deployment. The term "External Deployment" means the use,
|
||||
distribution, or communication of the Original Work or Derivative Works in any
|
||||
way such that the Original Work or Derivative Works may be used by anyone
|
||||
other than You, whether those works are distributed or communicated to those
|
||||
persons or made available as an application intended for use over a network.
|
||||
As an express condition for the grants of license hereunder, You must treat
|
||||
any External Deployment by You of the Original Work or a Derivative Work as a
|
||||
distribution under section 1(c).
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent, or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the
|
||||
terms of this License with the permission of the contributor(s) of those
|
||||
copyrights and patent rights. Except as expressly stated in the immediately
|
||||
preceding sentence, the Original Work is provided under this License on an "AS
|
||||
IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without
|
||||
limitation, the warranties of non-infringement, merchantability or fitness for
|
||||
a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK
|
||||
IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this
|
||||
License. No license to the Original Work is granted by this License except
|
||||
under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to anyone for any indirect, special, incidental, or
|
||||
consequential damages of any character arising as a result of this License or
|
||||
the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to the extent applicable law prohibits such limitation.
|
||||
|
||||
9) Acceptance and Termination. If, at any time, You expressly assented to this
|
||||
License, that assent indicates your clear and irrevocable acceptance of this
|
||||
License and all of its terms and conditions. If You distribute or communicate
|
||||
copies of the Original Work or a Derivative Work, You must make a reasonable
|
||||
effort under the circumstances to obtain the express assent of recipients to
|
||||
the terms of this License. This License conditions your rights to undertake
|
||||
the activities listed in Section 1, including your right to create Derivative
|
||||
Works based upon the Original Work, and doing so without honoring these terms
|
||||
and conditions is prohibited by copyright law and international treaty.
|
||||
Nothing in this License is intended to affect copyright exceptions and
|
||||
limitations (including "fair use" or "fair dealing"). This License shall
|
||||
terminate immediately and You may no longer exercise any of the rights granted
|
||||
to You by this License upon your failure to honor the conditions in Section
|
||||
1(c).
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this
|
||||
License as of the date You commence an action, including a cross-claim or
|
||||
counterclaim, against Licensor or any licensee alleging that the Original Work
|
||||
infringes a patent. This termination provision shall not apply for an action
|
||||
alleging patent infringement by combinations of the Original Work with other
|
||||
software or hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the
|
||||
International Sale of Goods is expressly excluded. Any use of the Original
|
||||
Work outside the scope of this License or after its termination shall be
|
||||
subject to the requirements and penalties of copyright or patent law in the
|
||||
appropriate jurisdiction. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
12) Attorneys' Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary
|
||||
to make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License,
|
||||
whether in upper or lower case, means an individual or a legal entity
|
||||
exercising rights under, and complying with all of the terms of, this License.
|
||||
For legal entities, "You" includes any entity that controls, is controlled by,
|
||||
or is under common control with you. For purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the direction or
|
||||
management of such entity, whether by contract or otherwise, or (ii) ownership
|
||||
of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
|
||||
ownership of such entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
16) Modification of This License. This License is Copyright © 2005 Lawrence
|
||||
Rosen. Permission is granted to copy, distribute, or communicate this License
|
||||
without modification. Nothing in this License permits You to modify this
|
||||
License as applied to the Original Work or to Derivative Works. However, You
|
||||
may modify the text of this License and copy, distribute or communicate your
|
||||
modified version (the "Modified License") and apply it to other original works
|
||||
of authorship subject to the following conditions: (i) You may not indicate in
|
||||
any way that your Modified License is the "Open Software License" or "OSL" and
|
||||
you may not use those names in the name of your Modified License; (ii) You
|
||||
must replace the notice specified in the first paragraph above with the notice
|
||||
"Licensed under <insert your license name here>" or with a notice of your own
|
||||
that is not confusingly similar to the notice in this License; and (iii) You
|
||||
may not claim that your original works are open source software unless your
|
||||
Modified License has been approved by Open Source Initiative (OSI) and You
|
||||
comply with its license review and certification process.
|
||||
4
README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Aliucord Manager
|
||||
Aliucord Manager - Aliucord Installer rewrite in [Kotlin](https://kotlinlang.org) and [Jetpack Compose](https://developer.android.com/jetpack/compose).
|
||||
|
||||
INFO: This app is not functional yet, if you want to install Aliucord - [read this](https://github.com/Aliucord/Aliucord#-installation)
|
||||
72
app/build.gradle.kts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
val accompanistVersion = "0.14.0"
|
||||
val composeVersion = "1.0.0-rc02"
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.aliucord.manager"
|
||||
minSdk = 24
|
||||
targetSdk = 30
|
||||
versionCode = 1
|
||||
versionName = "0.0.1"
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
buildConfigField("String", "TAG", "\"AliucordManager\"")
|
||||
buildConfigField("String", "SUPPORT_SERVER", "\"EsNDvBaHVU\"")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = composeVersion
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// core dependencies
|
||||
implementation("androidx.appcompat:appcompat:1.3.0")
|
||||
implementation("androidx.core:core-ktx:1.6.0")
|
||||
implementation("com.google.android.material:material:1.4.0")
|
||||
|
||||
// compose dependencies
|
||||
implementation("androidx.activity:activity-compose:1.3.0-rc02")
|
||||
implementation("androidx.compose.ui:ui:${composeVersion}")
|
||||
implementation("androidx.compose.material:material:${composeVersion}")
|
||||
implementation("androidx.compose.ui:ui-tooling:${composeVersion}")
|
||||
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha08")
|
||||
implementation("androidx.navigation:navigation-compose:2.4.0-alpha04")
|
||||
|
||||
// accompanist dependencies
|
||||
implementation("com.google.accompanist:accompanist-systemuicontroller:${accompanistVersion}")
|
||||
implementation("com.google.accompanist:accompanist-permissions:${accompanistVersion}")
|
||||
|
||||
// other dependencies
|
||||
implementation("com.google.code.gson:gson:2.8.7")
|
||||
}
|
||||
19
app/proguard-rules.pro
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
-keep class com.aliucord.manager.models.** { private final *; }
|
||||
41
app/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.aliucord.manager">
|
||||
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AliucordManager"
|
||||
tools:ignore="AllowBackup">
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
18
app/src/main/java/com/aliucord/manager/models/Commit.kt
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.models
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class Commit(
|
||||
@SerializedName("html_url") val htmlUrl: String,
|
||||
val sha: String,
|
||||
val commit: Commit,
|
||||
val author: Author
|
||||
) {
|
||||
class Author(@SerializedName("login") val name: String)
|
||||
class Commit(val message: String)
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.preferences
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var sharedPreferences: SharedPreferences? = null
|
||||
|
||||
class Preference<T>(
|
||||
private val key: String,
|
||||
defaultValue: T,
|
||||
getter: SharedPreferences.(key: String, defaultValue: T) -> T?,
|
||||
private val setter: SharedPreferences.Editor.(key: String, newValue: T) -> Unit
|
||||
) {
|
||||
val value = mutableStateOf(sharedPreferences!!.getter(key, defaultValue) ?: defaultValue)
|
||||
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>) = value.value
|
||||
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, newValue: T) = set(newValue)
|
||||
|
||||
fun get() = value.value
|
||||
|
||||
fun set(newValue: T) {
|
||||
if (value.value != newValue) {
|
||||
value.value = newValue
|
||||
val editor = sharedPreferences!!.edit()
|
||||
editor.setter(key, newValue)
|
||||
editor.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun boolPreference(
|
||||
key: String,
|
||||
defaultValue: Boolean = false
|
||||
) = Preference(
|
||||
key,
|
||||
defaultValue,
|
||||
SharedPreferences::getBoolean,
|
||||
SharedPreferences.Editor::putBoolean
|
||||
)
|
||||
|
||||
fun intPreference(
|
||||
key: String,
|
||||
defaultValue: Int = 0
|
||||
) = Preference(
|
||||
key,
|
||||
defaultValue,
|
||||
SharedPreferences::getInt,
|
||||
SharedPreferences.Editor::putInt
|
||||
)
|
||||
|
||||
fun stringPreference(
|
||||
key: String,
|
||||
defaultValue: String
|
||||
) = Preference(
|
||||
key,
|
||||
defaultValue,
|
||||
SharedPreferences::getString,
|
||||
SharedPreferences.Editor::putString
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.preferences
|
||||
|
||||
import android.os.Environment
|
||||
|
||||
val themePreference = intPreference("theme")
|
||||
val replaceBgPreference = boolPreference("replace_bg", true)
|
||||
val useDexFromStoragePreference = boolPreference("use_dex_from_storage")
|
||||
val dexLocationPreference = stringPreference("dex_location", Environment.getExternalStorageDirectory().absolutePath + "/Aliucord/Aliucord.dex")
|
||||
169
app/src/main/java/com/aliucord/manager/ui/MainActivity.kt
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.aliucord.manager.BuildConfig
|
||||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.preferences.sharedPreferences
|
||||
import com.aliucord.manager.ui.theme.AliucordManagerTheme
|
||||
import com.aliucord.manager.ui.theme.primaryColor
|
||||
import com.aliucord.manager.ui.theme.primaryColorDark
|
||||
import com.aliucord.manager.utils.Github
|
||||
import com.google.accompanist.permissions.ExperimentalPermissionsApi
|
||||
import com.google.accompanist.permissions.PermissionRequired
|
||||
import com.google.accompanist.permissions.PermissionState
|
||||
import com.google.accompanist.permissions.rememberPermissionState
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
sharedPreferences = getSharedPreferences(BuildConfig.APPLICATION_ID + "_preferences", Context.MODE_PRIVATE)
|
||||
Github.checkForUpdates()
|
||||
setContent {
|
||||
AliucordManagerTheme {
|
||||
MainActivityLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPermissionsApi::class)
|
||||
@Composable
|
||||
fun MainActivityLayout() {
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val storagePermissionState = rememberPermissionState(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
|
||||
SideEffect {
|
||||
systemUiController.setSystemBarsColor(primaryColorDark)
|
||||
if (!storagePermissionState.hasPermission) storagePermissionState.launchPermissionRequest()
|
||||
}
|
||||
|
||||
val navController = rememberNavController()
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
val route = navController.currentBackStackEntryAsState().value?.destination?.route ?: Screen.Home.route
|
||||
TopAppBar(
|
||||
title = { Text(stringResource(Screen.SCREENS.find { it.route == route }!!.displayName)) },
|
||||
backgroundColor = primaryColor,
|
||||
contentColor = MaterialTheme.colors.onPrimary,
|
||||
navigationIcon = if (route != Screen.Home.route) {{
|
||||
IconButton(onClick = { navController.popBackStack() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.onPrimary
|
||||
)
|
||||
}
|
||||
}} else null,
|
||||
actions = {
|
||||
if (route != Screen.Home.route) return@TopAppBar
|
||||
val context = LocalContext.current
|
||||
IconButton(onClick = { context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://discord.gg/${BuildConfig.SUPPORT_SERVER}"))) }) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_discord),
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.onPrimary
|
||||
)
|
||||
}
|
||||
IconButton(onClick = { isMenuExpanded = !isMenuExpanded }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.MoreVert,
|
||||
contentDescription = stringResource(R.string.show_menu),
|
||||
tint = MaterialTheme.colors.onPrimary
|
||||
)
|
||||
}
|
||||
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
|
||||
DropdownMenuItem(onClick = {
|
||||
isMenuExpanded = false
|
||||
navController.navigate(Screen.Settings.route) {
|
||||
popUpTo(Screen.Home.route) { saveState = true }
|
||||
}
|
||||
}) {
|
||||
Text(stringResource(id = Screen.Settings.displayName))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
) {
|
||||
PermissionRequired(
|
||||
permissionState = storagePermissionState,
|
||||
permissionNotGrantedContent = { GrantPermission(permissionState = storagePermissionState) },
|
||||
permissionNotAvailableContent = { GrantPermission(permissionState = storagePermissionState) }
|
||||
) {
|
||||
NavHost(
|
||||
navController,
|
||||
startDestination = Screen.Home.route
|
||||
) {
|
||||
for (screen in Screen.SCREENS) {
|
||||
composable(screen.route) { screen.content() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPermissionsApi::class)
|
||||
@Composable
|
||||
fun GrantPermission(permissionState: PermissionState) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(stringResource(R.string.permission_required), style = MaterialTheme.typography.h6, textAlign = TextAlign.Center)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Row {
|
||||
val context = LocalContext.current
|
||||
|
||||
Button(onClick = { permissionState.launchPermissionRequest() }) {
|
||||
Text(stringResource(R.string.permission_grant))
|
||||
}
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Button(
|
||||
onClick = {
|
||||
context.startActivity(Intent(
|
||||
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
Uri.fromParts("package", BuildConfig.APPLICATION_ID, null)
|
||||
))
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(backgroundColor = Color.LightGray, contentColor = Color.Black)
|
||||
) {
|
||||
Text(stringResource(R.string.open_settings))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
app/src/main/java/com/aliucord/manager/ui/Screen.kt
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.ui.screens.HomeScreen
|
||||
import com.aliucord.manager.ui.screens.SettingsScreen
|
||||
|
||||
sealed class Screen(
|
||||
val route: String,
|
||||
@StringRes val displayName: Int,
|
||||
val content: @Composable () -> Unit
|
||||
) {
|
||||
companion object {
|
||||
// NOTE: without lazy it doesn't work, kotlin moment https://youtrack.jetbrains.com/issue/KT-8970
|
||||
val SCREENS by lazy { listOf(Home, Settings) }
|
||||
}
|
||||
|
||||
object Home : Screen(
|
||||
"home",
|
||||
R.string.app_name,
|
||||
{ HomeScreen() }
|
||||
)
|
||||
|
||||
object Settings : Screen(
|
||||
"settings",
|
||||
R.string.settings,
|
||||
{ SettingsScreen() }
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.components
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.constraintlayout.compose.ConstraintLayout
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.aliucord.manager.BuildConfig
|
||||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.models.Commit
|
||||
import com.aliucord.manager.ui.theme.isDark
|
||||
import com.aliucord.manager.utils.Github
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private class CommitData(
|
||||
val commit: Commit,
|
||||
val buildSha: String?
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun CommitsList(selectedCommit: MutableState<String?>, modifier: Modifier = Modifier) {
|
||||
val coroutineScope = rememberCoroutineScope { Dispatchers.IO }
|
||||
var isLoading by remember { mutableStateOf(true) }
|
||||
val commits = remember { mutableStateListOf<CommitData>() }
|
||||
|
||||
if (isLoading) {
|
||||
ConstraintLayout(modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(12.dp)) {
|
||||
CommitsHeader()
|
||||
CircularProgressIndicator(modifier = Modifier.constrainAs(createRef()) {
|
||||
top.linkTo(parent.top)
|
||||
bottom.linkTo(parent.bottom)
|
||||
start.linkTo(parent.start)
|
||||
end.linkTo(parent.end)
|
||||
})
|
||||
}
|
||||
|
||||
LaunchedEffect(null) {
|
||||
coroutineScope.launch {
|
||||
try {
|
||||
val buildCommits = Github.getCommits(mapOf("sha" to "builds", "path" to "Aliucord.dex", "per_page" to "50"))
|
||||
val commits2 = Github.getCommits(mapOf("per_page" to "50"))
|
||||
commits.addAll(commits2.map { c -> CommitData(c, buildCommits.find { bc -> bc.commit.message.substring(6) == c.sha }?.sha) })
|
||||
isLoading = false
|
||||
if (commits.size > 0) selectedCommit.value = commits.firstOrNull { it.buildSha != null }?.buildSha
|
||||
} catch (e: Throwable) {
|
||||
Log.e(BuildConfig.TAG, "Failed to get commits", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val dark = isDark()
|
||||
|
||||
// LazyColumn causes too much lags, also you can't get scrollbar on it, so I used AndroidView with RecyclerView for now
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(12.dp)
|
||||
) {
|
||||
CommitsHeader()
|
||||
AndroidView({ context -> View.inflate(context, R.layout.recycler, null).apply {
|
||||
val rv = this as RecyclerView
|
||||
rv.adapter = CommitsAdapter(commits, dark)
|
||||
rv.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))
|
||||
}})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CommitsHeader() {
|
||||
Text(stringResource(R.string.commits), style = MaterialTheme.typography.subtitle1)
|
||||
}
|
||||
|
||||
private class CommitsAdapter(private val commits: List<CommitData>, private val dark: Boolean) : RecyclerView.Adapter<CommitsAdapter.ViewHolder>() {
|
||||
class ViewHolder(view: View, dark: Boolean) : RecyclerView.ViewHolder(view) {
|
||||
val sha: TextView = view.findViewById(R.id.commit_sha)
|
||||
val message: TextView = view.findViewById(R.id.commit_message)
|
||||
|
||||
init {
|
||||
message.setTextColor(if (dark) 0xccffffff.toInt() else 0xcc000000.toInt())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
|
||||
ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.commit, parent, false), dark)
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val data = commits[position]
|
||||
val commit = data.commit
|
||||
val color = if (data.buildSha != null) holder.sha.context.getColor(R.color.primary) else Color.GRAY
|
||||
|
||||
holder.sha.text = commit.sha.substring(0, 7)
|
||||
holder.sha.setTextColor(color)
|
||||
holder.sha.setOnClickListener { it.context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(commit.htmlUrl))) }
|
||||
|
||||
holder.message.text = "${commit.commit.message.split("\n")[0]} - ${commit.author.name}"
|
||||
}
|
||||
|
||||
override fun getItemCount() = commits.size
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.components
|
||||
|
||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowDropDown
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun ExposedDropdownMenu(
|
||||
items: Array<String>,
|
||||
selectedItem: Int,
|
||||
selectItem: (item: Int) -> Unit = {},
|
||||
width: Dp = 200.dp
|
||||
) {
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
val rotateAnimation by animateFloatAsState(
|
||||
targetValue = if (expanded) 180F else 0F,
|
||||
animationSpec = tween(
|
||||
durationMillis = 250,
|
||||
easing = FastOutSlowInEasing
|
||||
)
|
||||
)
|
||||
|
||||
Column(modifier = Modifier.width(width)) {
|
||||
ListItem(
|
||||
text = { Text(items[selectedItem]) },
|
||||
trailing = {
|
||||
Icon(imageVector = Icons.Filled.ArrowDropDown, contentDescription = null, modifier = Modifier.rotate(rotateAnimation))
|
||||
},
|
||||
modifier = Modifier.clickable { expanded = !expanded }
|
||||
)
|
||||
if (expanded) Divider(color = MaterialTheme.colors.primary) else Divider()
|
||||
DropdownMenu(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false },
|
||||
modifier = Modifier.width(width)
|
||||
) {
|
||||
items.forEachIndexed { i, item ->
|
||||
DropdownMenuItem(
|
||||
onClick = { selectItem(i) }
|
||||
) {
|
||||
Text(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.ListItem
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aliucord.manager.ui.components.CommitsList
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
@Preview
|
||||
fun HomeScreen() {
|
||||
val selectedCommit = remember { mutableStateOf<String?>(null) }
|
||||
Column(modifier = Modifier.padding(8.dp)) {
|
||||
Card(modifier = Modifier.padding(bottom = 8.dp)) {
|
||||
ListItem(
|
||||
text = { Text("Aliucord") },
|
||||
secondaryText = { Text(buildAnnotatedString {
|
||||
append("Supported version: ")
|
||||
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(selectedCommit.value ?: "blah") }
|
||||
}) },
|
||||
modifier = Modifier.padding(vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
Card { CommitsList(selectedCommit) }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.screens
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.preferences.dexLocationPreference
|
||||
import com.aliucord.manager.preferences.replaceBgPreference
|
||||
import com.aliucord.manager.preferences.themePreference
|
||||
import com.aliucord.manager.preferences.useDexFromStoragePreference
|
||||
import com.aliucord.manager.ui.components.ExposedDropdownMenu
|
||||
|
||||
private val themes = arrayOf("System", "Light", "Dark")
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun SettingsScreen() {
|
||||
Column {
|
||||
val modifier = Modifier.padding(top = 8.dp)
|
||||
|
||||
ListItem(
|
||||
text = { Text(stringResource(R.string.theme)) },
|
||||
trailing = {
|
||||
ExposedDropdownMenu(
|
||||
items = themes,
|
||||
selectedItem = themePreference.get(),
|
||||
selectItem = themePreference::set
|
||||
)
|
||||
},
|
||||
modifier = modifier
|
||||
)
|
||||
ListItem(
|
||||
text = { Text(stringResource(R.string.replace_bg)) },
|
||||
trailing = {
|
||||
Checkbox(
|
||||
checked = replaceBgPreference.get(),
|
||||
onCheckedChange = replaceBgPreference::set
|
||||
)
|
||||
},
|
||||
modifier = modifier.clickable { replaceBgPreference.set(!replaceBgPreference.get()) }
|
||||
)
|
||||
val udfs = useDexFromStoragePreference.get()
|
||||
ListItem(
|
||||
text = { Text(stringResource(R.string.use_dex_from_storage)) },
|
||||
trailing = {
|
||||
Checkbox(
|
||||
checked = udfs,
|
||||
onCheckedChange = useDexFromStoragePreference::set
|
||||
)
|
||||
},
|
||||
modifier = modifier.clickable { useDexFromStoragePreference.set(!useDexFromStoragePreference.get()) }
|
||||
)
|
||||
val color = if (udfs) Color.Unspecified else MaterialTheme.colors.onBackground.copy(ContentAlpha.disabled)
|
||||
ListItem(
|
||||
text = { Text(stringResource(R.string.dex_location), color = color) },
|
||||
secondaryText = { Text(dexLocationPreference.get(), color = color) },
|
||||
modifier = if (udfs) modifier.clickable { /*TODO*/ } else modifier
|
||||
)
|
||||
Button(
|
||||
onClick = { /*TODO*/ },
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(8.dp)
|
||||
) {
|
||||
Text(stringResource(R.string.clear_files_cache), textAlign = TextAlign.Center)
|
||||
}
|
||||
}
|
||||
}
|
||||
14
app/src/main/java/com/aliucord/manager/ui/theme/Color.kt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val darkBackground = Color(0xff2e2e2e)
|
||||
|
||||
val primaryColor = Color(0xff00c853)
|
||||
val primaryColorLight = Color(0xff5efc82)
|
||||
val primaryColorDark = Color(0xff009624)
|
||||
16
app/src/main/java/com/aliucord/manager/ui/theme/Shape.kt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.theme
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Shapes
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
val Shapes = Shapes(
|
||||
small = RoundedCornerShape(4.dp),
|
||||
medium = RoundedCornerShape(4.dp),
|
||||
large = RoundedCornerShape(0.dp)
|
||||
)
|
||||
49
app/src/main/java/com/aliucord/manager/ui/theme/Theme.kt
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import com.aliucord.manager.preferences.themePreference
|
||||
|
||||
private val DarkColorPalette = darkColors(
|
||||
primary = primaryColor,
|
||||
primaryVariant = primaryColorDark,
|
||||
secondary = primaryColorLight,
|
||||
|
||||
onPrimary = Color.White,
|
||||
background = darkBackground,
|
||||
surface = Color(0xff424242)
|
||||
)
|
||||
|
||||
private val LightColorPalette = lightColors(
|
||||
primary = primaryColor,
|
||||
primaryVariant = primaryColorDark,
|
||||
secondary = primaryColorLight
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun isDark() = when (themePreference.value.value) {
|
||||
0 -> isSystemInDarkTheme()
|
||||
1 -> false
|
||||
else -> true
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AliucordManagerTheme(content: @Composable () -> Unit) {
|
||||
val colors = if (isDark()) DarkColorPalette else LightColorPalette
|
||||
|
||||
MaterialTheme(
|
||||
colors,
|
||||
typography = Typography,
|
||||
shapes = Shapes,
|
||||
content
|
||||
)
|
||||
}
|
||||
20
app/src/main/java/com/aliucord/manager/ui/theme/Type.kt
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.theme
|
||||
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
val Typography = Typography(
|
||||
body1 = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
)
|
||||
43
app/src/main/java/com/aliucord/manager/utils/Github.kt
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.utils
|
||||
|
||||
import com.aliucord.manager.models.Commit
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import java.io.InputStreamReader
|
||||
import java.net.URL
|
||||
|
||||
object Github {
|
||||
private const val org = "Aliucord"
|
||||
private const val repo = "Aliucord"
|
||||
|
||||
private const val commitsUrl = "https://api.github.com/repos/${org}/${repo}/commits"
|
||||
|
||||
fun checkForUpdates() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private val commitsCache = HashMap<String, Array<Commit>>()
|
||||
private val commitsType = object : TypeToken<Array<Commit>>() {}.type
|
||||
private val gson = Gson()
|
||||
|
||||
fun getCommits(params: Map<String, String>?): Array<Commit> {
|
||||
// return emptyArray()
|
||||
val query = params?.map { it.key + "=" + it.value }?.joinToString("&", "?") ?: ""
|
||||
if (commitsCache.containsKey(query)) return commitsCache[query] ?: emptyArray()
|
||||
val res = gson.fromJson<Array<Commit>>(
|
||||
InputStreamReader(URL(commitsUrl + query).openStream()),
|
||||
commitsType
|
||||
)
|
||||
commitsCache[query] = res
|
||||
return res
|
||||
}
|
||||
|
||||
fun getDownloadUrl(ref: String, file: String): String {
|
||||
return "'https://raw.githubusercontent.com/${org}/${repo}/${ref}/${file}";
|
||||
}
|
||||
}
|
||||
5
app/src/main/res/drawable/divider.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size android:width="1px" android:height="1px" />
|
||||
<solid android:color="#29dcddde" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/ic_discord.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="19dp"
|
||||
android:viewportWidth="71"
|
||||
android:viewportHeight="55">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M0,0h71v55h-71z"/>
|
||||
<path
|
||||
android:pathData="M60.1045,4.8978C55.5792,2.8214 50.7265,1.2916 45.6527,0.4154C45.5603,0.3985 45.468,0.4408 45.4204,0.5253C44.7963,1.6353 44.105,3.0834 43.6209,4.2216C38.1637,3.4046 32.7345,3.4046 27.3892,4.2216C26.905,3.0581 26.1886,1.6353 25.5617,0.5253C25.5141,0.4436 25.4218,0.4013 25.3294,0.4154C20.2584,1.2888 15.4057,2.8186 10.8776,4.8978C10.8384,4.9147 10.8048,4.9429 10.7825,4.9795C1.578,18.7309 -0.9436,32.1443 0.2934,45.3914C0.299,45.4562 0.3354,45.5182 0.3858,45.5576C6.4587,50.0174 12.3413,52.7249 18.1147,54.5195C18.2071,54.5477 18.305,54.5139 18.3638,54.4378C19.7295,52.5728 20.9469,50.6063 21.9907,48.5383C22.0523,48.4172 21.9935,48.2735 21.8676,48.2256C19.9366,47.4931 18.0979,46.6 16.3292,45.5858C16.1893,45.5041 16.1781,45.304 16.3068,45.2082C16.679,44.9293 17.0513,44.6391 17.4067,44.3461C17.471,44.2926 17.5606,44.2813 17.6362,44.3151C29.2558,49.6202 41.8354,49.6202 53.3179,44.3151C53.3935,44.2785 53.4831,44.2898 53.5502,44.3433C53.9057,44.6363 54.2779,44.9293 54.6529,45.2082C54.7816,45.304 54.7732,45.5041 54.6333,45.5858C52.8646,46.6197 51.0259,47.4931 49.0921,48.2228C48.9662,48.2707 48.9102,48.4172 48.9718,48.5383C50.038,50.6034 51.2554,52.5699 52.5959,54.435C52.6519,54.5139 52.7526,54.5477 52.845,54.5195C58.6464,52.7249 64.529,50.0174 70.6019,45.5576C70.6551,45.5182 70.6887,45.459 70.6943,45.3942C72.1747,30.0791 68.2147,16.7757 60.1968,4.9823C60.1772,4.9429 60.1437,4.9147 60.1045,4.8978ZM23.7259,37.3253C20.2276,37.3253 17.3451,34.1136 17.3451,30.1693C17.3451,26.225 20.1717,23.0133 23.7259,23.0133C27.308,23.0133 30.1626,26.2532 30.1066,30.1693C30.1066,34.1136 27.28,37.3253 23.7259,37.3253ZM47.3178,37.3253C43.8196,37.3253 40.9371,34.1136 40.9371,30.1693C40.9371,26.225 43.7636,23.0133 47.3178,23.0133C50.9,23.0133 53.7545,26.2532 53.6986,30.1693C53.6986,34.1136 50.9,37.3253 47.3178,37.3253Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</group>
|
||||
</vector>
|
||||
21
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group android:scaleX="0.12007617"
|
||||
android:scaleY="0.12007617"
|
||||
android:translateX="23.2605"
|
||||
android:translateY="23.2605">
|
||||
<path
|
||||
android:pathData="M310.423,321.724C290.671,371.359 209.633,359.204 209.633,316.152V192.57C209.633,147.999 289.658,137.869 313.969,182.44L387.916,152.557C359.046,88.74 305.865,70 261.801,70C189.88,70 118.972,111.532 118.972,192.57V316.152C118.972,397.696 189.88,438.722 260.281,438.722C305.359,438.722 359.553,416.436 389.435,358.191L310.423,321.724Z"
|
||||
android:fillColor="#33FF88"/>
|
||||
<path
|
||||
android:pathData="M212.667,79.232H296.257L426.001,442.31H327.539L303.949,369.489H207.026L184.462,442.31H86L139.851,287.951H227.539H281.898L256.77,181.797H254.205L238.559,244.082L176.78,182.098L212.667,79.232Z"
|
||||
android:fillColor="#00C853"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M389.433,358.196L310.421,321.729C301.312,349.89 287.34,358.841 255.487,369.493L321.862,424.793C348.112,412.353 372.62,390.966 389.433,358.196Z"
|
||||
android:fillColor="#33FF88"/>
|
||||
</group>
|
||||
</vector>
|
||||
20
app/src/main/res/layout/commit.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp">
|
||||
<TextView
|
||||
android:id="@+id/commit_sha"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
<TextView
|
||||
android:id="@+id/commit_message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="4"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
8
app/src/main/res/layout/recycler.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
4
app/src/main/res/values/colors.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="primary">#00c853</color>
|
||||
</resources>
|
||||
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
14
app/src/main/res/values/strings.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<resources>
|
||||
<string name="app_name">Aliucord Manager</string>
|
||||
<string name="clear_files_cache">Clear files cache (Aliucord.dex and patched manifest)</string>
|
||||
<string name="commits">Commits</string>
|
||||
<string name="dex_location">Dex location</string>
|
||||
<string name="open_settings">Open settings</string>
|
||||
<string name="permission_required">You need to grant storage permission to use this app</string>
|
||||
<string name="permission_grant">Grant permission</string>
|
||||
<string name="replace_bg">Replace icon background with Aliucord\'s</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="show_menu">Show menu</string>
|
||||
<string name="theme">Theme</string>
|
||||
<string name="use_dex_from_storage">Use Aliucord.dex from storage</string>
|
||||
</resources>
|
||||
7
app/src/main/res/values/themes.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.AliucordManager" parent="Theme.MaterialComponents.NoActionBar">
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="android:listDivider">@drawable/divider</item>
|
||||
</style>
|
||||
</resources>
|
||||
4
app/src/main/res/xml/provider_paths.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path name="external_files" path="." />
|
||||
</paths>
|
||||
23
build.gradle.kts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.1.0-alpha03")
|
||||
@Suppress("GradleDependency") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle.kts files
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete::class) {
|
||||
delete(rootProject.buildDir)
|
||||
}
|
||||
21
gradle.properties
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#Mon Jul 12 01:52:20 CEST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
185
gradlew
vendored
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
14
settings.gradle.kts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Juby210
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "Aliucord Manager"
|
||||
include(":app")
|
||||