Skip to content

Commit

Permalink
<Merge> ui-sources-hierarchy -> dev
Browse files Browse the repository at this point in the history
  • Loading branch information
chr56 committed Nov 6, 2024
2 parents 83dcb09 + d9c8f4a commit fc490a6
Show file tree
Hide file tree
Showing 75 changed files with 223 additions and 209 deletions.
25 changes: 15 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<!-- Activities -->
<!-- -->
<activity
android:name=".ui.activities.MainActivity"
android:name=".ui.modules.main.MainActivity"
android:exported="true" />
<activity
android:name=".ui.activities.LauncherActivity"
android:name=".ui.modules.auxiliary.LauncherActivity"
android:noHistory="true"
android:exported="true">
<intent-filter>
Expand All @@ -52,7 +52,7 @@
</intent-filter>
</activity>
<activity
android:name=".ui.activities.StarterActivity"
android:name=".ui.modules.auxiliary.StarterActivity"
android:excludeFromRecents="true"
android:exported="true"
android:label="@string/action_play"
Expand Down Expand Up @@ -121,14 +121,18 @@
</intent-filter>
</activity>
<activity
android:name=".ui.activities.PhonographIntroActivity"
android:name=".ui.modules.auxiliary.PhonographIntroActivity"
android:label="@string/intro_label"
android:theme="@style/Theme.AppIntro"
android:exported="true"/>
<activity android:name=".ui.activities.AlbumDetailActivity" />
<activity android:name=".ui.activities.ArtistDetailActivity" />
<activity android:name=".ui.activities.GenreDetailActivity" />
<activity android:name=".ui.modules.playlist.PlaylistDetailActivity" />
<activity android:name=".ui.modules.album.AlbumDetailActivity"
android:label="@string/album" />
<activity android:name=".ui.modules.artist.ArtistDetailActivity"
android:label="@string/artist" />
<activity android:name=".ui.modules.genre.GenreDetailActivity"
android:label="@string/genre" />
<activity android:name=".ui.modules.playlist.PlaylistDetailActivity"
android:label="@string/playlists" />
<activity
android:name="player.phonograph.ui.modules.playlist.dialogs.AddToPlaylistDialogActivity"
android:excludeFromRecents="true"
Expand Down Expand Up @@ -183,10 +187,11 @@
android:exported="true"
android:label="@string/action_settings" />
<activity
android:name=".ui.activities.AboutActivity"
android:name=".ui.modules.auxiliary.AboutActivity"
android:label="@string/action_about" />
<activity
android:name=".ui.activities.CrashActivity"
android:name=".ui.modules.auxiliary.CrashActivity"
android:label="@string/crash"
android:exported="true"
android:launchMode="singleInstance"
android:process="player.phonograph.crash" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/player/phonograph/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import player.phonograph.coil.createPhonographImageLoader
import player.phonograph.notification.ErrorNotification
import player.phonograph.notification.ErrorNotification.KEY_STACK_TRACE
import player.phonograph.service.queue.QueueManager
import player.phonograph.ui.activities.CrashActivity
import player.phonograph.ui.moduleViewModels
import player.phonograph.ui.modules.auxiliary.CrashActivity
import player.phonograph.util.debug
import player.phonograph.util.logMetrics
import player.phonograph.util.postDelayedOnceHandlerCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.content.Context
import android.content.Intent
import android.content.pm.ShortcutInfo
import android.os.Build
import player.phonograph.ui.activities.StarterActivity
import player.phonograph.ui.modules.auxiliary.StarterActivity
import android.os.Bundle

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.content.pm.ShortcutInfo
import android.os.Build
import player.phonograph.R
import player.phonograph.appshortcuts.AppShortcutIconGenerator
import player.phonograph.ui.activities.StarterActivity
import player.phonograph.ui.modules.auxiliary.StarterActivity

