Added functionality to contact author at developer email

This commit is contained in:
Anthony La committed 2023-06-06 11:51:49 -07:00
1 parent b363e6d511
commit 50bc8f9e1b
3 files changed
+37 -5

No files matched your search

@@ -0,0 +1,25 @@
package com.anthonyla.livewallpaper.data
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.compose.runtime.Composable
import androidx.core.content.ContextCompat.startActivity
@Composable
fun Contact(context: Context) {
val email = "anthonyyla.dev@gmail.com"
val cc = ""
val subject = "[Contact] Live Wallpaper"
val bodyText = "This is regarding the Live Wallpaper app for Android:\n"
val mailto = "mailto:" + Uri.encode(email) +
"?cc=" + Uri.encode(cc) +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyText)
val emailIntent = Intent(Intent.ACTION_SENDTO)
emailIntent.setData(Uri.parse(mailto))
startActivity(context, emailIntent, null)
}
@@ -131,7 +131,8 @@ fun LiveWallpaperTheme(
}
MaterialTheme(
colorScheme = colors,
typography = typography,
content = content
typography = MaterialTheme.typography,
content = content,
shapes = MaterialTheme.shapes
)
}
@@ -1,9 +1,7 @@
package com.anthonyla.livewallpaper.ui
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.rounded.MoreVert
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
@@ -20,10 +18,12 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
import com.anthonyla.livewallpaper.R
import com.anthonyla.livewallpaper.data.Contact
import com.anthonyla.livewallpaper.data.navigation.SettingsNavScreens
@OptIn(ExperimentalMaterial3Api::class)
@@ -33,6 +33,12 @@ fun TopLevelBar (
modifier: Modifier = Modifier
) {
var expanded by rememberSaveable { mutableStateOf(false) }
var toContact by rememberSaveable { mutableStateOf(false) }
if (toContact) {
Contact(LocalContext.current)
toContact = false
expanded = false
}
CenterAlignedTopAppBar(
title = {},
navigationIcon = {},
@@ -67,7 +73,7 @@ fun TopLevelBar (
)
DropdownMenuItem(
text = { Text("Contact") },
onClick = { /*do something*/ }
onClick = { toContact = true }
)
}
}