profiles activity
This commit is contained in:
12 files changed
+219
-54
No files matched your search
+5
-2
@@ -1,4 +1,5 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlinx-serialization'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
@@ -38,11 +39,13 @@ dependencies {
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.1.0"
|
||||
implementation 'androidx.browser:browser:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
|
||||
implementation 'androidx.core:core-ktx:1.2.0-beta02'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.core:core-ktx:1.2.0-rc01'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.2.0-rc02'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
|
||||
implementation "com.charleskorn.kaml:kaml:0.14.0"
|
||||
implementation "com.google.android.material:material:1.2.0-alpha02"
|
||||
}
|
||||
@@ -14,11 +14,13 @@
|
||||
android:theme="@style/AppTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity
|
||||
android:name=".MainActivity">
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ProfilesActivity" android:exported="false" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.github.kr328.clash
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import kotlinx.android.synthetic.main.activity_profiles.*
|
||||
|
||||
class ProfilesActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main_profiles)
|
||||
|
||||
setSupportActionBar(activity_profiles_toolbar)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.github.kr328.clash.model
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ClashProfile(
|
||||
@SerialName("Proxy") val proxies: List<ClashProxy>,
|
||||
@SerialName("Proxy Group") val proxyGroups: List<ClashProxyGroup>,
|
||||
@SerialName("Rule") val rules: List<String>
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.github.kr328.clash.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ClashProxy(
|
||||
private val type: String,
|
||||
private val name: String)
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.github.kr328.clash.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ClashProxyGroup(
|
||||
private val type: String,
|
||||
private val name: String
|
||||
)
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/activity_profiles_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/activity_profiles_main_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<LinearLayout
|
||||
android:id="@+id/activity_profiles_new_profile"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
<ImageView
|
||||
android:src="@drawable/ic_new_profile"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="60dp"/>
|
||||
<TextView
|
||||
android:text="@string/clash_new_profile"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:gravity="center|start"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:id="@+id/adapter_profiles_checked"
|
||||
android:focusable="false"
|
||||
android:clickable="false"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="80dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:text="@string/app_name"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:text="@string/app_name"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end">
|
||||
|
||||
<View
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/light_gray"/>
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/app_name"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,20 +1,22 @@
|
||||
<resources>
|
||||
<string name="app_name">Clash</string>
|
||||
|
||||
<string name="clash_status_stopped">Clash Stopped</string>
|
||||
<string name="clash_status_click_to_start">Click to start</string>
|
||||
<string name="clash_status_started">Clash Started</string>
|
||||
<string name="clash_status_forwarded_traffic">%s Traffic Forwarded</string>
|
||||
|
||||
<string name="clash_proxy_manage">Proxy Manage</string>
|
||||
<string name="clash_proxy_manage_summary">%d Proxies</string>
|
||||
|
||||
<string name="clash_profiles">Profiles</string>
|
||||
<string name="clash_profiles_summary_selected">%s Selected</string>
|
||||
<string name="clash_profiles_summary_unselected">Unselected</string>
|
||||
|
||||
<string name="clash_logs">Logs</string>
|
||||
<string name="clash_settings">Settings</string>
|
||||
<string name="clash_feedback">Feedback</string>
|
||||
<string name="clash_about">About</string>
|
||||
</resources>
|
||||
<resources>
|
||||
<string name="app_name">Clash</string>
|
||||
|
||||
<string name="clash_status_stopped">Clash Stopped</string>
|
||||
<string name="clash_status_click_to_start">Click to start</string>
|
||||
<string name="clash_status_started">Clash Started</string>
|
||||
<string name="clash_status_forwarded_traffic">%s Traffic Forwarded</string>
|
||||
|
||||
<string name="clash_proxy_manage">Proxy Manage</string>
|
||||
<string name="clash_proxy_manage_summary">%d Proxies</string>
|
||||
|
||||
<string name="clash_profiles">Profiles</string>
|
||||
<string name="clash_profiles_summary_selected">%s Selected</string>
|
||||
<string name="clash_profiles_summary_unselected">Unselected</string>
|
||||
|
||||
<string name="clash_logs">Logs</string>
|
||||
<string name="clash_settings">Settings</string>
|
||||
<string name="clash_feedback">Feedback</string>
|
||||
<string name="clash_about">About</string>
|
||||
|
||||
<string name="clash_new_profile">New Profile</string>
|
||||
</resources>
|
||||
+31
-30
@@ -1,30 +1,31 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.3.60'
|
||||
room_version = '2.2.1'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.3.60'
|
||||
room_version = '2.2.2'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -9,7 +9,9 @@ data class ClashProfileEntity(
|
||||
@ColumnInfo(name = "url") val url: String,
|
||||
@ColumnInfo(name = "selected") val selected: Boolean,
|
||||
@ColumnInfo(name = "type") val writable: Type,
|
||||
@ColumnInfo(name = "last_update") val lastUpdate: Long,
|
||||
@ColumnInfo(name = "proxies") val proxies: Long,
|
||||
@ColumnInfo(name = "proxy_groups") val proxyGroups: Long,
|
||||
@ColumnInfo(name = "rules") val rules: Long,
|
||||
@ColumnInfo(name = "id") @PrimaryKey(autoGenerate = true) val id: Int = 0) {
|
||||
|
||||
enum class Type {
|
||||
|
||||
Reference in new issue
Block a user