Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add about us dialog to settings page #17

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint
import divyansh.tech.wallup.R
import divyansh.tech.wallup.databinding.FragmentSettingsBinding

@AndroidEntryPoint
Expand All @@ -20,4 +22,21 @@ class SettingsFragment: Fragment() {
_binding = FragmentSettingsBinding.inflate(inflater, container, false)
return _binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupAboutUsButton()
}

private fun setupAboutUsButton() {
_binding.aboutUsButton.setOnClickListener {
AlertDialog.Builder(requireContext())
.setTitle(R.string.title_about_us)
.setMessage(R.string.message_about_us)
.setPositiveButton(R.string.ok_button) { dialog, _ ->
dialog.dismiss()
}
.show()
}
}
}
27 changes: 21 additions & 6 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data/>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">

<data />

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/label_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SETTINGS"
android:gravity="center"
/>
app:layout_constraintBottom_toTopOf="@id/about_us_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/about_us_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_about_us"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/label_settings" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
9 changes: 9 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
<string name="set_as_wallpaper">Set as wallpaper</string>
<string name="search_wallpapers">Search Wallpapers</string>
<string name="no_results_for_your_search">No Results for your search</string>
<string name="title_about_us">About Us</string>
<string name="message_about_us">Why a wallpaper app ? Here\'s why:\n\n\* There are already a lot of wallpaper apps,
but they are optimized to show you the wallpapers only for your phone, i.e. they will only
find the wallpapers of the screen resolution of your phone. So to download higher quality wallpapers you\'d
anyhow need to download from your browser.\n\n\* Most of
the wallpaper apps show you the wallpaper which are curated by themselves or using any API. This app parses
the a lot of resources to provide you with the highest quality unique wallpapers.\n\n\* There are no ads.
</string>
<string name="ok_button">OK</string>
</resources>