diff --git a/app/src/main/java/emu/skyline/MainActivity.kt b/app/src/main/java/emu/skyline/MainActivity.kt index d504c93b..6d8ef729 100644 --- a/app/src/main/java/emu/skyline/MainActivity.kt +++ b/app/src/main/java/emu/skyline/MainActivity.kt @@ -66,10 +66,9 @@ class MainActivity : AppCompatActivity(), View.OnClickListener { romFile.use { val entry = romFile.getAppEntry(file.uri) + val finalFoundCurrent = foundCurrent runOnUiThread { - if (!foundCurrent) { - adapter.addHeader(romFormat.name) - } + if (!finalFoundCurrent) adapter.addHeader(romFormat.name) adapter.addItem(AppItem(entry)) } @@ -335,5 +334,11 @@ class MainActivity : AppCompatActivity(), View.OnClickListener { if (layoutType != adapter.layoutType) { setupAppList() } + + val gridCardMagin = resources.getDimensionPixelSize(R.dimen.app_card_margin_half) + when (layoutType) { + LayoutType.List -> app_list.setPadding(0, 0, 0, 0) + LayoutType.Grid, LayoutType.GridCompact -> app_list.setPadding(gridCardMagin, 0, gridCardMagin, 0) + } } } diff --git a/app/src/main/java/emu/skyline/adapter/AppAdapter.kt b/app/src/main/java/emu/skyline/adapter/AppAdapter.kt index 709d0cc6..025dc007 100644 --- a/app/src/main/java/emu/skyline/adapter/AppAdapter.kt +++ b/app/src/main/java/emu/skyline/adapter/AppAdapter.kt @@ -14,7 +14,6 @@ import android.view.View import android.view.ViewGroup import android.view.Window import android.widget.ImageView -import android.widget.LinearLayout import android.widget.RelativeLayout import android.widget.TextView import androidx.core.content.ContextCompat @@ -123,18 +122,6 @@ internal class AppAdapter(val layoutType : LayoutType, private val gridSpan : In setOnClickListener { onClick.invoke(item) } setOnLongClickListener { true.also { onLongClick.invoke(item) } } } - - // Increase margin of edges to avoid huge gap in between items - if (layoutType == LayoutType.Grid || layoutType == LayoutType.GridCompact) { - holder.itemView.layoutParams = LinearLayout.LayoutParams(holder.itemView.layoutParams.width, holder.itemView.layoutParams.height).apply { - if (position % gridSpan == 0) { - marginStart = holder.itemView.resources.getDimensionPixelSize(R.dimen.app_card_margin) * 2 - } else if (position % gridSpan == gridSpan - 1) { - marginEnd = holder.itemView.resources.getDimensionPixelSize(R.dimen.app_card_margin) * 2 - } - } - holder.itemView.requestLayout() - } } else if (item is BaseHeader) { val holder = viewHolder as HeaderViewHolder diff --git a/app/src/main/java/emu/skyline/adapter/HeaderAdapter.kt b/app/src/main/java/emu/skyline/adapter/HeaderAdapter.kt index af7cabdd..1d3b9600 100644 --- a/app/src/main/java/emu/skyline/adapter/HeaderAdapter.kt +++ b/app/src/main/java/emu/skyline/adapter/HeaderAdapter.kt @@ -64,7 +64,7 @@ abstract class HeaderAdapter { HeaderViewHolder(view, view.findViewById(R.id.text_title)) } diff --git a/app/src/main/res/layout/app_item_grid.xml b/app/src/main/res/layout/app_item_grid.xml index b79b30d9..1a5f84f2 100644 --- a/app/src/main/res/layout/app_item_grid.xml +++ b/app/src/main/res/layout/app_item_grid.xml @@ -7,8 +7,8 @@ @@ -27,7 +27,8 @@ diff --git a/app/src/main/res/layout/app_item_grid_compact.xml b/app/src/main/res/layout/app_item_grid_compact.xml index a27fd687..15cfb7f4 100644 --- a/app/src/main/res/layout/app_item_grid_compact.xml +++ b/app/src/main/res/layout/app_item_grid_compact.xml @@ -7,7 +7,7 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/log_activity.xml b/app/src/main/res/layout/log_activity.xml index 2e9e684b..5ee4d06d 100644 --- a/app/src/main/res/layout/log_activity.xml +++ b/app/src/main/res/layout/log_activity.xml @@ -10,8 +10,8 @@ diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index 07a23e84..280adf62 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -14,6 +14,7 @@ android:id="@+id/app_list" android:layout_width="match_parent" android:layout_height="match_parent" + android:clipToPadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - - - - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="4dp" + android:textColor="?colorSecondary" + android:textSize="15sp" />