Skip to content

Commit

Permalink
Merge pull request #17 from droid-it/about-us-button
Browse files Browse the repository at this point in the history
add about us dialog to settings page
  • Loading branch information
justdvnsh authored Oct 14, 2021
2 parents 963f8f0 + 033b77a commit 6a4e697
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
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>

0 comments on commit 6a4e697

Please sign in to comment.