/**
* @author Adrian Campos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.content.pm.ShortcutInfo
import android.os.Build
import player.phonograph.R
import player.phonograph.appshortcuts.AppShortcutIconGenerator
import player.phonograph.ui.activities.StarterActivity
import player.phonograph.ui.modules.auxiliary.StarterActivity

/**
* @author Adrian Campos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.content.pm.ShortcutInfo
import android.os.Build
import player.phonograph.R
import player.phonograph.appshortcuts.AppShortcutIconGenerator
import player.phonograph.ui.activities.StarterActivity
import player.phonograph.ui.modules.auxiliary.StarterActivity

/**
* @author Adrian Campos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import player.phonograph.model.Song
import player.phonograph.model.infoString
import player.phonograph.service.MusicService
import player.phonograph.service.queue.QueueManager
import player.phonograph.ui.activities.LauncherActivity
import player.phonograph.ui.modules.auxiliary.LauncherActivity
import player.phonograph.util.theme.getTintedDrawable
import player.phonograph.util.ui.BitmapUtil
import util.theme.color.primaryTextColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import player.phonograph.mechanism.setting.HomeTabConfig.PageConfigUtil.toJson
import player.phonograph.model.pages.Pages
import player.phonograph.settings.Keys
import player.phonograph.settings.Setting
import player.phonograph.ui.fragments.pages.AbsPage
import player.phonograph.ui.fragments.pages.AlbumPage
import player.phonograph.ui.fragments.pages.ArtistPage
import player.phonograph.ui.fragments.pages.EmptyPage
import player.phonograph.ui.fragments.pages.FilesPage
import player.phonograph.ui.fragments.pages.FlattenFolderPage
import player.phonograph.ui.fragments.pages.GenrePage
import player.phonograph.ui.fragments.pages.PlaylistPage
import player.phonograph.ui.fragments.pages.SongPage
import player.phonograph.ui.modules.main.pages.AbsPage
import player.phonograph.ui.modules.main.pages.AlbumPage
import player.phonograph.ui.modules.main.pages.ArtistPage
import player.phonograph.ui.modules.main.pages.EmptyPage
import player.phonograph.ui.modules.main.pages.FilesPage
import player.phonograph.ui.modules.main.pages.FlattenFolderPage
import player.phonograph.ui.modules.main.pages.GenrePage
import player.phonograph.ui.modules.main.pages.PlaylistPage
import player.phonograph.ui.modules.main.pages.SongPage
import player.phonograph.util.reportError
import android.util.Log
import kotlinx.serialization.encodeToString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@

package player.phonograph.notification

import player.phonograph.R
import player.phonograph.model.version.ReleaseChannel
import player.phonograph.model.version.Version
import player.phonograph.model.version.VersionCatalog
import player.phonograph.ui.modules.main.MainActivity
import androidx.core.app.NotificationCompat
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.text.Html
import android.text.Spanned
import androidx.core.app.NotificationCompat
import player.phonograph.R
import player.phonograph.UPGRADABLE
import player.phonograph.VERSION_INFO
import player.phonograph.model.version.ReleaseChannel
import player.phonograph.model.version.Version
import player.phonograph.model.version.VersionCatalog
import player.phonograph.ui.activities.MainActivity
import java.util.*

class UpgradeNotificationImpl(context: Context) : AbsNotificationImpl() {
Expand All @@ -30,11 +28,9 @@ class UpgradeNotificationImpl(context: Context) : AbsNotificationImpl() {
fun sendUpgradeNotification(context: Context, versionCatalog: VersionCatalog, channel: ReleaseChannel) {
execute(context) {
val version = versionCatalog.versions.filter { it.channel == channel.determiner }.maxByOrNull { it.versionCode } ?: return
val action = Intent(context, MainActivity::class.java).apply {
this.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
this.putExtra(UPGRADABLE, true)
this.putExtra(VERSION_INFO, versionCatalog)
}
val action =
MainActivity.launchingIntent(context, versionCatalog, Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)

val clickIntent: PendingIntent =
PendingIntent.getActivity(context, 0, action, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import player.phonograph.service.player.PlayerState.STOPPED
import player.phonograph.settings.Keys
import player.phonograph.settings.PrimitiveKey
import player.phonograph.settings.Setting
import player.phonograph.ui.activities.MainActivity
import player.phonograph.ui.modules.main.MainActivity
import player.phonograph.util.permissions.checkNotificationPermission
import player.phonograph.util.theme.createTintedDrawable
import player.phonograph.util.ui.BitmapUtil
Expand Down Expand Up @@ -565,9 +565,7 @@ class PlayingNotificationManager : ServiceComponent {
get() = PendingIntent.getActivity(
service,
0,
Intent(service, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
},
MainActivity.launchingIntent(service, Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP),
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_CANCEL_CURRENT
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright (c) 2022~2023 chr_56
* Copyright (c) 2022~2024 chr_56
*/

