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

Remove description permission on AppDetailFragment #339

Merged
merged 4 commits into from
Dec 8, 2023
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 @@ -12,7 +12,6 @@ class ADPermissionsDiffUtil : DiffUtil.ItemCallback<Permission>() {
return when {
oldItem.shortName != newItem.shortName -> false
oldItem.label != newItem.label -> false
oldItem.description != newItem.description -> false
else -> true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package org.eu.exodus_privacy.exodusprivacy.fragments.appdetail.model

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import org.eu.exodus_privacy.exodusprivacy.R
import org.eu.exodus_privacy.exodusprivacy.databinding.RecyclerViewPermissionItemBinding
import org.eu.exodus_privacy.exodusprivacy.objects.Permission

Expand All @@ -32,21 +29,6 @@ class ADPermissionsRVAdapter :
holder.binding.apply {
permissionTitleTV.text = app.shortName
permissionSubTitleTV.text = app.label.replaceFirstChar { it.uppercase() }
if (app.description.isEmpty() || app.description == "null") {
permissionDescTV.visibility = View.GONE
expandBT.visibility = View.GONE
} else {
expandBT.setOnClickListener {
if (permissionDescTV.isVisible) {
expandBT.setIconResource(R.drawable.ic_down)
permissionDescTV.visibility = View.GONE
} else {
expandBT.setIconResource(R.drawable.ic_up)
permissionDescTV.text = app.description
permissionDescTV.visibility = View.VISIBLE
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class ExodusPackageRepository @Inject constructor(
return Permission(
shortName,
longName,
label.toString(),
permInfo.loadDescription(packageManager)?.toString() ?: ""
label.toString()
)
} ?: run {
return Permission(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ package org.eu.exodus_privacy.exodusprivacy.objects
data class Permission(
val shortName: String = String(),
val longName: String = String(),
val label: String = String(),
val description: String = String()
val label: String = String()
)
35 changes: 5 additions & 30 deletions app/src/main/res/layout/recycler_view_permission_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingVertical="4dp"
android:layout_marginTop="0dp"
android:minHeight="50dp"
android:clickable="true"
android:focusable="true"
tools:theme="@style/Theme.Exodus">
Expand All @@ -16,7 +16,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/expandBT"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="5dp"
android:textColor="?android:textColorPrimary"
Expand All @@ -28,35 +27,11 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/expandBT"
app:layout_constraintTop_toBottomOf="@id/permissionTitleTV"
android:layout_marginEnd="5dp"
android:textColor="?android:textColorSecondary"
android:textSize="15sp"
tools:text="Take pictures and videos" />

<com.google.android.material.button.MaterialButton
android:id="@+id/expandBT"
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/permissionTitleTV"
app:layout_constraintBottom_toBottomOf="@id/permissionSubTitleTV"
app:icon="@drawable/ic_down"
app:iconTint="?android:textColorPrimary" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/permissionDescTV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/permissionSubTitleTV"
android:layout_marginVertical="5dp"
android:paddingHorizontal="10dp"
android:layout_marginEnd="30dp"
android:textColor="?android:textColorSecondary"
android:textSize="15sp"
android:visibility="gone"
android:maxLines="3"
tools:text="Take pictures and videos" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>