diff --git a/build.gradle b/build.gradle index 37f34db0..3eee649c 100644 --- a/build.gradle +++ b/build.gradle @@ -26,8 +26,8 @@ android { applicationId = 'com.looker.droidify' minSdk = 21 targetSdk = 31 - versionCode = 35 - versionName = "0.3.5" + versionCode = 36 + versionName = "0.3.6" } sourceSets.all { @@ -118,15 +118,15 @@ repositories { dependencies { // Frontend - implementation 'androidx.appcompat:appcompat:1.4.0-beta01' + implementation 'androidx.appcompat:appcompat:1.4.0-rc01' implementation 'androidx.viewpager2:viewpager2:1.0.0' - implementation 'androidx.fragment:fragment-ktx:1.4.0-alpha10' + implementation 'androidx.fragment:fragment-ktx:1.4.0-beta01' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' - implementation 'com.google.android.material:material:1.5.0-alpha04' + implementation 'com.google.android.material:material:1.5.0-alpha05' // Backend implementation 'io.coil-kt:coil:1.4.0' - implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.core:core-ktx:1.7.0' implementation 'io.reactivex.rxjava3:rxjava:3.1.1' implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0' diff --git a/metadata/en-US/changelogs/36.txt b/metadata/en-US/changelogs/36.txt new file mode 100644 index 00000000..11270c28 --- /dev/null +++ b/metadata/en-US/changelogs/36.txt @@ -0,0 +1,7 @@ +- Added Icon for opening Details +- Top App Bar Differences made more prominent +- Root Permission will only be asked when used +- Switch Visibility fixes +- Added Arabic Translation +- Long press on source Icon to copy link +- Replace Toast with Snackbar \ No newline at end of file diff --git a/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt b/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt index cab1e3d7..cfd063f6 100644 --- a/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt +++ b/src/main/kotlin/com/looker/droidify/screen/ProductAdapter.kt @@ -115,7 +115,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) private enum class LinkType( val iconResId: Int, val titleResId: Int, - val format: ((Context, String) -> String)? = null + val format: ((Context, String) -> String)? = null, ) { AUTHOR(R.drawable.ic_person, R.string.author_website), EMAIL(R.drawable.ic_email, R.string.author_email), @@ -149,7 +149,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) class SwitchItem( val switchType: SwitchType, val packageName: String, - val versionCode: Long + val versionCode: Long, ) : Item() { override val descriptor: String get() = "switch.${switchType.name}" @@ -160,7 +160,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) class SectionItem( val sectionType: SectionType, val expandType: ExpandType, - val items: List, val collapseCount: Int + val items: List, val collapseCount: Int, ) : Item() { constructor(sectionType: SectionType) : this( sectionType, @@ -255,7 +255,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) class PermissionsItem( val group: PermissionGroupInfo?, - val permissions: List + val permissions: List, ) : Item() { override val descriptor: String get() = "permissions.${group?.name}.${permissions.joinToString(separator = ".") { it.name }}" @@ -266,7 +266,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) class ScreenshotItem( val repository: Repository, val packageName: String, - val screenshot: Product.Screenshot + val screenshot: Product.Screenshot, ) : Item() { override val descriptor: String get() = "screenshot.${repository.id}.${screenshot.identifier}" @@ -277,7 +277,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) class ReleaseItem( val repository: Repository, val release: Release, val selectedRepository: Boolean, - val showSignature: Boolean + val showSignature: Boolean, ) : Item() { override val descriptor: String get() = "release.${repository.id}.${release.identifier}" @@ -603,7 +603,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) outRect: Rect, parent: RecyclerView, position: Int, - count: Int + count: Int, ) { val column = position % columns val rows = (count + columns - 1) / columns @@ -631,7 +631,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) outRect: Rect, view: View, parent: RecyclerView, - state: RecyclerView.State + state: RecyclerView.State, ) { val holder = parent.getChildViewHolder(view) if (holder is ScreenshotViewHolder) { @@ -664,7 +664,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) fun setProducts( context: Context, packageName: String, - products: List>, installedItem: InstalledItem? + products: List>, installedItem: InstalledItem?, ) { val productRepository = Product.findSuggested(products, installedItem) { it.first } items.clear() @@ -759,9 +759,10 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) ) else null val item = Item.TextItem(TextType.DESCRIPTION, description) if (cropped != null) { + val croppedItem = Item.TextItem(TextType.DESCRIPTION, cropped) items += listOf( - Item.TextItem(TextType.DESCRIPTION, cropped), - Item.ExpandItem(ExpandType.DESCRIPTION, true, listOf(item)) + croppedItem, + Item.ExpandItem(ExpandType.DESCRIPTION, true, listOf(item, croppedItem)) ) } else { items += item @@ -796,9 +797,10 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) if (ExpandType.CHANGES !in expanded) changes.lineCropped(12, 10) else null val item = Item.TextItem(TextType.CHANGES, changes) if (cropped != null) { + val croppedItem = Item.TextItem(TextType.CHANGES, cropped) items += listOf( - Item.TextItem(TextType.CHANGES, cropped), - Item.ExpandItem(ExpandType.CHANGES, true, listOf(item)) + croppedItem, + Item.ExpandItem(ExpandType.CHANGES, true, listOf(item, croppedItem)) ) } else { items += item @@ -1011,7 +1013,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) override fun onCreateViewHolder( parent: ViewGroup, - viewType: ViewType + viewType: ViewType, ): RecyclerView.ViewHolder { return when (viewType) { ViewType.HEADER -> HeaderViewHolder(parent.inflate(R.layout.product_header_item)).apply { @@ -1073,25 +1075,41 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) itemView.setOnClickListener { val position = adapterPosition val expandItem = items[position] as Item.ExpandItem - items.removeAt(position) - expanded += expandItem.expandType - if (expandItem.replace) { - expandItem.items.forEachIndexed { index, item -> - items[position - expandItem.items.size + index] = item + if (expandItem.expandType !in expanded) { + expanded += expandItem.expandType + if (expandItem.replace) { + items[position - 1] = expandItem.items[0] + notifyItemRangeChanged( + position - expandItem.items.size, + expandItem.items.size + ) + notifyItemChanged(position, Payload.REFRESH) + } else { + items.addAll(position, expandItem.items) + if (position > 0) { + // Update decorations + notifyItemChanged(position - 1, Payload.REFRESH) + } + notifyItemChanged(position, Payload.REFRESH) + notifyItemRangeInserted(position, expandItem.items.size) } - notifyItemRangeChanged( - position - expandItem.items.size, - expandItem.items.size - ) - notifyItemRemoved(position) } else { - items.addAll(position, expandItem.items) - if (position > 0) { - // Update decorations - notifyItemChanged(position - 1, Payload.REFRESH) + expanded -= expandItem.expandType + if (expandItem.replace) { + items[position - 1] = expandItem.items[1] + notifyItemRangeChanged( + position - expandItem.items.size, + expandItem.items.size + ) + notifyItemChanged(position, Payload.REFRESH) + } else { + items.removeAt(position - 1) + if (position > 0) { + // Update decorations + notifyItemRemoved(position - 1) + notifyItemChanged(position - 1, Payload.REFRESH) + } } - notifyItemRemoved(position) - notifyItemRangeInserted(position, expandItem.items.size) } } } @@ -1140,7 +1158,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) override fun onBindViewHolder( holder: RecyclerView.ViewHolder, position: Int, - payloads: List + payloads: List, ) { val context = holder.itemView.context val item = items[position] @@ -1304,12 +1322,14 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) ViewType.EXPAND -> { holder as ExpandViewHolder item as Item.ExpandItem - holder.text.setText( + holder.text.text = if (item.expandType !in expanded) { when (item.expandType) { - ExpandType.VERSIONS -> R.string.show_older_versions - else -> R.string.show_more + ExpandType.VERSIONS -> context.getString(R.string.show_older_versions) + else -> context.getString(R.string.show_more) } - ) + } else { + "Show Less" + } } ViewType.TEXT -> { holder as TextViewHolder @@ -1483,7 +1503,8 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) holder.compatibility.setTextColor(context.getColorFromAttr(R.attr.colorError)) holder.compatibility.text = when (incompatibility) { is Release.Incompatibility.MinSdk, - is Release.Incompatibility.MaxSdk -> context.getString( + is Release.Incompatibility.MaxSdk, + -> context.getString( R.string.incompatible_with_FORMAT, Android.name ) @@ -1580,14 +1601,14 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) text: CharSequence?, start: Int, end: Int, - fm: Paint.FontMetricsInt? + fm: Paint.FontMetricsInt?, ): Int { return paint.measureText(".").roundToInt() } override fun draw( canvas: Canvas, text: CharSequence?, start: Int, end: Int, - x: Float, top: Int, y: Int, bottom: Int, paint: Paint + x: Float, top: Int, y: Int, bottom: Int, paint: Paint, ) { canvas.drawText(".", x, y.toFloat(), paint) }