Skip to content

Commit

Permalink
[nunu/#47] update : 파일구조화
Browse files Browse the repository at this point in the history
data(Model) / ui(View, ViewModel) / utils 구분
  • Loading branch information
Ssamssamukja committed Jun 24, 2024
1 parent 75287d1 commit 367930a
Show file tree
Hide file tree
Showing 54 changed files with 175 additions and 145 deletions.
12 changes: 6 additions & 6 deletions UMC_6th/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
android:theme="@style/Theme.UMC_6th"
tools:targetApi="31">
<service
android:name=".ForegroundService"
android:name=".utils.ForegroundService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaPlayback"></service>

<activity
android:name=".SplashActivity"
android:name=".ui.splash.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -34,16 +34,16 @@
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:name=".ui.main.MainActivity"
android:exported="true"></activity>
<activity
android:name=".SongActivity"
android:name=".ui.song.SongActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:label="@string/title_activity_song"
android:theme="@style/Theme.UMC_6th"></activity>
<activity android:name=".LoginActivity"/>
<activity android:name=".#Activity"/>
<activity android:name=".ui.login.LoginActivity"/>
<activity android:name=".ui.#.#Activity"/>
</application>

</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.entities


import androidx.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.entities

import androidx.room.Entity
import androidx.room.PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.entities

import androidx.room.Entity
import androidx.room.PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.entities

import androidx.room.Entity
import androidx.room.PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.umc_6th
package com.example.umc_6th.data.local

import androidx.room.*
import com.example.umc_6th.data.entities.Album
import com.example.umc_6th.data.entities.Like

@Dao
interface AlbumDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.example.umc_6th
package com.example.umc_6th.data.local

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.example.umc_6th.data.entities.Song

@Dao
interface SongDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.example.umc_6th
package com.example.umc_6th.data.local

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.umc_6th.data.entities.Album
import com.example.umc_6th.data.entities.Like
import com.example.umc_6th.data.entities.Song
import com.example.umc_6th.data.entities.User

@Database(entities = [Song::class, Album::class, User::class, Like::class], version = 1)
abstract class SongDatabase: RoomDatabase() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.example.umc_6th
package com.example.umc_6th.data.local

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.example.umc_6th.data.entities.User

@Dao
interface UserDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote

class ApiRepository {
companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.album

import retrofit2.Call
import retrofit2.http.GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.album

import com.google.gson.annotations.SerializedName

data class AlbumResponse( @SerializedName("isSuccess") val isSuccess: Boolean,
@SerializedName("code") val code: Int,
@SerializedName("message") val message: String,
@SerializedName("result") val result: TodayAlbumResult)
@SerializedName("result") val result: TodayAlbumResult
)


data class TodayAlbumResult(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.album

import android.util.Log
import com.example.umc_6th.ui.main.home.HomeAlbumView
import com.example.umc_6th.data.remote.auth.RetrofitInstance
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.auth

import com.example.umc_6th.data.entities.User
import com.example.umc_6th.data.remote.BaseResponse
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.POST
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.auth

import android.util.Log
import com.example.umc_6th.ui.login.LoginView
import com.example.umc_6th.ui.#.#View
import com.example.umc_6th.data.entities.User
import com.example.umc_6th.data.remote.BaseResponse
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.auth

import com.example.umc_6th.data.remote.album.AlbumApi
import com.example.umc_6th.data.remote.ApiRepository
import com.example.umc_6th.data.remote.song.SongApi
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.song

import retrofit2.Call
import retrofit2.http.GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.song

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.umc_6th
package com.example.umc_6th.data.remote.song

import android.util.Log
import com.example.umc_6th.ui.main.look.LookView
import com.example.umc_6th.data.remote.auth.RetrofitInstance
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.umc_6th.AlbumDetailFragment
import com.example.umc_6th.AlbumSongsFragment
import com.example.umc_6th.AlbumVideoFragment
import com.example.umc_6th.HomeFragment
import com.example.umc_6th.ui.main.album.AlbumDetailFragment
import com.example.umc_6th.ui.main.album.AlbumSongsFragment
import com.example.umc_6th.ui.main.album.AlbumVideoFragment
import com.example.umc_6th.ui.main.home.HomeFragment


class AlbumPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.umc_6th.Album
import com.example.umc_6th.data.entities.Album
import com.example.umc_6th.databinding.ItemAlbumBinding

class AlbumRecyclerAdapter(private val albumList: ArrayList<Album>) : RecyclerView.Adapter<AlbumRecyclerAdapter.ViewHolder>() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): AlbumRecyclerAdapter.ViewHolder {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
val binding: ItemAlbumBinding = ItemAlbumBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
return ViewHolder(binding)
}


override fun onBindViewHolder(holder: AlbumRecyclerAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(albumList[position])
holder.binding.imgItemAlbumCover.setOnClickListener {
itemClickListener?.onItemClick(albumList[position])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.umc_6th.FragmentHomeMainBanner
import com.example.umc_6th.FragmentHomeMainBanner2
import com.example.umc_6th.ui.main.home.FragmentHomeMainBanner
import com.example.umc_6th.ui.main.home.FragmentHomeMainBanner2

class HomePagerAdapter {
class HomeMainViewPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import android.annotation.SuppressLint
import android.util.SparseBooleanArray
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.umc_6th.R
import com.example.umc_6th.Song
import com.example.umc_6th.databinding.ItemLockerAlbumBinding
import com.example.umc_6th.data.entities.Song
import com.example.umc_6th.databinding.ItemLockerSongBinding

class LockerAlbumRecyclerAdapter() : RecyclerView.Adapter<LockerAlbumRecyclerAdapter.ViewHolder>() {
Expand All @@ -18,7 +16,7 @@ class LockerAlbumRecyclerAdapter() : RecyclerView.Adapter<LockerAlbumRecyclerAda
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): LockerAlbumRecyclerAdapter.ViewHolder {
): ViewHolder {
val binding: ItemLockerSongBinding = ItemLockerSongBinding
.inflate(LayoutInflater.from(parent.context), parent, false)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.umc_6th.LockerMusicFileFragment
import com.example.umc_6th.LockerSavedAlbumFragment
import com.example.umc_6th.LockerSavedSongFragment
import com.example.umc_6th.ui.main.locker.LockerMusicFileFragment
import com.example.umc_6th.ui.main.locker.LockerSavedAlbumFragment
import com.example.umc_6th.ui.main.locker.LockerSavedSongFragment

class LockerPagerAdapter (fragment : Fragment) : FragmentStateAdapter(fragment) {
override fun getItemCount(): Int = 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.umc_6th.Album
import com.example.umc_6th.data.entities.Album
import com.example.umc_6th.databinding.ItemLockerAlbumBinding

class LockerSavedAlbumRecyclerAdapter : RecyclerView.Adapter<LockerSavedAlbumRecyclerAdapter.ViewHolder>() {
Expand All @@ -20,13 +20,13 @@ class LockerSavedAlbumRecyclerAdapter : RecyclerView.Adapter<LockerSavedAlbumRec
mItemClickListener = itemClickListener
}

override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): LockerSavedAlbumRecyclerAdapter.ViewHolder {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
val binding: ItemLockerAlbumBinding = ItemLockerAlbumBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)

return ViewHolder(binding)
}

override fun onBindViewHolder(holder: LockerSavedAlbumRecyclerAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(albums[position])
holder.binding.imgItemLockerAlbumMore.setOnClickListener {
mItemClickListener.onRemoveSong(albums[position].id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.umc_6th.adapter
package com.example.umc_6th.ui.adapter

import android.content.Context
import android.util.Log
Expand All @@ -8,19 +8,19 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.example.umc_6th.FloChartResult
import com.example.umc_6th.data.remote.song.FloChartResult
import com.example.umc_6th.databinding.ItemSongBinding

class SongRecyclerViewAdapter (val context: Context, val result : FloChartResult) : RecyclerView.Adapter<SongRecyclerViewAdapter.ViewHolder>() {


override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): SongRecyclerViewAdapter.ViewHolder {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
val binding: ItemSongBinding = ItemSongBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)

return ViewHolder(binding)
}

override fun onBindViewHolder(holder: SongRecyclerViewAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
//holder.bind(result.songs[position])

if(result.songs[position].coverImgUrl == "" || result.songs[position].coverImgUrl == null){
Expand Down
Loading

0 comments on commit 367930a

Please # to comment.