package player.phonograph.ui

import org.koin.core.module.dsl.viewModel
import org.koin.dsl.module
import player.phonograph.ui.activities.AlbumDetailActivityViewModel
import player.phonograph.ui.activities.ArtistDetailActivityViewModel
import player.phonograph.ui.activities.base.PanelViewModel
import player.phonograph.ui.modules.album.AlbumDetailActivityViewModel
import player.phonograph.ui.modules.artist.ArtistDetailActivityViewModel
import player.phonograph.ui.modules.panel.PanelViewModel
import player.phonograph.ui.modules.playlist.PlaylistDetailViewModel

val moduleViewModels = module {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package player.phonograph.ui.components.popup

import player.phonograph.R
import player.phonograph.databinding.PopupWindowMainBinding
import player.phonograph.model.sort.SortRef
import player.phonograph.model.ItemLayoutStyle
import player.phonograph.ui.fragments.pages.PageDisplayConfig
import player.phonograph.model.sort.SortRef
import player.phonograph.ui.modules.main.pages.PageDisplayConfig
import player.phonograph.util.ui.isLandscape
import androidx.annotation.IdRes
import androidx.core.view.forEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import player.phonograph.model.lyrics.TextLyrics
import player.phonograph.service.MusicPlayerRemote
import player.phonograph.settings.Keys
import player.phonograph.settings.Setting
import player.phonograph.ui.fragments.player.LyricsViewModel
import player.phonograph.ui.modules.player.LyricsViewModel
import player.phonograph.util.reportError
import player.phonograph.util.text.lyricsTimestamp
import player.phonograph.util.theme.getTintedDrawable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import player.phonograph.model.Song
import player.phonograph.model.SongClickMode
import player.phonograph.service.queue.QueueManager
import player.phonograph.service.queue.executePlayRequest
import player.phonograph.ui.activities.MainActivity
import player.phonograph.ui.modules.main.MainActivity
import player.phonograph.ui.compose.ComposeViewDialogFragment
import player.phonograph.ui.compose.PhonographTheme
import player.phonograph.ui.compose.components.ModeRadioBox
Expand Down Expand Up @@ -121,9 +121,7 @@ class OpenWithDialog : ComposeViewDialogFragment() {
super.onDestroy()
if (gotoMainActivity && confirmed) {
startActivity(
Intent(requireContext(), MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
MainActivity.launchingIntent(requireContext(), Intent.FLAG_ACTIVITY_NEW_TASK)
)
}
requireActivity().finish()
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/player/phonograph/ui/modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ This is the composite package for the "independent" modules about user interface

_List of modules:_

- `album`: Album Detail
- `artist`: Artist Detail
- `explorer`: File Explorer
- `genre`: Genre Detail
- `main`: Main Activity
- `panel`: Sliding Panel
- `player`: Player UI
- `playlist`: Playlist Detail
- `search`: Local Search
- `setting`: Phonograph Plus Settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package player.phonograph.ui.activities
package player.phonograph.ui.modules.album

import lib.activityresultcontract.registerActivityResultLauncherDelegate
import lib.phonograph.misc.menuProvider
Expand All @@ -21,8 +21,8 @@ import player.phonograph.model.getYearString
import player.phonograph.model.songCountString
import player.phonograph.model.totalDuration
import player.phonograph.repo.loader.Songs
import player.phonograph.ui.activities.base.AbsSlidingMusicPanelActivity
import player.phonograph.ui.fragments.pages.adapter.SongDisplayAdapter
import player.phonograph.ui.modules.main.pages.adapter.SongDisplayAdapter
import player.phonograph.ui.modules.panel.AbsSlidingMusicPanelActivity
import player.phonograph.util.NavigationUtil.goToArtist
import player.phonograph.util.theme.getTintedDrawable
import player.phonograph.util.theme.primaryColor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2022 chr_56 & Abou Zeid (kabouzeid) (original author)
* Copyright (c) 2022-2024 chr_56 & Abou Zeid (kabouzeid) (original author)
*/

package player.phonograph.ui.activities
package player.phonograph.ui.modules.album

import player.phonograph.R
import player.phonograph.coil.loadImage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2022~2023 chr_56
* Copyright (c) 2022~2024 chr_56
*/

package player.phonograph.ui.activities
package player.phonograph.ui.modules.album

import player.phonograph.mechanism.actions.ClickActionProviders
import player.phonograph.model.ItemLayoutStyle
Expand All @@ -11,7 +11,7 @@ import player.phonograph.model.buildInfoString
import player.phonograph.model.getReadableDurationString
import player.phonograph.ui.adapter.ConstDisplayConfig
import player.phonograph.ui.adapter.DisplayConfig.Companion.IMAGE_TYPE_TEXT
import player.phonograph.ui.fragments.pages.adapter.SongDisplayAdapter
import player.phonograph.ui.modules.main.pages.adapter.SongDisplayAdapter
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package player.phonograph.ui.activities
package player.phonograph.ui.modules.artist

import com.github.chr56.android.menu_dsl.attach
import com.github.chr56.android.menu_dsl.menuItem
Expand All @@ -24,9 +24,9 @@ import player.phonograph.model.getReadableDurationString
import player.phonograph.model.songCountString
import player.phonograph.model.totalDuration
import player.phonograph.repo.loader.Songs
import player.phonograph.ui.activities.base.AbsSlidingMusicPanelActivity
import player.phonograph.ui.adapter.ConstDisplayConfig
import player.phonograph.ui.fragments.pages.adapter.SongDisplayAdapter
import player.phonograph.ui.modules.main.pages.adapter.SongDisplayAdapter
import player.phonograph.ui.modules.panel.AbsSlidingMusicPanelActivity
import player.phonograph.util.GetContentDelegate
import player.phonograph.util.IGetContentRequester
import player.phonograph.util.theme.getTintedDrawable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2022 chr_56 & Abou Zeid (kabouzeid) (original author)
* Copyright (c) 2022~2024 chr_56
*/

package player.phonograph.ui.activities
package player.phonograph.ui.modules.artist

import player.phonograph.App
import player.phonograph.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2022~2023 chr_56
* Copyright (c) 2022~2024 chr_56
*/

package player.phonograph.ui.activities
package player.phonograph.ui.modules.artist

import player.phonograph.R
import player.phonograph.mechanism.actions.ClickActionProviders
Expand All @@ -12,7 +12,7 @@ import player.phonograph.model.buildInfoString
import player.phonograph.model.getYearString
import player.phonograph.model.songCountString
import player.phonograph.ui.adapter.ConstDisplayConfig
import player.phonograph.ui.fragments.pages.adapter.AlbumDisplayAdapter
import player.phonograph.ui.modules.main.pages.adapter.AlbumDisplayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.cardview.widget.CardView
import android.content.res.Resources
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package player.phonograph.ui.activities
package player.phonograph.ui.modules.auxiliary

import de.psdev.licensesdialog.LicensesDialog
import lib.phonograph.activity.ToolbarActivity
Expand Down
Loading

0 comments on commit fc490a6

Please sign in to comment.