Skip to content

Commit

Permalink
🚚 change package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ii2001 authored and ii2001 committed Jul 24, 2024
1 parent 478c4d2 commit cab3253
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 44 deletions.
6 changes: 5 additions & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ android {
val properties = Properties()
properties.load(FileInputStream(rootProject.file("local.properties")))

buildConfigField("String", "GOOGLE_WEB_CLIENT_ID", properties.getProperty("google_web_client_id"))
buildConfigField(
"String",
"GOOGLE_WEB_CLIENT_ID",
properties.getProperty("google_web_client_id"),
)
}

buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:theme="@style/Theme.Pengcook"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".presentation.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.pengcook.android.data
package net.pengcook.android.data.datasource

import androidx.paging.PagingSource
import androidx.paging.PagingState
import net.pengcook.android.model.Feed
import net.pengcook.android.presentation.core.model.Feed

class FeedPagingSource(
private val initialPageNumber: Int = 0,
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.pengcook.android.data.repository

import net.pengcook.android.model.Feed
import net.pengcook.android.presentation.core.model.Feed

class DummyFeedsRepository {
suspend fun fetchFeeds(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package net.pengcook.android
package net.pengcook.android.presentation

import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import net.pengcook.android.R

@BindingAdapter("app:imageUrl")
fun loadImage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package net.pengcook.android
package net.pengcook.android.presentation

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.NavigationUI
import net.pengcook.android.R

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.presentation.uimodel
package net.pengcook.android.presentation.core.model

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.model
package net.pengcook.android.presentation.core.model

data class Feed(
val id: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.presentation.uimodel
package net.pengcook.android.presentation.core.model

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.presentation.uimodel
package net.pengcook.android.presentation.core.model

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package net.pengcook.android.home
package net.pengcook.android.presentation.home

import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import androidx.paging.PagingDataAdapter
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import net.pengcook.android.databinding.ItemFeedBinding
import net.pengcook.android.listner.FeedItemEventListener
import net.pengcook.android.model.Feed
import net.pengcook.android.presentation.core.model.Feed
import net.pengcook.android.presentation.home.listener.FeedItemEventListener

class FeedRecyclerViewAdapter(private val eventListener: FeedItemEventListener) :
PagingDataAdapter<Feed, FeedRecyclerViewAdapter.ViewHolder>(diffCallback) {
Expand Down Expand Up @@ -59,11 +56,3 @@ class FeedRecyclerViewAdapter(private val eventListener: FeedItemEventListener)
}
}
}

@BindingAdapter("app:image")
fun ImageView.image(url: String?) {
if (url == null) return
Glide.with(this.context)
.load(url)
.into(this)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.home
package net.pengcook.android.presentation.home

import android.os.Bundle
import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.pengcook.android.home
package net.pengcook.android.presentation.home

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
Expand All @@ -8,10 +8,10 @@ import androidx.paging.PagingConfig
import androidx.paging.PagingData
import androidx.paging.cachedIn
import androidx.paging.liveData
import net.pengcook.android.data.FeedPagingSource
import net.pengcook.android.data.datasource.FeedPagingSource
import net.pengcook.android.data.repository.DummyFeedsRepository
import net.pengcook.android.listner.FeedItemEventListener
import net.pengcook.android.model.Feed
import net.pengcook.android.presentation.core.model.Feed
import net.pengcook.android.presentation.home.listener.FeedItemEventListener

class HomeViewModel : ViewModel(), FeedItemEventListener {
private val dummyFeedsRepository = DummyFeedsRepository()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.pengcook.android.presentation.home.listener

import net.pengcook.android.presentation.core.model.Feed

interface FeedItemEventListener {
fun onNavigateToDetail(feedInfo: Feed)
}
2 changes: 1 addition & 1 deletion android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
tools:context=".MainActivity">
tools:context=".presentation.MainActivity">


<androidx.fragment.app.FragmentContainerView
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

<variable
name="viewModel"
type="net.pengcook.android.home.HomeViewModel" />
type="net.pengcook.android.presentation.home.HomeViewModel" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/homeFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/white"
tools:context=".MainActivity">
tools:context=".presentation.MainActivity">

<!-- Logo and Recipe Input -->
<ImageView
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/res/layout/item_feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<variable
name="feed"
type="net.pengcook.android.model.Feed" />
type="net.pengcook.android.presentation.core.model.Feed" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
Expand All @@ -23,7 +23,7 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
app:image="@{feed.profileImageUrl}"
app:imageUrl="@{feed.profileImageUrl}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_launcher_foreground" />
Expand All @@ -47,7 +47,7 @@
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:image="@{feed.recipeImageUrl}"
app:imageUrl="@{feed.recipeImageUrl}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_image" />
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<fragment
android:id="@+id/homeFragment"
android:name="net.pengcook.android.home.HomeFragment"
android:name="net.pengcook.android.presentation.home.HomeFragment"
android:label="fragment_home"
tools:layout="@layout/fragment_home" />

Expand Down

0 comments on commit cab3253

Please sign in to comment.