From 79ef7ee505523a6f3ce65eb4bfb46fe875a7588d Mon Sep 17 00:00:00 2001 From: Gaurav Ujjwal Date: Wed, 5 May 2021 14:30:37 +0530 Subject: [PATCH] Miscellaneous fixes: - Suppress compiler warning in VncClient.kt - Remove unused attributes in activity_url.xml - Remove memory constraints for Gradle (now using global config) --- .../main/java/com/gaurav/avnc/ui/home/HomeActivity.kt | 9 ++++++--- app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt | 1 + app/src/main/res/layout/activity_url.xml | 7 ++----- app/src/main/res/values/strings.xml | 2 +- gradle.properties | 1 - 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/gaurav/avnc/ui/home/HomeActivity.kt b/app/src/main/java/com/gaurav/avnc/ui/home/HomeActivity.kt index 3b11168..82efbb4 100644 --- a/app/src/main/java/com/gaurav/avnc/ui/home/HomeActivity.kt +++ b/app/src/main/java/com/gaurav/avnc/ui/home/HomeActivity.kt @@ -49,7 +49,7 @@ class HomeActivity : AppCompatActivity() { //Observers viewModel.editProfileEvent.observe(this) { showProfileEditor() } - viewModel.profileInsertedEvent.observe(this) { onProfileInserted() } + viewModel.profileInsertedEvent.observe(this) { onProfileInserted(it) } viewModel.profileDeletedEvent.observe(this) { showProfileDeletedMsg(it) } viewModel.newConnectionEvent.observe(this) { startVncActivity(this, it) } viewModel.discovery.servers.observe(this) { updateDiscoveryBadge(it) } @@ -88,9 +88,12 @@ class HomeActivity : AppCompatActivity() { ProfileEditorFragment().show(supportFragmentManager, "ProfileEditor") } - private fun onProfileInserted() { + private fun onProfileInserted(profile: ServerProfile) { tabController.showSavedServers() - Snackbar.make(binding.root, R.string.msg_server_profile_inserted, Snackbar.LENGTH_SHORT).show() + + // Only show snackbar for new servers + if (profile.ID == 0L) + Snackbar.make(binding.root, R.string.msg_server_profile_inserted, Snackbar.LENGTH_SHORT).show() } /** diff --git a/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt b/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt index 69596a6..c17fb95 100644 --- a/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt +++ b/app/src/main/java/com/gaurav/avnc/vnc/VncClient.kt @@ -280,6 +280,7 @@ class VncClient(private val observer: Observer) { private fun cbBell() = Unit // observer.onBell() @Keep + @Suppress("UNUSED_PARAMETER") private fun cbHandleCursorPos(x: Int, y: Int) = true //observer.onCursorMoved(x, y) diff --git a/app/src/main/res/layout/activity_url.xml b/app/src/main/res/layout/activity_url.xml index d49afb2..978eeeb 100644 --- a/app/src/main/res/layout/activity_url.xml +++ b/app/src/main/res/layout/activity_url.xml @@ -11,14 +11,11 @@ + android:layout_height="match_parent"> + android:layout_height="wrap_content"> Go Back Clear URL Enter address of VNC server - Server list is empty.\nUse the \'+\' button to add a Server, or\nUse the top urlbar to directly connect to a server. + Server list is empty.\nUse the \'+\' button to add a Server, or\nUse the top Urlbar to directly connect to a server. You can enter hostname or IP address.\n\'vnc://\' URIs are also supported. Discovery can automatically find supported servers\nrunning on your network. diff --git a/gradle.properties b/gradle.properties index 7468a02..2b33cc3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,4 +13,3 @@ #Fri Apr 16 20:25:09 IST 2021 android.enableJetifier=true android.useAndroidX=true -org.gradle.jvmargs=-Xmx1024M -Dkotlin.daemon.jvm.options\="-Xmx512M"