├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_nemu-playstore.png
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_nemu.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_nemu_round.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_nemu_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_nemu.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_nemu_round.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_nemu_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_nemu.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_nemu_round.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_nemu_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_nemu.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_nemu_round.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_nemu_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_nemu.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_nemu_round.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_nemu_foreground.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_nemu.xml
│ │ │ │ ├── ic_nemu_round.xml
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_settings.xml
│ │ │ │ ├── vm_settings.xml
│ │ │ │ ├── activity_connect_to_api.xml
│ │ │ │ ├── vmlist_item.xml
│ │ │ │ └── activity_main.xml
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── themes.xml
│ │ │ ├── menu
│ │ │ │ ├── menu_options.xml
│ │ │ │ └── menu_main.xml
│ │ │ ├── drawable-v24
│ │ │ │ ├── edit_text_theme.xml
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ │ ├── ic_baseline_refresh_24.xml
│ │ │ │ ├── ic_round_power_on_18.xml
│ │ │ │ ├── ic_round_power_off_18.xml
│ │ │ │ ├── ic_baseline_settings_24.xml
│ │ │ │ ├── ic_nemu_background.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ └── xml
│ │ │ │ └── pref.xml
│ │ ├── java
│ │ │ └── nemutui
│ │ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── nemu_droid
│ │ │ │ ├── VmProps.kt
│ │ │ │ ├── SettingsActivity.kt
│ │ │ │ ├── SettingsFragment.kt
│ │ │ │ ├── ConnectToApiActivity.kt
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── VmListAadapter.kt
│ │ │ │ ├── VmSettings.kt
│ │ │ │ └── NemuApiClient.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── nemutui
│ │ │ └── com
│ │ │ └── github
│ │ │ └── nemu_droid
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── nemutui
│ │ └── com
│ │ └── github
│ │ └── nemu_droid
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── .gitignore
├── vcs.xml
├── compiler.xml
├── misc.xml
├── gradle.xml
└── jarRepositories.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── README.md
├── CHANGES
├── gradle.properties
├── gradlew.bat
├── POLICY.md
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "nemu-droid"
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/app/src/main/ic_nemu-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/ic_nemu-playstore.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_nemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-hdpi/ic_nemu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_nemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-mdpi/ic_nemu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_nemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xhdpi/ic_nemu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_nemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_nemu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_nemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_nemu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_nemu_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-hdpi/ic_nemu_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_nemu_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-mdpi/ic_nemu_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_nemu_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xhdpi/ic_nemu_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_nemu_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_nemu_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_nemu_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_nemu_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_nemu_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-hdpi/ic_nemu_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_nemu_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-mdpi/ic_nemu_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_nemu_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xhdpi/ic_nemu_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_nemu_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_nemu_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_nemu_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nemuTUI/nemu-droid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_nemu_foreground.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jun 09 16:32:26 MSK 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_nemu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_nemu_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .idea/codeStyles/
11 | .DS_Store
12 | /build
13 | /captures
14 | .externalNativeBuild
15 | .cxx
16 | local.properties
17 | app/release
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/nemutui/com/github/nemu_droid/VmProps.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | data class VmProps(
4 | var result: Boolean = false,
5 | var smp: String = "",
6 | var mem: Int = -1,
7 | var kvm: Boolean = false,
8 | var hcpu: Boolean = false,
9 | var netifs: Int = -1,
10 | var drv_iface: String = "",
11 | var drv_iface_list: Array = arrayOf()
12 | )
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # nEMU Android client
2 |
3 | ## Features
4 | * Connect to VM via SPICE protocol
5 | * Show/edit VM basic settings
6 | * Start/stop/shutdown VM
7 |
8 | ## UI demo
9 | [](https://www.youtube.com/watch?v=WLrh5p_Ybyo)
10 |
11 | nemu-droid uses
12 | [aSPICE](https://play.google.com/store/apps/details?id=com.iiordanov.freeaSPICE)
13 | app to connect to virtual machines
14 |
--------------------------------------------------------------------------------
/app/src/main/java/nemutui/com/github/nemu_droid/SettingsActivity.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.util.Log
6 | import androidx.appcompat.app.AppCompatActivity
7 |
8 | class SettingsActivity : AppCompatActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | setContentView(R.layout.activity_settings)
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/test/java/nemutui/com/github/nemu_droid/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/CHANGES:
--------------------------------------------------------------------------------
1 | v0.2.0 - 07 January 2023
2 | ----------------------
3 | - Feature: show/edit VM basic settings
4 | - Change: vm status displays as icon instead of text
5 |
6 | v0.1.0 - 05 August 2021
7 | ----------------------
8 | - Change: move refresh button to menu
9 | - Feature: use default connection port if field is empty
10 | - Feature: save previous address/port/check_cert input
11 | - Feature: SPICE over SSH
12 |
13 | v0.0.1 - 14 July 2021
14 | ----------------------
15 | - The first public version
16 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_options.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/edit_text_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_refresh_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/vm_settings.xml:
--------------------------------------------------------------------------------
1 |
4 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 | ]>
2 |
3 | nemu-droid
4 | nEMU location
5 | &nemu_default_port;
6 | nEMU port (default: &nemu_default_port;)
7 | password
8 | CONNECT
9 | settings
10 | refresh
11 | nEMU [%1$s:%2$s] %3$s
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_power_on_18.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_power_off_18.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/nemutui/com/github/nemu_droid/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("nemutui.com.github.nemu_droid", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/pref.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
13 |
14 |
19 |
20 |
24 |
25 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/nemutui/com/github/nemu_droid/SettingsFragment.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import android.os.Bundle
4 | import android.text.InputType
5 | import androidx.preference.PreferenceFragmentCompat
6 | import androidx.preference.EditTextPreference
7 |
8 | class SettingsFragment : PreferenceFragmentCompat() {
9 | override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
10 | addPreferencesFromResource(R.xml.pref)
11 | val port_pref: EditTextPreference? = findPreference("ssh_port")
12 | val pass_pref: EditTextPreference? = findPreference("ssh_pass")
13 |
14 | port_pref?.setOnBindEditTextListener { editText ->
15 | editText.inputType = InputType.TYPE_CLASS_NUMBER
16 | }
17 |
18 | pass_pref?.setOnBindEditTextListener { editText ->
19 | editText.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_settings_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_connect_to_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
34 |
35 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | }
5 |
6 | android {
7 | compileSdkVersion 33
8 | buildToolsVersion "30.0.3"
9 |
10 | defaultConfig {
11 | applicationId "nemutui.com.github.nemu_droid"
12 | minSdkVersion 23
13 | targetSdkVersion 33
14 | versionCode 2
15 | versionName "0.2.0"
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 | kotlinOptions {
31 | jvmTarget = '1.8'
32 | }
33 | }
34 |
35 | dependencies {
36 |
37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38 | implementation 'androidx.core:core-ktx:1.5.0'
39 | implementation 'androidx.appcompat:appcompat:1.3.0'
40 | implementation 'com.google.android.material:material:1.3.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
42 | implementation 'io.ktor:ktor-network:1.6.0'
43 | implementation 'io.ktor:ktor-network-tls:1.6.0'
44 | implementation 'io.ktor:ktor-client-core:1.6.0'
45 | implementation 'io.ktor:ktor-client-android:1.6.0'
46 | implementation 'io.ktor:ktor-client-cio:1.6.0'
47 | implementation 'androidx.preference:preference:1.1.1'
48 | testImplementation 'junit:junit:4.13.2'
49 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
50 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/vmlist_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
20 |
21 |
27 |
35 |
36 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
23 |
26 |
27 |
28 |
32 |
35 |
36 |
37 |
39 |
42 |
43 |
44 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/java/nemutui/com/github/nemu_droid/ConnectToApiActivity.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.util.Log
7 | import android.view.Menu
8 | import android.view.MenuItem
9 | import android.widget.TextView
10 | import androidx.recyclerview.widget.LinearLayoutManager
11 | import androidx.recyclerview.widget.RecyclerView
12 |
13 | class ConnectToApiActivity : AppCompatActivity() {
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 | setContentView(R.layout.activity_connect_to_api)
17 |
18 | val api_conn = intent.getStringExtra(EXTRA_NEMU_API_LOCATION)
19 | val api_port = intent.getStringExtra(EXTRA_NEMU_API_PORT)
20 | val api_pass = intent.getStringExtra(EXTRA_NEMU_API_PASSWORD)
21 | val api_trust = intent.getBooleanExtra(EXTRA_CHECK_CERTIFICATE, false)
22 |
23 | val nemu_client = NemuApiClient(api_conn, api_port, api_pass, api_trust)
24 | val auth_res = nemu_client.checkAuth()
25 | val api_res = nemu_client.apiVersion()
26 |
27 | nemu_api = nemu_client
28 |
29 | val tv = findViewById(R.id.api_location)
30 |
31 | if (!auth_res || !api_res) {
32 | tv.apply {
33 | this.text = getString(R.string.nemu_info, api_conn, api_port, nemu_client.getErr())
34 | }
35 | } else {
36 | val ver = nemu_client.nemuVersion()
37 |
38 | if (ver) {
39 | tv.apply {
40 | this.text = getString(R.string.nemu_info, api_conn, api_port, nemu_client.getVersion())
41 | }
42 | } else {
43 | tv.apply {
44 | this.text = getString(R.string.nemu_info, api_conn, api_port, nemu_client.getErr())
45 | }
46 | }
47 |
48 | if (!nemu_client.getVmList()) {
49 | Log.e("nemu-droid", "cannot get VM list")
50 | //kill app?
51 | }
52 | val rv = findViewById(R.id.vm_list_rv)
53 | val rv_adapter = VmListAadapter(nemu_client.vmlist, nemu_client)
54 | rec_view = rv_adapter
55 |
56 | rv.apply {
57 | setHasFixedSize(true)
58 | adapter = rv_adapter
59 | layoutManager = LinearLayoutManager(this.context)
60 | }
61 | }
62 | }
63 |
64 | override fun onCreateOptionsMenu(menu: Menu): Boolean {
65 | // Inflate the menu to use in the action bar
66 | val inflater = menuInflater
67 | inflater.inflate(R.menu.menu_main, menu)
68 |
69 | if (nemu_api.checkAuth()) {
70 | val refresh_butt = menu.findItem(R.id.refresh_butt)
71 | refresh_butt.setVisible(true)
72 | }
73 |
74 | return super.onCreateOptionsMenu(menu)
75 | }
76 |
77 | fun refreshData(menu: MenuItem) {
78 | nemu_api.getVmList()
79 | rec_view.vmlist = nemu_api.vmlist.toList()
80 | rec_view.notifyDataSetChanged()
81 | /*
82 | list.remove(position);
83 | recycler.removeViewAt(position);
84 | mAdapter.notifyItemRemoved(position);
85 | mAdapter.notifyItemRangeChanged(position, list.size());
86 | */
87 | }
88 |
89 | fun editSettings(nemu: MenuItem) {
90 | val intent = Intent(this, SettingsActivity::class.java)
91 | startActivity(intent)
92 | }
93 |
94 | lateinit private var rec_view : VmListAadapter
95 | lateinit private var nemu_api : NemuApiClient
96 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
24 |
25 |
39 |
40 |
54 |
55 |
69 |
70 |
80 |
--------------------------------------------------------------------------------
/app/src/main/java/nemutui/com/github/nemu_droid/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package nemutui.com.github.nemu_droid
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.content.SharedPreferences
6 | import android.content.Context
7 | import android.os.Bundle
8 | import android.os.StrictMode
9 | import android.text.Editable
10 | import android.text.TextWatcher
11 | import android.view.View
12 | import android.widget.Button
13 | import android.widget.EditText
14 | import androidx.appcompat.widget.SwitchCompat
15 |
16 | const val EXTRA_NEMU_API_LOCATION = "nemutui.com.github.nemu_droid.EXTRA_NEMU_API_LOCATION"
17 | const val EXTRA_NEMU_API_PASSWORD = "nemutui.com.github.nemu_droid.EXTRA_NEMU_API_PASSWORD"
18 | const val EXTRA_NEMU_API_PORT = "nemutui.com.github.nemu_droid.EXTRA_NEMU_API_PORT"
19 | const val EXTRA_CHECK_CERTIFICATE = "nemutui.com.github.nemu_droid.EXTRA_CHECK_CERTIFICATE"
20 |
21 | class MainActivity : AppCompatActivity() {
22 | override fun onCreate(savedInstanceState: Bundle?) {
23 | super.onCreate(savedInstanceState)
24 | setContentView(R.layout.activity_main)
25 |
26 | /* This is bad I know, but I'm noob in Kotlin and Android */
27 | val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()
28 | StrictMode.setThreadPolicy(policy)
29 |
30 | api_conn_et = findViewById(R.id.nemu_api_location)
31 | api_port_et = findViewById(R.id.nemu_api_port)
32 | api_pass_et = findViewById(R.id.nemu_api_password)
33 | api_check_cert_et = findViewById(R.id.trust_all_sw)
34 |
35 | api_conn_et.addTextChangedListener(connect_text_watcher)
36 | api_port_et.addTextChangedListener(connect_text_watcher)
37 | api_pass_et.addTextChangedListener(connect_text_watcher)
38 |
39 | preferences = getSharedPreferences(
40 | getPackageName() + "_preferences", Context.MODE_PRIVATE)
41 |
42 | api_conn_et.setText(preferences.getString("api_conn", ""))
43 | api_port_et.setText(preferences.getString("api_port", ""))
44 | api_check_cert_et.setChecked(preferences.getBoolean("api_check_cert", false))
45 | }
46 |
47 | fun connectToApi(view: View) {
48 | val api_conn = api_conn_et.text.toString()
49 | val api_port = api_port_et.text.toString()
50 | val api_pass = api_pass_et.text.toString()
51 | val check_cert = api_check_cert_et.isChecked()
52 |
53 | val editor = preferences.edit()
54 | editor.putString("api_conn", api_conn)
55 | editor.putString("api_port", api_port)
56 | editor.putBoolean("api_check_cert", check_cert)
57 | editor.apply();
58 |
59 | val intent = Intent(this, ConnectToApiActivity::class.java).apply {
60 | putExtra(EXTRA_NEMU_API_LOCATION, api_conn)
61 | putExtra(EXTRA_NEMU_API_PASSWORD, api_pass)
62 | putExtra(EXTRA_NEMU_API_PORT,
63 | if (api_port.isNullOrEmpty()) getString(R.string.nemu_default_port) else api_port)
64 | putExtra(EXTRA_CHECK_CERTIFICATE, check_cert)
65 | }
66 |
67 | startActivity(intent)
68 | }
69 |
70 | private val connect_text_watcher = object : TextWatcher {
71 | override fun afterTextChanged(s: Editable?) {}
72 | override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
73 | override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
74 | val connect_button = findViewById