diff --git a/.github/workflows/github_release.yml b/.github/workflows/github_release.yml index d026f23a..b452576c 100644 --- a/.github/workflows/github_release.yml +++ b/.github/workflows/github_release.yml @@ -45,7 +45,7 @@ jobs: bash ./gradlew assembleTempoDebug bash ./gradlew assembleNotquitemyDebug - - name: Sign Tempo Release APKs + - name: Sign All Tempo Release APKs id: sign_tempo_release uses: r0adkll/sign-android-release@v1 with: @@ -54,10 +54,11 @@ jobs: alias: ${{ secrets.KEY_ALIAS_GITHUB }} keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD_GITHUB }} + apkPath: "**/*.apk" env: BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} - - name: Sign NotQuiteMy Release APKs + - name: Sign All NotQuiteMy Release APKs id: sign_notquitemy_release uses: r0adkll/sign-android-release@v1 with: @@ -66,9 +67,38 @@ jobs: alias: ${{ secrets.KEY_ALIAS_GITHUB }} keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD_GITHUB }} + apkPath: "**/*.apk" env: BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} + - name: Rename and Prepare APK Files + run: | + # Copy and rename tempo APKs + for file in app/build/outputs/apk/tempo/release/*.apk; do + if [[ $file == *"arm64-v8a"* ]]; then + cp "$file" "./app-tempo-arm64-v8a-release.apk" + echo "Created: app-tempo-arm64-v8a-release.apk" + elif [[ $file == *"armeabi-v7a"* ]]; then + cp "$file" "./app-tempo-armeabi-v7a-release.apk" + echo "Created: app-tempo-armeabi-v7a-release.apk" + fi + done + + # Copy and rename notquitemy APKs + for file in app/build/outputs/apk/notquitemy/release/*.apk; do + if [[ $file == *"arm64-v8a"* ]]; then + cp "$file" "./app-notquitemy-arm64-v8a-release.apk" + echo "Created: app-notquitemy-arm64-v8a-release.apk" + elif [[ $file == *"armeabi-v7a"* ]]; then + cp "$file" "./app-notquitemy-armeabi-v7a-release.apk" + echo "Created: app-notquitemy-armeabi-v7a-release.apk" + fi + done + + # List the created files for verification + echo "Final APK files:" + ls -la *.apk + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -79,24 +109,44 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release APKs + - name: Upload Tempo 64-bit Release APK uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{steps.sign_tempo_release.outputs.signedReleaseFile}} - asset_name: app-tempo-release.apk + asset_path: ./app-tempo-arm64-v8a-release.apk + asset_name: app-tempo-arm64-v8a-release.apk asset_content_type: application/vnd.android.package-archive - - name: Upload NotQuiteMy Release APK + - name: Upload Tempo 32-bit Release APK uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{steps.sign_notquitemy_release.outputs.signedReleaseFile}} - asset_name: app-notquitemy-release.apk + asset_path: ./app-tempo-armeabi-v7a-release.apk + asset_name: app-tempo-armeabi-v7a-release.apk + asset_content_type: application/vnd.android.package-archive + + - name: Upload NotQuiteMy 64-bit Release APK + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./app-notquitemy-arm64-v8a-release.apk + asset_name: app-notquitemy-arm64-v8a-release.apk + asset_content_type: application/vnd.android.package-archive + + - name: Upload NotQuiteMy 32-bit Release APK + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./app-notquitemy-armeabi-v7a-release.apk + asset_name: app-notquitemy-armeabi-v7a-release.apk asset_content_type: application/vnd.android.package-archive - name: Upload Debug APKs as artifacts @@ -113,6 +163,8 @@ jobs: with: name: release-apks path: | - ${{steps.sign_tempo_release.outputs.signedReleaseFile}} - ${{steps.sign_notquitemy_release.outputs.signedReleaseFile}} + ./app-tempo-arm64-v8a-release.apk + ./app-tempo-armeabi-v7a-release.apk + ./app-notquitemy-arm64-v8a-release.apk + ./app-notquitemy-armeabi-v7a-release.apk retention-days: 30 \ No newline at end of file diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/AlbumCatalogueAdapter.java b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/AlbumCatalogueAdapter.java index 69583a40..e2d0563e 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/AlbumCatalogueAdapter.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/adapter/AlbumCatalogueAdapter.java @@ -152,6 +152,12 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter albums) { + this.albumsFull = new ArrayList<>(albums); + this.albums = new ArrayList<>(albums); + notifyDataSetChanged(); + } + public void sort(String order) { if (albums == null) return; diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumCatalogueFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumCatalogueFragment.java index 4061cccd..2b04e7e6 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumCatalogueFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumCatalogueFragment.java @@ -3,6 +3,7 @@ package com.cappielloantonio.tempo.ui.fragment; import android.annotation.SuppressLint; import android.content.Context; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -35,6 +36,10 @@ import com.cappielloantonio.tempo.util.Constants; import com.cappielloantonio.tempo.util.Preferences; import com.cappielloantonio.tempo.viewmodel.AlbumCatalogueViewModel; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + @OptIn(markerClass = UnstableApi.class) public class AlbumCatalogueFragment extends Fragment implements ClickCallback { private static final String TAG = "AlbumCatalogueFragment"; @@ -45,15 +50,33 @@ public class AlbumCatalogueFragment extends Fragment implements ClickCallback { private AlbumCatalogueAdapter albumAdapter; private String currentSortOrder; + private List originalAlbums; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); + currentSortOrder = Preferences.getAlbumSortOrder(); initData(); } + @Override + public void onResume() { + super.onResume(); + String latestSort = Preferences.getAlbumSortOrder(); + + if (!latestSort.equals(currentSortOrder)) { + currentSortOrder = latestSort; + } + // Re-apply sort when returning to fragment + if (originalAlbums != null && currentSortOrder != null) { + applySortToAlbums(currentSortOrder); + } else { + Log.d(TAG, "onResume - Cannot re-sort, missing data"); + } + } + @Override public void onDestroy() { super.onDestroy(); @@ -118,8 +141,10 @@ public class AlbumCatalogueFragment extends Fragment implements ClickCallback { albumAdapter.setStateRestorationPolicy(RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY); bind.albumCatalogueRecyclerView.setAdapter(albumAdapter); albumCatalogueViewModel.getAlbumList().observe(getViewLifecycleOwner(), albums -> { - albumAdapter.setItems(albums); - applySavedSortOrder(); + originalAlbums = albums; + currentSortOrder = Preferences.getAlbumSortOrder(); + applySortToAlbums(currentSortOrder); + updateSortIndicator(); }); bind.albumCatalogueRecyclerView.setOnTouchListener((v, event) -> { @@ -130,6 +155,16 @@ public class AlbumCatalogueFragment extends Fragment implements ClickCallback { bind.albumListSortImageView.setOnClickListener(view -> showPopupMenu(view, R.menu.sort_album_popup_menu)); } + private void applySortToAlbums(String sortOrder) { + if (originalAlbums == null) { + return; + } + albumAdapter.setItemsWithoutFilter(originalAlbums); + if (sortOrder != null) { + albumAdapter.sort(sortOrder); + } + } + private void initProgressLoader() { albumCatalogueViewModel.getLoadingStatus().observe(getViewLifecycleOwner(), isLoading -> { if (isLoading) { @@ -142,13 +177,6 @@ public class AlbumCatalogueFragment extends Fragment implements ClickCallback { }); } - private void applySavedSortOrder() { - String savedSortOrder = Preferences.getAlbumSortOrder(); - currentSortOrder = savedSortOrder; - albumAdapter.sort(savedSortOrder); - updateSortIndicator(); - } - private void updateSortIndicator() { if (bind == null) return; @@ -235,8 +263,8 @@ public class AlbumCatalogueFragment extends Fragment implements ClickCallback { if (newSortOrder != null) { currentSortOrder = newSortOrder; - albumAdapter.sort(newSortOrder); Preferences.setAlbumSortOrder(newSortOrder); + applySortToAlbums(newSortOrder); updateSortIndicator(); return true; } diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java index a7f5d174..9bf95803 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/AlbumPageFragment.java @@ -248,6 +248,10 @@ public class AlbumPageFragment extends Fragment implements ClickCallback { bind.albumDetailView.setVisibility(View.GONE); } }); + + if(Preferences.showAlbumDetail()){ + bind.albumDetailView.setVisibility(View.VISIBLE); + } } private void initAlbumInfoTextButton() { diff --git a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt index cd7459e8..4815fb83 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt @@ -76,6 +76,7 @@ object Preferences { private const val EQUALIZER_ENABLED = "equalizer_enabled" private const val EQUALIZER_BAND_LEVELS = "equalizer_band_levels" private const val MINI_SHUFFLE_BUTTON_VISIBILITY = "mini_shuffle_button_visibility" + private const val ALBUM_DETAIL = "album_detail" private const val ALBUM_SORT_ORDER = "album_sort_order" private const val DEFAULT_ALBUM_SORT_ORDER = Constants.ALBUM_ORDER_BY_NAME @@ -641,6 +642,11 @@ object Preferences { return ShortArray(bandCount.toInt()) { i -> parts[i].toShortOrNull() ?: 0 } } + @JvmStatic + fun showAlbumDetail(): Boolean { + return App.getInstance().preferences.getBoolean(ALBUM_DETAIL, false) + } + @JvmStatic fun getAlbumSortOrder(): String { return App.getInstance().preferences.getString(ALBUM_SORT_ORDER, DEFAULT_ALBUM_SORT_ORDER) ?: DEFAULT_ALBUM_SORT_ORDER diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1878abd3..97064202 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -523,4 +523,7 @@ Not supported on this device Equalizer Open the built-in equalizer + + Show album detail + If enabled, show the album details like genre, song count etc. on the album page diff --git a/app/src/main/res/xml/global_preferences.xml b/app/src/main/res/xml/global_preferences.xml index ad15349d..4610e255 100644 --- a/app/src/main/res/xml/global_preferences.xml +++ b/app/src/main/res/xml/global_preferences.xml @@ -110,6 +110,12 @@ android:summary="@string/settings_music_directory_summary" android:key="music_directory_section_visibility" /> + +