Skip to content

Commit

Permalink
update AboutFragment, add privacy policy, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
WirelessAlien committed Dec 23, 2024
1 parent 7c7040a commit ef8dfab
Show file tree
Hide file tree
Showing 22 changed files with 253 additions and 265 deletions.
34 changes: 25 additions & 9 deletions app/src/main/java/com/wirelessalien/zipxtract/AboutFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,45 @@ import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.wirelessalien.zipxtract.databinding.FragmentAboutBinding


class AboutFragment : DialogFragment() {
private lateinit var binding: FragmentAboutBinding
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = FragmentAboutBinding.inflate(inflater, container, false)
return binding.root
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val binding = FragmentAboutBinding.inflate(layoutInflater)
val dialogView = binding.root
val dialog = super.onCreateDialog(savedInstanceState)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
return dialog
}

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

binding.versionNumberText.text = BuildConfig.VERSION_NAME

binding.githubIcon.setOnClickListener {
binding.sourceCode.setOnClickListener {
openUrl("https://github.com/WirelessAlien/ZipXtract")
}

binding.githubIssueButton.setOnClickListener {
binding.reportIssue.setOnClickListener {
openUrl("https://github.com/WirelessAlien/ZipXtract/issues")
}

binding.licenseText.setOnClickListener {
openUrl("https://www.apache.org/licenses/LICENSE-2.0.txt")
openUrl("https://www.gnu.org/licenses/gpl-3.0.txt")
}

binding.donate.setOnClickListener {
Expand All @@ -61,9 +77,9 @@ class AboutFragment : DialogFragment() {
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)))
}

return MaterialAlertDialogBuilder(requireContext())
.setView(dialogView)
.create()
binding.privacyPolicyLink.setOnClickListener {
openUrl("https://sites.google.com/view/privacy-policy-zipxtract/home")
}
}

private fun openUrl(url: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@
package com.wirelessalien.zipxtract

import android.app.Dialog
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.google.android.material.button.MaterialButton
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.wirelessalien.zipxtract.databinding.FragmentDonationBinding

Expand All @@ -48,7 +43,7 @@ class DonationFragment : DialogFragment() {
startActivity(intent)
}

return MaterialAlertDialogBuilder(requireContext())
return MaterialAlertDialogBuilder(requireContext(), R.style.MaterialDialog)
.setView(dView)
.create()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import androidx.core.content.FileProvider
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Lifecycle
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.recyclerview.widget.LinearLayoutManager
Expand All @@ -53,6 +54,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.progressindicator.LinearProgressIndicator
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText
import com.wirelessalien.zipxtract.AboutFragment
import com.wirelessalien.zipxtract.BuildConfig
import com.wirelessalien.zipxtract.R
import com.wirelessalien.zipxtract.adapter.FileAdapter
Expand Down Expand Up @@ -82,6 +84,7 @@ class ArchiveFragment : Fragment(), FileAdapter.OnItemClickListener {
SORT_BY_NAME, SORT_BY_SIZE, SORT_BY_MODIFIED, SORT_BY_EXTENSION
}
private var isSearchActive: Boolean = false
private var isLargeLayout: Boolean = false

private var sortBy: SortBy = SortBy.SORT_BY_NAME
private var sortAscending: Boolean = true
Expand Down Expand Up @@ -146,6 +149,7 @@ class ArchiveFragment : Fragment(), FileAdapter.OnItemClickListener {
sharedPreferences = requireActivity().getPreferences(Context.MODE_PRIVATE)
sortBy = SortBy.valueOf(sharedPreferences.getString("sortBy", SortBy.SORT_BY_NAME.name) ?: SortBy.SORT_BY_NAME.name)
sortAscending = sharedPreferences.getBoolean("sortAscending", true)
isLargeLayout = resources.getBoolean(R.bool.large_layout)

binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
adapter = FileAdapter(requireContext(), null, ArrayList())
Expand Down Expand Up @@ -207,6 +211,21 @@ class ArchiveFragment : Fragment(), FileAdapter.OnItemClickListener {
sortAscending = false
editor.putBoolean("sortAscending", sortAscending)
}
R.id.menu_about -> {
val fragmentManager = parentFragmentManager
val newFragment = AboutFragment()
if (isLargeLayout) {
// Show the fragment as a dialog.
newFragment.show(fragmentManager, "AboutFragment")
} else {
// Show the fragment fullscreen.
val transaction = fragmentManager.beginTransaction()
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
transaction.add(android.R.id.content, newFragment)
.addToBackStack(null)
.commit()
}
}
}
editor.apply()
updateAdapterWithFullList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import com.google.android.material.chip.Chip
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.progressindicator.LinearProgressIndicator
import com.google.android.material.textfield.TextInputEditText
import com.wirelessalien.zipxtract.AboutFragment
import com.wirelessalien.zipxtract.BuildConfig
import com.wirelessalien.zipxtract.R
import com.wirelessalien.zipxtract.adapter.FileAdapter
Expand Down Expand Up @@ -268,6 +269,21 @@ class MainFragment : Fragment(), FileAdapter.OnItemClickListener, FileAdapter.On
sortAscending = false
editor.putBoolean("sortAscending", sortAscending)
}
R.id.menu_about -> {
val fragmentManager = parentFragmentManager
val newFragment = AboutFragment()
if (isLargeLayout) {
// Show the fragment as a dialog.
newFragment.show(fragmentManager, "AboutFragment")
} else {
// Show the fragment fullscreen.
val transaction = fragmentManager.beginTransaction()
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
transaction.add(android.R.id.content, newFragment)
.addToBackStack(null)
.commit()
}
}
}
editor.apply()
initRecyclerView()
Expand Down
56 changes: 56 additions & 0 deletions app/src/main/res/drawable/app_icon_m.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
~ Copyright (C) 2023 WirelessAlien <https://github.com/WirelessAlien>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">>
<path
android:pathData="M3,14V10C3,6.229 3,4.343 4.172,3.172C5.343,2 7.229,2 11,2H13C16.771,2 18.657,2 19.828,3.172C20.482,3.825 20.771,4.7 20.899,6M21,10V14C21,17.771 21,19.657 19.828,20.828C18.657,22 16.771,22 13,22H11C7.229,22 5.343,22 4.172,20.828C3.518,20.175 3.229,19.3 3.101,18"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"
android:strokeLineCap="round"/>
<path
android:pathData="M9.5,15.5V15.375C9.5,14.892 9.892,14.5 10.375,14.5H13.625C14.108,14.5 14.5,14.892 14.5,15.375V15.5C14.5,16.881 13.381,18 12,18C10.619,18 9.5,16.881 9.5,15.5Z"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"
android:strokeLineCap="round"/>
<path
android:pathData="M9.5,3C9.5,2.529 9.5,2.293 9.646,2.146C9.793,2 10.029,2 10.5,2H11C11.471,2 11.707,2 11.854,2.146C12,2.293 12,2.529 12,3V3.5C12,3.971 12,4.207 11.854,4.354C11.707,4.5 11.471,4.5 11,4.5H10.5C10.029,4.5 9.793,4.5 9.646,4.354C9.5,4.207 9.5,3.971 9.5,3.5V3Z"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"/>
<path
android:pathData="M9.5,8C9.5,7.529 9.5,7.293 9.646,7.146C9.793,7 10.029,7 10.5,7H11C11.471,7 11.707,7 11.854,7.146C12,7.293 12,7.529 12,8V8.5C12,8.971 12,9.207 11.854,9.354C11.707,9.5 11.471,9.5 11,9.5H10.5C10.029,9.5 9.793,9.5 9.646,9.354C9.5,9.207 9.5,8.971 9.5,8.5V8Z"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"/>
<path
android:pathData="M12,5.5C12,5.029 12,4.793 12.146,4.646C12.293,4.5 12.529,4.5 13,4.5H13.5C13.971,4.5 14.207,4.5 14.354,4.646C14.5,4.793 14.5,5.029 14.5,5.5V6C14.5,6.471 14.5,6.707 14.354,6.854C14.207,7 13.971,7 13.5,7H13C12.529,7 12.293,7 12.146,6.854C12,6.707 12,6.471 12,6V5.5Z"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"/>
<path
android:pathData="M12,10.5C12,10.029 12,9.793 12.146,9.646C12.293,9.5 12.529,9.5 13,9.5H13.5C13.971,9.5 14.207,9.5 14.354,9.646C14.5,9.793 14.5,10.029 14.5,10.5V11C14.5,11.471 14.5,11.707 14.354,11.854C14.207,12 13.971,12 13.5,12H13C12.529,12 12.293,12 12.146,11.854C12,11.707 12,11.471 12,11V10.5Z"
android:strokeWidth="1.6320000000000001"
android:fillColor="#00000000"
android:strokeColor="#1C274C"/>
</vector>
10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_7z.xml

