Skip to content

Commit

Permalink
Merge branch '6/rough_ui' of https://github.com/hometerview/Android i…
Browse files Browse the repository at this point in the history
…nto develop

� Conflicts:
�	app/build.gradle
�	app/src/main/AndroidManifest.xml
�	app/src/main/java/com/ftw/hometerview/di/api/NetworkModule.kt
  • Loading branch information
likppi10 committed Aug 29, 2022
2 parents 66da2f2 + 4952707 commit 0fc84d3
Show file tree
Hide file tree
Showing 294 changed files with 11,610 additions and 112 deletions.
Binary file added .DS_Store
Binary file not shown.
15 changes: 11 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
Expand Down Expand Up @@ -47,9 +48,6 @@ dependencies {
implementation project(path: ':domain')
implementation project(path: ':data')
implementation project(path: ':design')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation "androidx.core:core-ktx:$core_ktx_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
Expand All @@ -60,6 +58,10 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinx_coroutines_android_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_core_version"

implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_runtime_ktx_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_runtime_ktx_version"


// Preferences DataStore (안드로이드 종속성 하위에서 사용할 때)
implementation "androidx.datastore:datastore-preferences:$datastore_preferences_version"

Expand All @@ -72,9 +74,12 @@ dependencies {
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"


implementation "com.tbuonomo:dotsindicator:$dotsindicator_version"
implementation "com.kakao.sdk:v2-user:$kakao_version"

implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_compiler_version"

debugImplementation "com.facebook.flipper:flipper:$flipper_version"
debugImplementation "com.facebook.soloader:soloader:$soloader_version"
debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipper_version"
Expand All @@ -87,6 +92,8 @@ dependencies {
androidTestImplementation "androidx.test.ext:junit:$android_junit_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$android_espresso_core_version"

//kakaomap
implementation files('libs/libDaumMapAndroid.jar')
}

kapt {
Expand Down
77 changes: 66 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
android:name=".config.HometerviewApplication"
Expand All @@ -13,33 +15,82 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Hometerview"
android:usesCleartextTraffic="true"
tools:targetApi="31"
>

<activity
android:name=".ui.splash.SplashActivity"
android:exported="true"
tools:ignore="Instantiatable">

</activity>

android:name=".ui.withdrawal.WithdrawalActivity"
android:exported="false"
/>
<activity
android:name=".ui.main.MainActivity"
android:name=".ui.manageaccount.ManageAccountActivity"
android:exported="false"
/>

<activity
android:name=".ui.login.LoginActivity"
android:exported="true">
android:name=".ui.myreviews.MyReviewsActivity"
android:exported="false"
/>
<activity
android:name=".ui.updatenickname.UpdateNicknameActivity"
android:exported="false"
/>
<activity
android:name=".ui.buildinglist.BuildingListActivity"
android:exported="false"
/>
<activity
android:name=".ui.searchaddressbuilding.SearchAddressBuildingActivity"
android:exported="false"
/>
<activity
android:name=".ui.loading.LoadingActivity"
android:exported="false"
/>
<activity
android:name=".ui.searchcompanynonresult.SearchCompanyNonResultActivity"
android:exported="false"
/>
<activity
android:name=".ui.searchcompanyresult.SearchCompanyResultActivity"
android:exported="false"
/>
<activity
android:name=".ui.searchcompany.SearchCompanyActivity"
android:exported="false"
/>
<activity
android:name=".ui.splash.SplashActivity"
android:exported="true"
tools:ignore="Instantiatable"
/>
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.login.LoginActivity"
android:exported="true"
/>
<activity
android:name=".ui.buildingreview.BuildingReviewActivity"
android:exported="true"
/>

<activity
android:name=".ui.review.CreateReviewActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
/>

<!-- kakao 로그인 창 -->
<activity
Expand All @@ -59,6 +110,10 @@
</intent-filter>
</activity>

<meta-data
android:name="com.kakao.sdk.AppKey"
android:value="@string/kakao_api_key"
/>
<!-- Flipper to diagnose integration issues and other problems -->
<activity
android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions app/src/main/java/com/ftw/hometerview/adapter/AnimationAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.ftw.hometerview.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.ftw.hometerview.R

class AnimationAdapter(var guideImgaeList: List<Int>, var guideTextList: List<String>) : RecyclerView.Adapter<AnimationAdapter.AnimationViewHolder>() {

inner class AnimationViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var imageViewIcon = itemView.findViewById<ImageView>(R.id.imageView_icon)
var guideText = itemView.findViewById<TextView>(R.id.guide_text)

fun onBind(res: Int, text: String) {
imageViewIcon.setImageResource(res)
guideText.text = text
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AnimationViewHolder {
var view = LayoutInflater.from(parent.context).inflate(R.layout.list_item_guide, parent, false)
return AnimationViewHolder(view)
}

override fun onBindViewHolder(holder: AnimationViewHolder, position: Int) {
holder.onBind(guideImgaeList[position], guideTextList[position])
}

override fun getItemCount(): Int = guideImgaeList.size

}
26 changes: 26 additions & 0 deletions app/src/main/java/com/ftw/hometerview/adapter/DiffCallback.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ftw.hometerview.adapter

import android.annotation.SuppressLint
import androidx.recyclerview.widget.DiffUtil

internal class DiffCallback : DiffUtil.ItemCallback<RecyclerItem>() {

override fun areItemsTheSame(
oldItem: RecyclerItem,
newItem: RecyclerItem
): Boolean {
val oldData = oldItem.data
val newData = newItem.data
return oldData == newData
}

@SuppressLint("DiffUtilEquals")
override fun areContentsTheSame(
oldItem: RecyclerItem,
newItem: RecyclerItem
): Boolean {
val oldData = oldItem.data
val newData = newItem.data
return oldData == newData
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.ftw.hometerview.adapter

import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Rect
import android.view.View
import androidx.annotation.ColorInt
import androidx.core.content.ContextCompat
import androidx.core.view.children
import androidx.recyclerview.widget.RecyclerView
import com.ftw.hometerview.R

class DividerItemDecoration(
context: Context,
@ColorInt private val colorResId: Int = com.ftw.hometerview.design.R.color.gray_200
) : RecyclerView.ItemDecoration() {

private val dividerHeight: Int = context.resources.getDimensionPixelSize(R.dimen.dp_size_1)
private val horizontalMargin: Int = context.resources.getDimensionPixelSize(R.dimen.dp_size_14)

private val paint = Paint().apply {
this.color = ContextCompat.getColor(context, colorResId)
}

override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
outRect.set(0, 0, 0, dividerHeight)
}

override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
c.save()
parent.children
.forEach { children ->
c.drawRect(
Rect(
children.left + horizontalMargin,
children.bottom + dividerHeight,
children.right - horizontalMargin,
children.bottom
),
paint
)
}
c.restore()
}
}
9 changes: 9 additions & 0 deletions app/src/main/java/com/ftw/hometerview/adapter/RecycleItem.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ftw.hometerview.adapter

import androidx.annotation.LayoutRes

data class RecyclerItem(
val data: Any,
@LayoutRes val layoutId: Int,
val variableId: Int
)
54 changes: 54 additions & 0 deletions app/src/main/java/com/ftw/hometerview/adapter/RecyclerAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.ftw.hometerview.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView

class DataBindingRecyclerAdapter : ListAdapter<RecyclerItem, BindingViewHolder>(
DiffCallback()
) {
override fun getItemViewType(position: Int): Int {
return getItem(position).layoutId
}

override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): BindingViewHolder {
val inflater = LayoutInflater.from(parent.context)
val binding: ViewDataBinding = DataBindingUtil.inflate(inflater, viewType, parent, false)
return BindingViewHolder(binding)
}

override fun onBindViewHolder(holder: BindingViewHolder, position: Int) {
holder.bind(getItem(position))
}
}

class BindingViewHolder(
private val binding: ViewDataBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(item: RecyclerItem) {
val isVariableFound = binding.setVariable(item.variableId, item.data)
if (isVariableFound.not()) {
throw IllegalStateException(
buildErrorMessage(item.variableId, binding)
)
}
if (binding.hasPendingBindings()) {
binding.executePendingBindings()
}
}
}

private fun buildErrorMessage(
variableId: Int,
binding: ViewDataBinding
): String {
val variableName = DataBindingUtil.convertBrIdToString(variableId)
val className = binding::class.simpleName
return "Failed to find variable='$variableName' in the following databinding layout: $className"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ftw.hometerview.adapter

import android.content.Context
import android.graphics.Rect
import android.view.View
import androidx.annotation.DimenRes
import androidx.recyclerview.widget.RecyclerView
import com.ftw.hometerview.R

class SpacingItemDecoration(
context: Context,
@DimenRes private val spacingResId: Int = R.dimen.dp_size_16
) : RecyclerView.ItemDecoration() {

private val dividerHeight: Int = context.resources.getDimensionPixelSize(spacingResId)

override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
outRect.set(0, 0, 0, dividerHeight)

if (parent.getChildAdapterPosition(view) == 0) {
outRect.top = dividerHeight
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.ftw.hometerview.bindingadapter

import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.RecyclerView
import com.ftw.hometerview.adapter.DataBindingRecyclerAdapter
import com.ftw.hometerview.adapter.RecyclerItem

@BindingAdapter("items")
fun setRecyclerViewItems(
recyclerView: RecyclerView,
items: List<RecyclerItem>?
) {
var adapter = (recyclerView.adapter as? DataBindingRecyclerAdapter)
if (adapter == null) {
adapter = DataBindingRecyclerAdapter()
recyclerView.adapter = adapter
}

adapter.submitList(
items.orEmpty()
)
}
Loading

0 comments on commit 0fc84d3

Please sign in to comment.