Skip to content

Commit

Permalink
few change
Browse files Browse the repository at this point in the history
  • Loading branch information
WirelessAlien committed Dec 27, 2024
1 parent 1a9053a commit bfb4328
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.google.android.material.card.MaterialCardView
Expand Down Expand Up @@ -105,6 +106,7 @@ class FileAdapter(private val context: Context, private val mainFragment: MainFr
val fileExtension: TextView = itemView.findViewById(R.id.file_extension)
val fileCheckIcon: ImageView = itemView.findViewById(R.id.check_icon)
private val fileIconCv: MaterialCardView = itemView.findViewById(R.id.card_view)
val constLayout: ConstraintLayout = itemView.findViewById(R.id.constraint_layout)

init {
itemView.isClickable = true
Expand Down Expand Up @@ -193,8 +195,10 @@ class FileAdapter(private val context: Context, private val mainFragment: MainFr

if (selectedItems.get(position, false)) {
holder.fileCheckIcon.visibility = View.VISIBLE
holder.constLayout.setBackgroundColor(context.getColor(R.color.md_theme_outline))
} else {
holder.fileCheckIcon.visibility = View.GONE
holder.constLayout.setBackgroundColor(context.getColor(R.color.md_theme_surface))

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Lifecycle
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.transition.TransitionInflater
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.button.MaterialButton
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.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.transition.MaterialSharedAxis
import com.wirelessalien.zipxtract.AboutFragment
import com.wirelessalien.zipxtract.BuildConfig
import com.wirelessalien.zipxtract.R
Expand Down Expand Up @@ -223,9 +223,8 @@ class MainFragment : Fragment(), FileAdapter.OnItemClickListener, FileAdapter.On

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val inflater = TransitionInflater.from(requireContext())
enterTransition = inflater.inflateTransition(R.transition.fade_through)
exitTransition = inflater.inflateTransition(R.transition.fade_through)
enterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true)
exitTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false)
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
Expand Down Expand Up @@ -727,7 +726,7 @@ class MainFragment : Fragment(), FileAdapter.OnItemClickListener, FileAdapter.On
updateAdapterWithFullList()
} else {
Toast.makeText(requireContext(),
getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show()
getString(R.string.permission_denied), Toast.LENGTH_SHORT).show()
requireActivity().finish()
}
}
Expand Down Expand Up @@ -763,7 +762,7 @@ class MainFragment : Fragment(), FileAdapter.OnItemClickListener, FileAdapter.On
updateAdapterWithFullList()
} else {
// Permission denied
Toast.makeText(requireContext(), getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), getString(R.string.permission_denied), Toast.LENGTH_SHORT).show()
requireActivity().finish()
}
} else {
Expand All @@ -773,7 +772,7 @@ class MainFragment : Fragment(), FileAdapter.OnItemClickListener, FileAdapter.On
updateAdapterWithFullList()
} else {
// Permission denied
Toast.makeText(requireContext(), getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), getString(R.string.permission_denied), Toast.LENGTH_SHORT).show()
requireActivity().finish()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package com.wirelessalien.zipxtract.fragment
import android.R
import android.app.Dialog
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -30,6 +29,7 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.wirelessalien.zipxtract.adapter.FileAdapter
import com.wirelessalien.zipxtract.adapter.FilePathAdapter
import com.wirelessalien.zipxtract.databinding.ZipOptionDialogBinding
Expand Down Expand Up @@ -75,7 +75,6 @@ class ZipOptionDialogFragment : DialogFragment() {
adapter.getSelectedFilesPaths().toMutableList()
}

Log.d("ZipOptionDialogFragment", "Selected file paths: $selectedFilePaths")
binding.progressIndicator.visibility = View.GONE

initializeUI()
Expand All @@ -100,6 +99,15 @@ class ZipOptionDialogFragment : DialogFragment() {
}
}

binding.encInfo.setOnClickListener {
MaterialAlertDialogBuilder(requireContext(), com.wirelessalien.zipxtract.R.style.MaterialDialog)
.setMessage(getString(com.wirelessalien.zipxtract.R.string.settings_info_text))
.setPositiveButton(getString(com.wirelessalien.zipxtract.R.string.ok)) { _, _ ->
dismiss()
}
.show()
}

val compressionMethodSpinner = binding.compressionMethodInput
val compressionLevelSpinner = binding.compressionLevelInput
val encryptionMethodSpinner = binding.encryptionMethodInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class Archive7zService : Service() {

outArchive.close()
stopForegroundService()
showCompletionNotification()
sendLocalBroadcast(Intent(ACTION_ARCHIVE_COMPLETE).putExtra(EXTRA_DIR_PATH, sevenZFile.parent))
}
} catch (e: SevenZipException) {
Expand All @@ -220,6 +221,19 @@ class Archive7zService : Service() {
EXTRA_PROGRESS, progress))
}

