├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml └── misc.xml ├── README.md ├── app ├── .gitignore ├── .localazy ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── localazy │ │ └── quicknote │ │ ├── AppDatabase.kt │ │ ├── FloatingService.kt │ │ ├── MainActivity.kt │ │ ├── PermissionActivity.kt │ │ ├── Tools.kt │ │ ├── notes │ │ ├── Note.kt │ │ ├── NotesDao.kt │ │ └── NotesViewModel.kt │ │ ├── ui │ │ ├── AddNote.kt │ │ └── ShowNotes.kt │ │ └── windows │ │ └── Window.kt │ └── res │ ├── drawable-hdpi │ ├── baseline_highlight_off_black_18.png │ ├── baseline_highlight_off_black_24.png │ ├── baseline_highlight_off_black_36.png │ ├── baseline_highlight_off_black_48.png │ ├── baseline_note_black_18.png │ ├── baseline_note_black_24.png │ ├── baseline_note_black_36.png │ ├── baseline_note_black_48.png │ ├── baseline_send_black_18.png │ ├── baseline_send_black_24.png │ ├── baseline_send_black_36.png │ └── baseline_send_black_48.png │ ├── drawable-mdpi │ ├── baseline_highlight_off_black_18.png │ ├── baseline_highlight_off_black_24.png │ ├── baseline_highlight_off_black_36.png │ ├── baseline_highlight_off_black_48.png │ ├── baseline_note_black_18.png │ ├── baseline_note_black_24.png │ ├── baseline_note_black_36.png │ ├── baseline_note_black_48.png │ ├── baseline_send_black_18.png │ ├── baseline_send_black_24.png │ ├── baseline_send_black_36.png │ └── baseline_send_black_48.png │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable-xhdpi │ ├── baseline_highlight_off_black_18.png │ ├── baseline_highlight_off_black_24.png │ ├── baseline_highlight_off_black_36.png │ ├── baseline_highlight_off_black_48.png │ ├── baseline_note_black_18.png │ ├── baseline_note_black_24.png │ ├── baseline_note_black_36.png │ ├── baseline_note_black_48.png │ ├── baseline_send_black_18.png │ ├── baseline_send_black_24.png │ ├── baseline_send_black_36.png │ └── baseline_send_black_48.png │ ├── drawable-xxhdpi │ ├── baseline_highlight_off_black_18.png │ ├── baseline_highlight_off_black_24.png │ ├── baseline_highlight_off_black_36.png │ ├── baseline_highlight_off_black_48.png │ ├── baseline_note_black_18.png │ ├── baseline_note_black_24.png │ ├── baseline_note_black_36.png │ ├── baseline_note_black_48.png │ ├── baseline_send_black_18.png │ ├── baseline_send_black_24.png │ ├── baseline_send_black_36.png │ └── baseline_send_black_48.png │ ├── drawable-xxxhdpi │ ├── baseline_highlight_off_black_18.png │ ├── baseline_highlight_off_black_24.png │ ├── baseline_highlight_off_black_36.png │ ├── baseline_highlight_off_black_48.png │ ├── baseline_note_black_18.png │ ├── baseline_note_black_24.png │ ├── baseline_note_black_36.png │ ├── baseline_note_black_48.png │ ├── baseline_send_black_18.png │ ├── baseline_send_black_24.png │ ├── baseline_send_black_36.png │ └── baseline_send_black_48.png │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── window.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.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 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | QuickNote 4 -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 22 | 23 | 135 | 136 | 139 | 140 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Floating Windows on Android 4: Floating Window 2 | 3 | This repository contains the source code for article [Floating Windows on Android 4: Floating Window](https://localazy.com/blog/floating-windows-on-android-4-floating-window). 4 | 5 | --- 6 | 7 | ## Intro 8 | 9 | Have you ever wondered how to make those floating windows used by Facebook Heads and other apps? Have you ever wanted to use the same technology in your app? It’s easy, and I will guide you through the whole process. 10 | 11 | I'm the author of [Floating Apps](https://floatingapps.net); the first app of its kind on Google Play and the most popular one with over 8 million downloads. After 6 years of the development of the app, I know a bit about it. It’s sometimes tricky, and I spent months reading documentation and Android source code and experimenting. I received feedback from tens of thousands of users and see various issues on different phones with different Android versions. 12 | 13 | Here's what I learned along the way. 14 | 15 | --- 16 | 17 | ## How To Use 18 | 19 | 1. Clone the repository. 20 | 21 | 2. Open it in Android Studio. As of now, the **Canary** version is necessary because of Jetpack Compose. 22 | 23 | 3. Run the app. 24 | 25 | --- 26 | 27 | ## Stay Tuned 28 | 29 | Eager to learn more about Android development? Follow me (@vaclavhodek) and Localazy (@localazy) on Twitter, or like Localazy on Facebook. 30 | 31 | --- 32 | 33 | ## The Series 34 | 35 | - [Floating Windows on Android 1: Jetpack Compose & Room](https://localazy.com/blog/floating-windows-on-android-1-jetpack-compose-and-room) 36 | - [Floating Windows on Android 2: Foreground Service](https://localazy.com/blog/floating-windows-on-android-2-foreground-service) 37 | - [Floating Windows on Android 3: Permissions](https://localazy.com/blog/floating-windows-on-android-3-permissions) 38 | - [Floating Windows on Android 4: Floating Window](https://localazy.com/blog/floating-windows-on-android-4-floating-window) 39 | - [Floating Windows on Android 5: Moving Window](https://localazy.com/blog/floating-windows-on-android-5-moving-window) 40 | - [Floating Windows on Android 6: Keyboard Input](https://localazy.com/blog/floating-windows-on-android-6-keyboard-input) 41 | - [Floating Windows on Android 7: Boot Receiver](https://localazy.com/blog/floating-windows-on-android-7-boot-receiver) 42 | - [Floating Windows on Android 8: The Final App](https://localazy.com/blog/floating-windows-on-android-8-the-final-app) 43 | - [Floating Windows on Android 9: Shortcomings](https://localazy.com/blog/floating-windows-on-android-9-shortcomings) 44 | - [Floating Windows on Android 10: Tips & Tricks](https://localazy.com/blog/floating-windows-on-android-10-tips-and-tricks) -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/.localazy: -------------------------------------------------------------------------------- 1 | [packages] 2 | com.localazy.quicknote = raa 3 | com.localazy.quicknote.clickup = raa 4 | 5 | [localazy] 6 | allStringsUploaded = true 7 | showWelcomeMessage = false 8 | 9 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | 8 | compileSdkVersion 29 9 | buildToolsVersion "29.0.3" 10 | 11 | buildFeatures { 12 | compose true 13 | // viewBinding true 14 | } 15 | 16 | compileOptions { 17 | sourceCompatibility JavaVersion.VERSION_1_8 18 | targetCompatibility JavaVersion.VERSION_1_8 19 | } 20 | 21 | kotlinOptions { 22 | jvmTarget = "1.8" 23 | useIR = true 24 | } 25 | 26 | defaultConfig { 27 | applicationId "com.localazy.quicknote" 28 | minSdkVersion 21 29 | targetSdkVersion 29 30 | versionCode 1 31 | versionName "1.0" 32 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 33 | } 34 | 35 | buildTypes { 36 | release { 37 | minifyEnabled false 38 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 39 | } 40 | } 41 | 42 | composeOptions { 43 | kotlinCompilerExtensionVersion "1.0.0-alpha01" 44 | } 45 | 46 | } 47 | 48 | dependencies { 49 | implementation fileTree(dir: "libs", include: ["*.jar"]) 50 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 51 | 52 | implementation 'androidx.core:core-ktx:1.3.1' 53 | implementation 'androidx.appcompat:appcompat:1.2.0' 54 | implementation 'com.google.android.material:material:1.2.1' 55 | implementation "androidx.fragment:fragment-ktx:1.2.5" 56 | 57 | implementation 'androidx.compose.foundation:foundation:1.0.0-alpha01' 58 | implementation 'androidx.compose.foundation:foundation-layout:1.0.0-alpha01' 59 | implementation 'androidx.compose.material:material:1.0.0-alpha01' 60 | implementation 'androidx.compose.material:material-icons-core:1.0.0-alpha01' 61 | implementation 'androidx.compose.material:material-icons-extended:1.0.0-alpha01' 62 | implementation 'androidx.compose.runtime:runtime:1.0.0-alpha01' 63 | implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-alpha01' 64 | implementation 'androidx.compose.runtime:runtime-rxjava2:1.0.0-alpha01' 65 | 66 | implementation 'androidx.compose.ui:ui:1.0.0-alpha01' 67 | implementation "androidx.ui:ui-tooling:1.0.0-alpha01" 68 | 69 | implementation "androidx.room:room-runtime:2.2.5" 70 | implementation 'androidx.room:room-ktx:2.2.5' 71 | kapt "androidx.room:room-compiler:2.2.5" 72 | } 73 | 74 | 75 | apply plugin: 'com.localazy.gradle' 76 | 77 | localazy { 78 | readKey "a8922414862262844150-ef174facb0705d300579ae24ccafb7b7781ff8e784569f36711f7eb8f972952a" 79 | writeKey "a8922414862262844150-79fa693a6be31df63e03fc53c025cb4db7b0e5c7de9d8ad23db2aacb1f624dfa" 80 | } 81 | -------------------------------------------------------------------------------- /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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/AppDatabase.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote 2 | 3 | import androidx.room.Database 4 | import androidx.room.RoomDatabase 5 | import com.localazy.quicknote.notes.Note 6 | import com.localazy.quicknote.notes.NotesDao 7 | 8 | @Database(entities = arrayOf(Note::class), version = 1) 9 | abstract class AppDatabase : RoomDatabase() { 10 | 11 | abstract fun notes(): NotesDao 12 | 13 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/FloatingService.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote 2 | 3 | import android.app.* 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.os.Build 7 | import android.os.IBinder 8 | import androidx.activity.viewModels 9 | import androidx.core.app.NotificationCompat 10 | import androidx.room.Room 11 | import com.localazy.quicknote.notes.NotesViewModel 12 | import com.localazy.quicknote.windows.Window 13 | 14 | 15 | const val INTENT_COMMAND = "com.localazy.quicknote.COMMAND" 16 | const val INTENT_COMMAND_EXIT = "EXIT" 17 | const val INTENT_COMMAND_NOTE = "NOTE" 18 | 19 | private const val NOTIFICATION_CHANNEL_GENERAL = "quicknote_general" 20 | private const val CODE_FOREGROUND_SERVICE = 1 21 | private const val CODE_EXIT_INTENT = 2 22 | private const val CODE_NOTE_INTENT = 3 23 | 24 | 25 | class FloatingService : Service() { 26 | 27 | 28 | override fun onBind(intent: Intent?): IBinder? = null 29 | 30 | 31 | /** 32 | * Remove the foreground notification and stop the service. 33 | */ 34 | private fun stopService() { 35 | stopForeground(true) 36 | stopSelf() 37 | } 38 | 39 | 40 | /** 41 | * Create and show the foreground notification. 42 | */ 43 | private fun showNotification() { 44 | 45 | val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager 46 | 47 | val exitIntent = Intent(this, FloatingService::class.java).apply { 48 | putExtra(INTENT_COMMAND, INTENT_COMMAND_EXIT) 49 | } 50 | 51 | val noteIntent = Intent(this, FloatingService::class.java).apply { 52 | putExtra(INTENT_COMMAND, INTENT_COMMAND_NOTE) 53 | } 54 | 55 | val exitPendingIntent = PendingIntent.getService( 56 | this, CODE_EXIT_INTENT, exitIntent, 0 57 | ) 58 | 59 | val notePendingIntent = PendingIntent.getService( 60 | this, CODE_NOTE_INTENT, noteIntent, 0 61 | ) 62 | 63 | // From Android O, it's necessary to create a notification channel first. 64 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 65 | try { 66 | with( 67 | NotificationChannel( 68 | NOTIFICATION_CHANNEL_GENERAL, 69 | getString(R.string.notification_channel_general), 70 | NotificationManager.IMPORTANCE_DEFAULT 71 | ) 72 | ) { 73 | enableLights(false) 74 | setShowBadge(false) 75 | enableVibration(false) 76 | setSound(null, null) 77 | lockscreenVisibility = Notification.VISIBILITY_PUBLIC 78 | manager.createNotificationChannel(this) 79 | } 80 | } catch (ignored: Exception) { 81 | // Ignore exception. 82 | } 83 | } 84 | 85 | with( 86 | NotificationCompat.Builder( 87 | this, 88 | NOTIFICATION_CHANNEL_GENERAL 89 | ) 90 | ) { 91 | setTicker(null) 92 | setContentTitle(getString(R.string.app_name)) 93 | setContentText(getString(R.string.notification_text)) 94 | setAutoCancel(false) 95 | setOngoing(true) 96 | setWhen(System.currentTimeMillis()) 97 | setSmallIcon(R.drawable.baseline_note_black_36) 98 | priority = Notification.PRIORITY_DEFAULT 99 | setContentIntent(notePendingIntent) 100 | addAction( 101 | NotificationCompat.Action( 102 | 0, 103 | getString(R.string.notification_exit), 104 | exitPendingIntent 105 | ) 106 | ) 107 | startForeground(CODE_FOREGROUND_SERVICE, build()) 108 | } 109 | 110 | } 111 | 112 | 113 | override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { 114 | 115 | val command = intent.getStringExtra(INTENT_COMMAND) 116 | 117 | // Exit the service if we receive the EXIT command. 118 | // START_NOT_STICKY is important here, we don't want 119 | // the service to be relaunched. 120 | if (command == INTENT_COMMAND_EXIT) { 121 | stopService() 122 | return START_NOT_STICKY 123 | } 124 | 125 | // Be sure to show the notification first for all commands. 126 | // Don't worry, repeated calls have no effects. 127 | showNotification() 128 | 129 | // Show the floating window for adding a new note. 130 | if (command == INTENT_COMMAND_NOTE) { 131 | if (!drawOverOtherAppsEnabled()) { 132 | startPermissionActivity() 133 | } else { 134 | val window = Window(this) 135 | window.open() 136 | } 137 | } 138 | 139 | return START_STICKY 140 | } 141 | 142 | } 143 | -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote 2 | 3 | import android.os.Bundle 4 | import androidx.activity.viewModels 5 | import androidx.appcompat.app.AppCompatActivity 6 | import androidx.compose.foundation.layout.Column 7 | import androidx.compose.ui.platform.setContent 8 | import com.localazy.quicknote.notes.NotesViewModel 9 | import com.localazy.quicknote.ui.AddNote 10 | import com.localazy.quicknote.ui.ShowNotes 11 | 12 | class MainActivity : AppCompatActivity() { 13 | 14 | private val notesViewModel by viewModels() 15 | 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | 19 | // Start the foreground service. 20 | startFloatingService() 21 | 22 | setContent { 23 | Column { 24 | 25 | AddNote(getString(R.string.add_note)) { 26 | notesViewModel.addNote(it) 27 | } 28 | 29 | ShowNotes(notesViewModel.notes) { 30 | notesViewModel.removeNote(it) 31 | } 32 | 33 | } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/PermissionActivity.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Build 6 | import android.os.Bundle 7 | import android.provider.Settings 8 | import androidx.annotation.RequiresApi 9 | import androidx.appcompat.app.AlertDialog 10 | import androidx.appcompat.app.AppCompatActivity 11 | import androidx.compose.foundation.Text 12 | import androidx.compose.foundation.layout.Column 13 | import androidx.compose.foundation.layout.padding 14 | import androidx.compose.material.Button 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.platform.setContent 17 | import androidx.compose.ui.text.font.FontWeight 18 | import androidx.compose.ui.unit.dp 19 | import androidx.compose.ui.unit.sp 20 | 21 | 22 | const val PERMISSION_REQUEST_CODE = 1 23 | 24 | 25 | class PermissionActivity : AppCompatActivity() { 26 | 27 | 28 | private fun showDialog(titleText: String, messageText: String) { 29 | with(AlertDialog.Builder(this)) { 30 | title = titleText 31 | setMessage(messageText) 32 | setPositiveButton(R.string.common_ok) { dialog, _ -> 33 | dialog.dismiss() 34 | } 35 | show() 36 | } 37 | } 38 | 39 | 40 | @RequiresApi(Build.VERSION_CODES.M) 41 | private fun requestPermission() { 42 | val intent = Intent( 43 | Settings.ACTION_MANAGE_OVERLAY_PERMISSION, 44 | Uri.parse("package:$packageName") 45 | ) 46 | try { 47 | startActivityForResult(intent, PERMISSION_REQUEST_CODE) 48 | } catch (e: Exception) { 49 | showDialog( 50 | getString(R.string.permission_error_title), 51 | getString(R.string.permission_error_text) 52 | ) 53 | } 54 | } 55 | 56 | 57 | override fun onCreate(savedInstanceState: Bundle?) { 58 | super.onCreate(savedInstanceState) 59 | setContent { 60 | Column { 61 | 62 | Text( 63 | text = getString(R.string.permission_required_title), 64 | fontSize = 16.sp, 65 | fontWeight = FontWeight.Bold, 66 | modifier = Modifier.padding(16.dp, 16.dp, 16.dp, 8.dp) 67 | ) 68 | 69 | Text( 70 | text = getString(R.string.permission_required_text), 71 | modifier = Modifier.padding(16.dp, 4.dp) 72 | ) 73 | 74 | Button( 75 | onClick = { 76 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 77 | finish() 78 | } else { 79 | requestPermission() 80 | } 81 | }, 82 | modifier = Modifier.padding(16.dp, 8.dp) 83 | ) { 84 | Text(text = getString(R.string.permission_required_open)) 85 | } 86 | 87 | } 88 | } 89 | } 90 | 91 | 92 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { 93 | // Don't check for resultCode == Activity.RESULT_OK because the overlay activity 94 | // is closed with the back button and so the RESULT_CANCELLED is always received. 95 | if (requestCode == PERMISSION_REQUEST_CODE) { 96 | if (drawOverOtherAppsEnabled()) { 97 | // The permission has been granted. 98 | // Resend the last command - we have only one, so no additional logic needed. 99 | startFloatingService(INTENT_COMMAND_NOTE) 100 | finish() 101 | } 102 | } else { 103 | super.onActivityResult(requestCode, resultCode, data) 104 | } 105 | } 106 | 107 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/Tools.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.os.Build 6 | import android.provider.Settings 7 | 8 | fun Context.startFloatingService(command: String = "") { 9 | val intent = Intent(this, FloatingService::class.java) 10 | if (command.isNotBlank()) intent.putExtra(INTENT_COMMAND, command) 11 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 12 | this.startForegroundService(intent) 13 | } else { 14 | this.startService(intent) 15 | } 16 | } 17 | 18 | 19 | fun Context.drawOverOtherAppsEnabled(): Boolean { 20 | return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 21 | true 22 | } else { 23 | Settings.canDrawOverlays(this) 24 | } 25 | } 26 | 27 | 28 | fun Context.startPermissionActivity() { 29 | startActivity( 30 | Intent(this, PermissionActivity::class.java).apply { 31 | flags = Intent.FLAG_ACTIVITY_NEW_TASK 32 | } 33 | ) 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/notes/Note.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.notes 2 | 3 | import androidx.room.ColumnInfo 4 | import androidx.room.Entity 5 | import androidx.room.PrimaryKey 6 | 7 | @Entity 8 | data class Note( 9 | @PrimaryKey val id: Int, 10 | @ColumnInfo(name = "content") val content: String 11 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/notes/NotesDao.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.notes 2 | 3 | import androidx.room.Dao 4 | import androidx.room.Delete 5 | import androidx.room.Insert 6 | import androidx.room.Query 7 | 8 | @Dao 9 | interface NotesDao { 10 | 11 | @Query("SELECT * FROM note") 12 | fun getAll(): List 13 | 14 | @Insert 15 | fun insert(note: Note) 16 | 17 | @Delete 18 | fun delete(note: Note) 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/notes/NotesViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.notes 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.AndroidViewModel 5 | import androidx.room.Room 6 | import androidx.compose.runtime.getValue 7 | import androidx.compose.runtime.mutableStateOf 8 | import androidx.compose.runtime.setValue 9 | import androidx.lifecycle.viewModelScope 10 | import com.localazy.quicknote.AppDatabase 11 | import kotlinx.coroutines.GlobalScope 12 | import kotlinx.coroutines.launch 13 | 14 | class NotesViewModel(application: Application) : AndroidViewModel(application) { 15 | 16 | private val db = Room.databaseBuilder( 17 | application.applicationContext, 18 | AppDatabase::class.java, 19 | "db-notes" 20 | ).build() 21 | 22 | var notes by mutableStateOf(listOf()) 23 | private set 24 | 25 | // Load initial data from Room asynchronously. 26 | init { 27 | GlobalScope.launch { 28 | val items = db.notes().getAll() 29 | viewModelScope.launch { notes = items } 30 | } 31 | } 32 | 33 | fun addNote(note: String) { 34 | // Generate ID in a simple way - from timestamp. 35 | val noteObj = Note((System.currentTimeMillis() % Int.MAX_VALUE).toInt(), note) 36 | notes = notes + listOf(noteObj) 37 | GlobalScope.launch { db.notes().insert(noteObj) } 38 | } 39 | 40 | fun removeNote(note: Note) { 41 | notes = notes - listOf(note) 42 | GlobalScope.launch { db.notes().delete(note) } 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/ui/AddNote.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.ui 2 | 3 | import androidx.compose.foundation.Icon 4 | import androidx.compose.foundation.Text 5 | import androidx.compose.foundation.layout.Row 6 | import androidx.compose.foundation.layout.padding 7 | import androidx.compose.foundation.layout.size 8 | import androidx.compose.material.Button 9 | import androidx.compose.material.TextField 10 | import androidx.compose.material.icons.Icons 11 | import androidx.compose.material.icons.filled.Add 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.runtime.mutableStateOf 14 | import androidx.compose.runtime.remember 15 | import androidx.compose.ui.Alignment 16 | import androidx.compose.ui.Modifier 17 | import androidx.compose.ui.text.input.TextFieldValue 18 | import androidx.compose.ui.unit.dp 19 | 20 | @Composable 21 | fun AddNote(title: String, onNoteAdded: (String) -> Unit) { 22 | Row { 23 | val text = remember { mutableStateOf(TextFieldValue("")) } 24 | TextField( 25 | value = text.value, 26 | onValueChange = { text.value = it }, 27 | label = { Text(title) }, 28 | modifier = Modifier 29 | .weight(1f, true) 30 | .padding(16.dp, 16.dp, 8.dp, 16.dp) 31 | ) 32 | Button( 33 | onClick = { 34 | val newNote = text.value.text 35 | if (newNote.isNotBlank()) { 36 | onNoteAdded(newNote) 37 | text.value = TextFieldValue("") 38 | } 39 | }, 40 | modifier = Modifier 41 | .padding(8.dp, 16.dp, 16.dp, 16.dp) 42 | .gravity(Alignment.CenterVertically) 43 | ) { 44 | Icon( 45 | asset = Icons.Filled.Add, 46 | modifier = Modifier.size(24.dp) 47 | ) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/ui/ShowNotes.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.ui 2 | 3 | import androidx.compose.foundation.Icon 4 | import androidx.compose.foundation.Text 5 | import androidx.compose.foundation.layout.InnerPadding 6 | import androidx.compose.foundation.layout.Row 7 | import androidx.compose.foundation.layout.padding 8 | import androidx.compose.foundation.layout.size 9 | import androidx.compose.foundation.lazy.LazyColumnFor 10 | import androidx.compose.material.TextButton 11 | import androidx.compose.material.icons.Icons 12 | import androidx.compose.material.icons.filled.Delete 13 | import androidx.compose.runtime.Composable 14 | import androidx.compose.ui.Alignment 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.unit.dp 17 | import com.localazy.quicknote.notes.Note 18 | 19 | @Composable 20 | fun ShowNotes(items: List, onNodeRemoved: (Note) -> Unit) { 21 | LazyColumnFor(items = items) { 22 | Row { 23 | Text( 24 | text = it.content, 25 | modifier = Modifier 26 | .padding(16.dp, 4.dp, 4.dp, 4.dp) 27 | .weight(1f, true) 28 | .gravity(Alignment.CenterVertically) 29 | ) 30 | TextButton( 31 | onClick = { 32 | onNodeRemoved(it) 33 | }, 34 | contentPadding = InnerPadding(0.dp), 35 | modifier = Modifier 36 | .padding(4.dp, 4.dp, 16.dp, 4.dp) 37 | .gravity(Alignment.CenterVertically) 38 | ) { 39 | Icon( 40 | asset = Icons.Filled.Delete, 41 | modifier = Modifier.size(24.dp) 42 | ) 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /app/src/main/java/com/localazy/quicknote/windows/Window.kt: -------------------------------------------------------------------------------- 1 | package com.localazy.quicknote.windows 2 | 3 | import android.content.Context 4 | import android.graphics.PixelFormat 5 | import android.os.Build 6 | import android.util.DisplayMetrics 7 | import android.view.Gravity 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.WindowManager 11 | import android.widget.Toast 12 | import com.localazy.quicknote.R 13 | 14 | 15 | class Window(private val context: Context) { 16 | 17 | private val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager 18 | private val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater 19 | private val rootView = layoutInflater.inflate(R.layout.window, null) 20 | 21 | private val windowParams = WindowManager.LayoutParams( 22 | 0, 23 | 0, 24 | 0, 25 | 0, 26 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 27 | WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY 28 | } else { 29 | WindowManager.LayoutParams.TYPE_PHONE 30 | }, 31 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or 32 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or 33 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or 34 | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, 35 | PixelFormat.TRANSLUCENT 36 | ) 37 | 38 | 39 | private fun getCurrentDisplayMetrics(): DisplayMetrics { 40 | val dm = DisplayMetrics() 41 | windowManager.defaultDisplay.getMetrics(dm) 42 | return dm 43 | } 44 | 45 | 46 | private fun calculateSizeAndPosition( 47 | params: WindowManager.LayoutParams, 48 | widthInDp: Int, 49 | heightInDp: Int 50 | ) { 51 | val dm = getCurrentDisplayMetrics() 52 | // We have to set gravity for which the calculated position is relative. 53 | params.gravity = Gravity.TOP or Gravity.LEFT 54 | params.width = (widthInDp * dm.density).toInt() 55 | params.height = (heightInDp * dm.density).toInt() 56 | params.x = (dm.widthPixels - params.width) / 2 57 | params.y = (dm.heightPixels - params.height) / 2 58 | } 59 | 60 | 61 | private fun initWindowParams() { 62 | calculateSizeAndPosition(windowParams, 300, 80) 63 | } 64 | 65 | 66 | private fun initWindow() { 67 | // Using kotlin extension for views caused error, so good old findViewById is used 68 | rootView.findViewById(R.id.window_close).setOnClickListener { close() } 69 | rootView.findViewById(R.id.content_button).setOnClickListener { 70 | Toast.makeText(context, "Adding notes to be implemented.", Toast.LENGTH_SHORT).show() 71 | } 72 | } 73 | 74 | 75 | init { 76 | initWindowParams() 77 | initWindow() 78 | } 79 | 80 | 81 | fun open() { 82 | try { 83 | windowManager.addView(rootView, windowParams) 84 | } catch (e: Exception) { 85 | // Ignore exception for now, but in production, you should have some 86 | // warning for the user here. 87 | } 88 | } 89 | 90 | 91 | fun close() { 92 | try { 93 | windowManager.removeView(rootView) 94 | } catch (e: Exception) { 95 | // Ignore exception for now, but in production, you should have some 96 | // warning for the user here. 97 | } 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_highlight_off_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_highlight_off_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_highlight_off_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_highlight_off_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_highlight_off_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_highlight_off_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_highlight_off_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_highlight_off_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_note_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_note_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_note_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_note_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_note_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_note_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_note_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_note_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_send_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_send_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_send_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_send_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_send_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_send_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baseline_send_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-hdpi/baseline_send_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_highlight_off_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_highlight_off_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_highlight_off_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_highlight_off_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_highlight_off_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_highlight_off_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_highlight_off_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_highlight_off_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_note_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_note_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_note_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_note_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_note_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_note_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_note_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_note_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_send_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_send_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_send_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_send_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_send_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_send_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/baseline_send_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-mdpi/baseline_send_black_48.png -------------------------------------------------------------------------------- /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/drawable-xhdpi/baseline_highlight_off_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_highlight_off_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_note_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_note_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_note_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_note_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_note_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_note_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_note_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_note_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_send_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_send_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_send_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_send_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_send_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_send_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/baseline_send_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xhdpi/baseline_send_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_highlight_off_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_note_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_note_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_note_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_note_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_note_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_note_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_note_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_note_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_send_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_send_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_send_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_send_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_send_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_send_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/baseline_send_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxhdpi/baseline_send_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_highlight_off_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_note_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_note_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_note_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_note_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_note_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_note_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_note_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_note_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_send_black_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_send_black_18.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_send_black_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_send_black_24.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_send_black_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_send_black_36.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/baseline_send_black_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/drawable-xxxhdpi/baseline_send_black_48.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/window.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 28 | 29 | 40 | 41 | 42 | 49 | 50 | 55 | 56 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | #FF888888 8 | #FFFFFFFF 9 | #FFEE7777 10 | #FFDDDDDD 11 | #FF448844 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | QuickNote 3 | Add Note 4 | QuickNote 5 | Tap to add quick note. 6 | Exit 7 | Permission Required 8 | Please enabled \'Draw over other apps\' permission for QuickNote to work correctly. 9 | Open Settings 10 | Permission Error 11 | Cannot open the settings screen for obtaining the required permission. 12 | OK 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = "1.4.10" 3 | repositories { 4 | google() 5 | jcenter() 6 | maven { url "https://maven.localazy.com/repository/release/" } 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.2.0-alpha11' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | classpath "com.localazy:gradle:1.5.2" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /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 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 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wbmcircle/Android_Floating_Windows/c023cb073278cc1ae143bc696ae2082b783c606f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Sep 16 14:10:06 CEST 2020 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-6.6.1-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "QuickNote 4" 3 | --------------------------------------------------------------------------------