Skip to content

Commit

Permalink
Merge pull request #84 from javadjafari1/21-implement-the-about-us-sc…
Browse files Browse the repository at this point in the history
…reen

21 implement the about us screen
  • Loading branch information
javadjafari1 authored Aug 11, 2023
2 parents e3182d0 + 70e4c93 commit b5b8514
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 3 deletions.
13 changes: 11 additions & 2 deletions app/src/main/java/ir/thatsmejavad/backgroundable/NavGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ir.thatsmejavad.backgroundable.common.ui.ObserveArgument
import ir.thatsmejavad.backgroundable.common.ui.animatedComposable
import ir.thatsmejavad.backgroundable.core.AppScreens
import ir.thatsmejavad.backgroundable.core.viewmodel.daggerViewModel
import ir.thatsmejavad.backgroundable.screens.aboutus.AboutUsScreen
import ir.thatsmejavad.backgroundable.screens.collectionlist.CollectionListScreen
import ir.thatsmejavad.backgroundable.screens.collectionlist.CollectionListViewModel
import ir.thatsmejavad.backgroundable.screens.columncountpicker.ColumnCountPicker
Expand Down Expand Up @@ -174,8 +175,8 @@ internal fun NavGraphBuilder.mainNavGraph(navController: NavHostController) {
route = AppScreens.Settings.route,
) {
SettingsScreen(
navigateTo = {
navController.navigate(it)
navigateTo = { route ->
navController.navigate(route)
}
)
}
Expand Down Expand Up @@ -206,4 +207,12 @@ internal fun NavGraphBuilder.mainNavGraph(navController: NavHostController) {
}
)
}

animatedComposable(AppScreens.AboutUs.route) {
AboutUsScreen(
onBackClicked = {
navController.navigateUp()
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ internal sealed class AppScreens(val route: String) {
return "download-picker?id:$id"
}
}

object AboutUs : AppScreens(
"about-us"
)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package ir.thatsmejavad.backgroundable.core

import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.compose.ui.graphics.Color
import androidx.core.content.FileProvider
import ir.thatsmejavad.backgroundable.R
Expand Down Expand Up @@ -96,3 +99,40 @@ fun Bitmap.saveIn(
}
return tempFile
}

fun Context.openUrl(url: String) {
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
} catch (e: ActivityNotFoundException) {
toast(R.string.label_no_app_found_to_handle_this_request)
}
}

fun Context.composeMail(
recipientMail: String,
subject: String = "",
message: String = "",
) {
try {
val selectorIntent = Intent(Intent.ACTION_SENDTO).apply {
data = Uri.parse("mailto:")
}
val emailIntent = Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_EMAIL, arrayOf(recipientMail))
putExtra(Intent.EXTRA_SUBJECT, subject)
putExtra(Intent.EXTRA_TEXT, message)
selector = selectorIntent
}
startActivity(emailIntent)
} catch (e: ActivityNotFoundException) {
toast(R.string.label_no_app_found_to_handle_this_request)
}
}

fun Context.toast(message: String, duration: Int = Toast.LENGTH_LONG) {
Toast.makeText(this, message, duration).show()
}

fun Context.toast(@StringRes stringRes: Int, duration: Int = Toast.LENGTH_LONG) {
Toast.makeText(this, stringRes, duration).show()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ir.thatsmejavad.backgroundable.model

import androidx.annotation.DrawableRes

data class Contributor(
val name: String,
val position: String,
@DrawableRes val image: Int,
val links: List<ContributorLink>
)

data class ContributorLink(
@DrawableRes val icon: Int,
val url: String,
val name: String
)
Loading

0 comments on commit b5b8514

Please sign in to comment.