private fun showCompletionNotification() {
stopForegroundService()

val notification = NotificationCompat.Builder(this, ARCHIVE_NOTIFICATION_CHANNEL_ID)
.setContentTitle(getString(R.string.sevenz_creation_success))
.setSmallIcon(R.drawable.ic_notification_icon)
.setAutoCancel(true)
.build()

val notificationManager = getSystemService(NotificationManager::class.java)
notificationManager.notify(NOTIFICATION_ID + 1, notification)
}

private fun showErrorNotification(error: String) {
stopForegroundService()
val notification = NotificationCompat.Builder(this, ARCHIVE_NOTIFICATION_CHANNEL_ID)
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/res/drawable/ic_dot.xml

This file was deleted.

3 changes: 1 addition & 2 deletions app/src/main/res/layout/bottom_sheet_option.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">


<TextView
android:id="@+id/fileName"
android:layout_width="wrap_content"
Expand All @@ -14,6 +13,7 @@
android:textSize="18sp"
android:layout_marginStart="16dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="16dp"
android:textStyle="bold"/>

<com.google.android.material.button.MaterialButton
Expand Down Expand Up @@ -107,5 +107,4 @@
android:layout_marginEnd="16dp"
android:layout_marginBottom="20dp"
android:text="@string/delete" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,16 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

<!-- activity_file_details.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="200dp"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Selected Files"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:layout_marginStart="10dp"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewFilesDialog"
android:id="@+id/crash_log_text"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</LinearLayout>
android:layout_height="200dp"
android:ellipsize="end"
android:padding="16dp"
android:textSize="14sp" />
</LinearLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
android:layout_marginEnd="10dp"
android:gravity="center_vertical"
android:alpha="0.7"
android:layout_marginBottom="5dp"
android:text="TextView"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/file_size"
app:drawableStartCompat="@drawable/ic_dot" />
app:layout_constraintEnd_toEndOf="parent"/>

<TextView
android:id="@+id/file_size"
Expand Down
37 changes: 28 additions & 9 deletions app/src/main/res/layout/zip_option_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,37 @@
android:layout_marginBottom="5dp"
android:text="@string/encryption_method"/>

<com.google.android.material.card.MaterialCardView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="5dp"
android:layout_margin="5dp">
android:orientation="horizontal">

<Spinner
android:id="@+id/encryption_method_input"
android:layout_width="match_parent"
android:layout_height="48dp"
android:padding="5dp"/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/encCv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/encInfo"
app:cardCornerRadius="5dp"
android:layout_margin="5dp">

<Spinner
android:id="@+id/encryption_method_input"
android:layout_width="match_parent"
android:layout_height="48dp"
android:padding="5dp"/>
</com.google.android.material.card.MaterialCardView>

<com.google.android.material.button.MaterialButton
android:id="@+id/encInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/ic_info"
app:cornerRadius="5dp"/>
</RelativeLayout>

<TextView
android:layout_width="wrap_content"
Expand Down
20 changes: 0 additions & 20 deletions app/src/main/res/transition/fade_through.xml

This file was deleted.

20 changes: 0 additions & 20 deletions app/src/main/res/transition/slide_left.xml

This file was deleted.

20 changes: 0 additions & 20 deletions app/src/main/res/transition/slide_right.xml

This file was deleted.

7 changes: 4 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@
<string name="report_an_issue">Report an Issue</string>
<string name="about">About</string>
<string name="delete">Delete</string>
<string name="confirm_delete">Comfirm Delete</string>
<string name="confirm_delete_message">Do you really want to delete the file?</string>
<string name="confirm_delete">Confirm Delete</string>
<string name="confirm_delete_message">Do you really want to delete this file?</string>
<string name="file_deleted">File Deleted</string>
<string name="file_name">Name: %1$s</string>
<string name="file_path">Path: %1$s</string>
Expand All @@ -150,7 +150,8 @@
<string name="storage_access_permission_text">We need access to your storage to proceed. Please grant the necessary permissions.</string>
<string name="archive_success">File archived successfully</string>
<string name="sd_card">SD Card</string>
<string name="permission_not_granted">Permission not granted</string>
<string name="close">Close</string>
<string name="crash_log">Crash Log</string>
<string name="copy_text">Copy</string>

</resources>
4 changes: 0 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
-->

<resources>

<style name="MaterialButtonStyle" parent="Widget.Material3.Button.IconButton">
</style>

<!-- dialog style -->
<style name="MaterialDialog" parent="@style/ThemeOverlay.Material3.MaterialAlertDialog">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.ZipXtract.Dialog.Rounded</item>
Expand Down

0 comments on commit bfb4328

Please sign in to comment.