This file was deleted.

10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_archive.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,411.54Q467.23,411.54 458.62,420.15Q450,428.77 450,441.54L450,589.54L397.08,536.62Q388.77,528.31 376.19,528.12Q363.62,527.92 354.92,536.62Q346.23,545.31 346.23,557.69Q346.23,570.08 354.92,578.77L454.69,678.54Q465.54,689.38 480,689.38Q494.46,689.38 505.31,678.54L605.08,578.77Q613.38,570.46 613.58,557.88Q613.77,545.31 605.08,536.62Q596.38,527.92 584,527.92Q571.62,527.92 562.92,536.62L510,589.54L510,441.54Q510,428.77 501.38,420.15Q492.77,411.54 480,411.54ZM200,316.15L200,747.69Q200,753.08 203.46,756.54Q206.92,760 212.31,760L747.69,760Q753.08,760 756.54,756.54Q760,753.08 760,747.69L760,316.15L200,316.15ZM215.39,820Q185.46,820 162.73,797.27Q140,774.54 140,744.61L140,280.23Q140,267.39 144.12,255.73Q148.23,244.08 156.46,234.23L212.62,166.31Q222.46,153.46 237.23,146.73Q252,140 268.46,140L690.77,140Q707.23,140 722.19,146.73Q737.15,153.46 747,166.31L803.54,235Q811.77,244.85 815.88,256.69Q820,268.54 820,281.39L820,744.61Q820,774.54 797.27,797.27Q774.54,820 744.61,820L215.39,820ZM215.62,256.16L744,256.16L700.38,204.23Q698.46,202.31 695.96,201.15Q693.46,200 690.77,200L268.85,200Q266.16,200 263.65,201.15Q261.15,202.31 259.23,204.23L215.62,256.16ZM480,538.08L480,538.08L480,538.08Q480,538.08 480,538.08Q480,538.08 480,538.08L480,538.08Q480,538.08 480,538.08Q480,538.08 480,538.08Z"/>
</vector>
22 changes: 0 additions & 22 deletions app/src/main/res/drawable/ic_copy_all.xml

This file was deleted.

22 changes: 0 additions & 22 deletions app/src/main/res/drawable/ic_copy_file.xml

This file was deleted.

22 changes: 0 additions & 22 deletions app/src/main/res/drawable/ic_currency.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_description.xml

This file was deleted.

Loading

0 comments on commit ef8dfab

Please sign in to comment.