kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Merge pull request #460 from legendgroupv2/dev-app-intro
Added App Introduction Screenspull/466/head
commit
edb03ff6b7
app
src/main
java/com/geeksville/mesh
res
drawable-nodpi
menu
values
|
@ -200,8 +200,15 @@ dependencies {
|
|||
implementation "androidx.core:core-splashscreen:1.0.0-beta02"
|
||||
|
||||
implementation project(':geeksville-androidlib')
|
||||
|
||||
// App intro
|
||||
implementation 'com.github.AppIntro:AppIntro:6.2.0'
|
||||
}
|
||||
|
||||
kapt {
|
||||
correctErrorTypes true
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
|
@ -191,6 +191,9 @@
|
|||
android:path="com.geeksville.mesh" /> -->
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".AppIntroduction"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package com.geeksville.mesh
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.github.appintro.AppIntro
|
||||
import com.github.appintro.AppIntroFragment
|
||||
|
||||
class AppIntroduction : AppIntro() {
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// Make sure you don't call setContentView!
|
||||
|
||||
// Call addSlide passing your Fragments.
|
||||
// You can use AppIntroFragment to use a pre-built fragment
|
||||
addSlide(
|
||||
AppIntroFragment.createInstance(
|
||||
title = resources.getString(R.string.intro_welcome_title),
|
||||
description = resources.getString(R.string.intro_meshtastic_desc),
|
||||
imageDrawable = R.mipmap.ic_launcher2_round,
|
||||
backgroundColorRes = R.color.colourGrey,
|
||||
descriptionColorRes = R.color.colorOnPrimary
|
||||
))
|
||||
addSlide(AppIntroFragment.createInstance(
|
||||
title = resources.getString(R.string.intro_get_started),
|
||||
description = resources.getString(R.string.intro_started_text),
|
||||
imageDrawable = R.drawable.icon_meanings,
|
||||
backgroundColorRes = R.color.colourGrey,
|
||||
descriptionColorRes = R.color.colorOnPrimary
|
||||
))
|
||||
addSlide(AppIntroFragment.createInstance(
|
||||
title = resources.getString(R.string.intro_encryption_title),
|
||||
description = resources.getString(R.string.intro_encryption_text),
|
||||
imageDrawable = R.drawable.channel_name_image,
|
||||
backgroundColorRes = R.color.colourGrey,
|
||||
descriptionColorRes = R.color.colorOnPrimary
|
||||
))
|
||||
//addSlide(SlideTwoFragment())
|
||||
}
|
||||
|
||||
override fun onSkipPressed(currentFragment: Fragment?) {
|
||||
super.onSkipPressed(currentFragment)
|
||||
// Decide what to do when the user clicks on "Skip"
|
||||
finish()
|
||||
val preferences = getSharedPreferences("PREFERENCES", Context.MODE_PRIVATE)
|
||||
var editor = preferences.edit()
|
||||
editor.putBoolean("app_intro_completed", true)
|
||||
editor.apply()
|
||||
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
}
|
||||
|
||||
override fun onDonePressed(currentFragment: Fragment?) {
|
||||
super.onDonePressed(currentFragment)
|
||||
// Decide what to do when the user clicks on "Done"
|
||||
finish()
|
||||
val preferences = getSharedPreferences("PREFERENCES", Context.MODE_PRIVATE)
|
||||
var editor = preferences.edit()
|
||||
editor.putBoolean("app_intro_completed", true)
|
||||
editor.apply()
|
||||
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
}
|
||||
}
|
|
@ -404,9 +404,16 @@ class MainActivity : BaseActivity(), Logging,
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val preferences = getSharedPreferences("PREFERENCES", Context.MODE_PRIVATE)
|
||||
|
||||
installSplashScreen()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (preferences.getBoolean("app_intro_completed", false) == false) {
|
||||
startActivity(Intent(this, AppIntroduction::class.java))
|
||||
}
|
||||
|
||||
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
|
||||
val prefs = UIViewModel.getPreferences(this)
|
||||
|
@ -1070,6 +1077,10 @@ class MainActivity : BaseActivity(), Logging,
|
|||
chooseMapStyle()
|
||||
return true
|
||||
}
|
||||
R.id.show_intro -> {
|
||||
startActivity(Intent(this, AppIntroduction::class.java))
|
||||
return true
|
||||
}
|
||||
R.id.preferences_quick_chat -> {
|
||||
val fragmentManager: FragmentManager = supportFragmentManager
|
||||
val fragmentTransaction: FragmentTransaction = fragmentManager.beginTransaction()
|
||||
|
|
|
@ -21,9 +21,11 @@ val Context.bluetoothManager: BluetoothManager? get() = getSystemService(Context
|
|||
val Context.deviceManager: CompanionDeviceManager?
|
||||
@SuppressLint("InlinedApi")
|
||||
get() {
|
||||
val activity: MainActivity? = GeeksvilleApplication.currentActivity as MainActivity?
|
||||
return if (hasCompanionDeviceApi()) activity?.getSystemService(Context.COMPANION_DEVICE_SERVICE) as? CompanionDeviceManager?
|
||||
else null
|
||||
if (GeeksvilleApplication.currentActivity is MainActivity) {
|
||||
val activity = GeeksvilleApplication.currentActivity
|
||||
if (hasCompanionDeviceApi()) return activity?.getSystemService(Context.COMPANION_DEVICE_SERVICE) as? CompanionDeviceManager?
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
val Context.usbManager: UsbManager get() = requireNotNull(getSystemService(Context.USB_SERVICE) as? UsbManager?) { "USB_SERVICE is not available"}
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 194 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 52 KiB |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".AppIntroduction">
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -36,6 +36,10 @@
|
|||
android:id="@+id/preferences_map_style"
|
||||
android:title="@string/preferences_map_style"
|
||||
app:showAsAction="withText" />
|
||||
<item
|
||||
android:id="@+id/show_intro"
|
||||
android:title="@string/show_intro"
|
||||
app:showAsAction="withText" />
|
||||
<item
|
||||
android:id="@+id/preferences_quick_chat"
|
||||
android:title="Quick chat options"
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
<color name="selectedColor">#67EA94</color>
|
||||
<color name="unselectedColor">#212121</color>
|
||||
<color name="buttonColor">#67EA94</color>
|
||||
<color name="colourGrey">#535353</color>
|
||||
</resources>
|
||||
|
|
|
@ -144,6 +144,14 @@
|
|||
<string name="resend">Resend</string>
|
||||
<string name="shutdown">Shutdown</string>
|
||||
<string name="reboot">Reboot</string>
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="show_intro">Show Introduction</string>
|
||||
<string name="intro_welcome_title">Welcome to Meshtastic</string>
|
||||
<string name="intro_meshtastic_desc">Meshtastic is an open-source, off-grid, encrypted communication platform. The meshtastic radios form a mesh network and communicate using the LoRa protocol to send text messages</string>
|
||||
<string name="intro_get_started">...Let\'s get started!</string>
|
||||
<string name="intro_started_text">Connect your meshtastic device by using either Bluetooth, Serial or WiFi. \n\nYou can see which devices are compatible at www.meshtastic.org/docs/hardware</string>
|
||||
<string name="intro_encryption_title">"Setting up encryption"</string>
|
||||
<string name="intro_encryption_text">As standard, a default encryption key is set. To enable your own channel and enhanced encryption, go to the channel tab and change the channel name, this will set a random key for AES256 encryption. \n\nTo communicate with other devices they will need to scan your QR code or follow the shared link to configure the channel settings.</string>
|
||||
<string name="message">Message</string>
|
||||
<string name="mode_append">Append to message</string>
|
||||
<string name="mode_instant">Instantly send</string>
|
||||
|
|
Ładowanie…
Reference in New Issue