Added some Tips
This commit is contained in:
parent
16dd6649d8
commit
ec0a40d454
9 changed files with 57 additions and 12 deletions
|
|
@ -12,10 +12,12 @@ import android.os.Bundle
|
|||
import android.view.Window
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.gaurav.avnc.R
|
||||
import com.gaurav.avnc.databinding.ActivityUrlBinding
|
||||
import com.gaurav.avnc.ui.vnc.startVncActivity
|
||||
import com.gaurav.avnc.util.AppPreferences
|
||||
import com.gaurav.avnc.vnc.VncUri
|
||||
|
||||
/**
|
||||
|
|
@ -42,6 +44,8 @@ class UrlBarActivity : AppCompatActivity() {
|
|||
else
|
||||
binding.url.setText("")
|
||||
}
|
||||
|
||||
binding.urlTip.isVisible = AppPreferences(this).appearance.showTips
|
||||
}
|
||||
|
||||
private fun go(url: String): Boolean {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class AppPreferences(context: Context) {
|
|||
"dark" -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
}
|
||||
|
||||
val showTips; get() = prefs.getBoolean("show_tips", true)
|
||||
}
|
||||
|
||||
inner class Display {
|
||||
|
|
|
|||
9
app/src/main/res/drawable/ic_lightbulb.xml
Normal file
9
app/src/main/res/drawable/ic_lightbulb.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?colorOnSurface"
|
||||
android:pathData="M9,21c0,0.5 0.4,1 1,1h4c0.6,0 1,-0.5 1,-1v-1L9,20v1zM12,2C8.1,2 5,5.1 5,9c0,2.4 1.2,4.5 3,5.7L8,17c0,0.5 0.4,1 1,1h6c0.6,0 1,-0.5 1,-1v-2.3c1.8,-1.3 3,-3.4 3,-5.7 0,-3.9 -3.1,-7 -7,-7z" />
|
||||
</vector>
|
||||
|
|
@ -6,9 +6,10 @@
|
|||
~ See COPYING.txt for more details.
|
||||
-->
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
|
@ -35,22 +36,18 @@
|
|||
android:contentDescription="@string/desc_back_btn"
|
||||
android:src="@drawable/ic_arrow_back" />
|
||||
|
||||
<!--
|
||||
Hint color is transparent to make it invisible but still available for accessibility.
|
||||
This way we avoid the appearance of hint jumping from middle to left when
|
||||
transitioning from HomeActivity.
|
||||
-->
|
||||
<EditText
|
||||
android:id="@+id/url"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/hint_host"
|
||||
android:contentDescription="@string/desc_server_url"
|
||||
android:imeOptions="actionGo|flagNoExtractUi"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
android:textColorHint="@android:color/transparent" />
|
||||
android:textColorHint="@android:color/transparent"
|
||||
tools:ignore="LabelFor" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/clear"
|
||||
|
|
@ -61,5 +58,10 @@
|
|||
android:src="@drawable/ic_clear" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/url_tip"
|
||||
style="@style/TipView"
|
||||
android:text="@string/tip_urlbar" />
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/item_discovery" />
|
||||
|
||||
<TextView
|
||||
style="@style/TipView"
|
||||
android:text="@string/tip_discovery"
|
||||
android:visibility="gone"
|
||||
app:isVisible="@{viewModel.pref.appearance.showTips && !viewModel.discovery.isRunning && viewModel.discovery.servers.empty}"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
-->
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
|
@ -28,6 +29,13 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/item_server" />
|
||||
|
||||
<TextView
|
||||
style="@style/TipView"
|
||||
android:text="@string/tip_empty_server_list"
|
||||
android:visibility="gone"
|
||||
app:isVisible="@{viewModel.pref.appearance.showTips && viewModel.serverProfiles.empty}"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
style="@style/Widget.Design.FloatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@
|
|||
<string name="desc_retry_connection_btn">Retry Connection</string>
|
||||
<string name="desc_back_btn">Go Back</string>
|
||||
<string name="desc_clear_url_btn">Clear URL</string>
|
||||
<string name="desc_server_url">Enter address of VNC server</string>
|
||||
<string name="tip_empty_server_list">Server list is empty.\nUse the \'<b>+</b>\' button to add a Server, or\nUse the top urlbar to directly connect to a server.</string>
|
||||
<string name="tip_urlbar">You can enter hostname or IP address.\n\'vnc://\' URIs are also supported.</string>
|
||||
<string name="tip_discovery">Discovery can automatically find supported servers\nrunning on your network.</string>
|
||||
|
||||
<!-- Preference -->
|
||||
<string name="title_pref_activity">Settings</string>
|
||||
|
|
@ -97,6 +101,7 @@
|
|||
<string name="pref_experimental_summary">Extra goodies!</string>
|
||||
|
||||
<string name="pref_theme">Theme</string>
|
||||
<string name="pref_show_tips">Show Tips</string>
|
||||
<string name="pref_gesture">Gestures</string>
|
||||
<string name="pref_single_tap">Single Tap</string>
|
||||
<string name="pref_double_tap">Double Tap</string>
|
||||
|
|
|
|||
|
|
@ -38,10 +38,12 @@
|
|||
<item name="android:layout_marginBottom">@dimen/margin_normal</item>
|
||||
</style>
|
||||
|
||||
<style name="FormLabel" parent="Widget.AppCompat.TextView">
|
||||
<style name="TipView" parent="Widget.AppCompat.TextView">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginStart">@dimen/margin_normal</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:drawableTop">@drawable/ic_lightbulb</item>
|
||||
</style>
|
||||
|
||||
<style name="FormField">
|
||||
|
|
|
|||
|
|
@ -17,4 +17,9 @@
|
|||
app:title="@string/pref_theme"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="true"
|
||||
app:key="show_tips"
|
||||
app:title="@string/pref_show_tips" />
|
||||
|
||||
</PreferenceScreen>
|
||||
Loading…
Add table
Reference in a new issue