Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed Jan 3, 2020
1 parent d7ba81c commit bdefd26
Show file tree
Hide file tree
Showing 64 changed files with 384 additions and 104 deletions.
6 changes: 6 additions & 0 deletions .idea/render.experimental.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.fundito.fundito.common
import android.graphics.drawable.Drawable
import android.view.View
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.core.view.isVisible
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
Expand All @@ -26,6 +27,10 @@ fun ImageView.loadUrlAsync(url : String?, placeholder : Drawable? = null) {
.into(this)
}
}
@BindingAdapter("srcResId")
fun ImageView.loadResId(@DrawableRes id: Int) {
Glide.with(this).load(id).into(this)
}

@BindingAdapter("android:visibility")
fun View.setVisibilityBinding(isVisible : Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class NotificationUtil @Inject constructor(private val context: Context) {
val noti = NotificationCompat.Builder(context, NOTI_CHANNEL_ID)
.setContentTitle("Fundito")
.setContentText(message)
.setSmallIcon(R.drawable.logo_img)
.setSmallIcon(R.drawable.small_logo)
.setPriority(Notification.PRIORITY_MAX)
.setAutoCancel(true)
.setContentIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import kotlin.math.roundToInt
*/
class LinearItemDecoration(private val spaceDp : Int) : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
val idx = parent.indexOfChild(view)
val idx = parent.getChildLayoutPosition(view)
if(idx != 0)
outRect.top = spaceDp.toPixel().roundToInt()
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/fundito/fundito/data/model/Store.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data class Store(
val thumbnail : String?,
@SerializedName("menu")
val menus : List<Menu>,
@SerializedName("goal_money")
@SerializedName("goal_sales")
val goalMoney : Int,
@SerializedName("current_goal_percent")
val currentGoalPercent : Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import retrofit2.http.*
import kotlin.math.roundToInt


/**
Expand Down Expand Up @@ -65,8 +66,13 @@ data class CurrentFundingResponse(
val remainingDays: Int,
@SerializedName("progressPercent")
@Expose(serialize = true, deserialize = true)
val progressPercentFromServer: Double


) : Parcelable {
val progressPercent: Int
) : Parcelable
get() = progressPercentFromServer.roundToInt()
}

@SuppressLint("ParcelCreator")
@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FundingViewModel @Inject constructor(
Timber.e("send charge")
}catch(t: Throwable) {
_chargeFail.value = Once(Unit)
return@runCatching
throw RuntimeException()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.fundito.fundito.presentation.login

import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.children
import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.widget.ViewPager2
import com.facebook.AccessToken
import com.facebook.CallbackManager
import com.facebook.FacebookCallback
Expand Down Expand Up @@ -39,6 +42,27 @@ class LoginActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)

window.statusBarColor = Color.parseColor("#f9f8f8")

pager.apply {
adapter = LoginGuidePagerAdapter().apply {
submitItems(listOf(
Triple("먹어보고","내 입맛에 맞는지 직접 판단하세요.",R.drawable.guide1),
Triple("펀딩하고","가게가 목표매출에 도달할 수\n있도록 자유롭게 홍보하세요.",R.drawable.guide3),
Triple("돌려받자 !","초기 투자로 최대 200%까지\n돌려 받으세요.",R.drawable.guide2)
))
}

registerOnPageChangeCallback(object :ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
for(v in pageIndicatorContainer.children) {
v.isActivated = false
}
pageIndicatorContainer.getChildAt(position).isActivated = true
}
})
}

facebookLoginButton.apply {

setPermissions("public_profile","email")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.fundito.fundito.presentation.login

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.DrawableRes
import androidx.databinding.library.baseAdapters.BR
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.fundito.fundito.databinding.ItemLoginGuideBinding

/**
* Created by mj on 03, January, 2020
*/
class LoginGuidePagerAdapter : ListAdapter<Triple<String, String, @DrawableRes Int>, LoginGuidePagerAdapter.LoginGuidePagerHolder>(DIFF) {

companion object {
private val DIFF = object : DiffUtil.ItemCallback<Triple<String,String,@androidx.annotation.DrawableRes Int>>() {
override fun areItemsTheSame(oldItem: Triple<String,String, Int>, newItem: Triple<String,String, Int>): Boolean {
return oldItem == newItem
}

override fun areContentsTheSame(oldItem: Triple<String,String, Int>, newItem: Triple<String,String, Int>): Boolean {
return oldItem == newItem
}
}
}

fun submitItems(items : List<Triple<String,String, Int>>) {
submitList(items)
}


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LoginGuidePagerHolder {
val inflater = LayoutInflater.from(parent.context)
val binding = ItemLoginGuideBinding.inflate(inflater, parent, false)

return LoginGuidePagerHolder(binding)
}


override fun onBindViewHolder(holder: LoginGuidePagerHolder, position: Int) = holder.bind(getItem(position))


inner class LoginGuidePagerHolder(private val binding: ItemLoginGuideBinding) : RecyclerView.ViewHolder(binding.root) {
fun bind(item: Triple<String,String, Int>) {
binding.setVariable(BR.info1, item.first)
binding.setVariable(BR.info2, item.second)
binding.setVariable(BR.image, item.third)
binding.executePendingBindings()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class FeedFriendDetailActivity : DaggerAppCompatActivity(), HasDefaultViewModelP

items.observe(this@FeedFriendDetailActivity) {
(mBinding.recyclerView.adapter as? FundingOnGoingAdapter)?.submitItems(
it.proceeding.map { CurrentFundingResponse(-1, it.storeName, it.remainingDays, it.progressPercent) }
+ it.fail.map { CurrentFundingResponse(-1, it.storeName, -1, -1) }
it.proceeding.map { CurrentFundingResponse(-1, it.storeName, it.remainingDays, it.progressPercent.toDouble()) }
+ it.fail.map { CurrentFundingResponse(-1, it.storeName, -1, -1.0) }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class FeedFriendListFragment : Fragment() {
MainActivity.menu.observe(viewLifecycleOwner) {
if (MainActivity.menu.value == MainActivity.MainMenu.FEED) {
requireActivity().window.statusBarColor = Color.parseColor("#f6f5f5")
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class HomeFragment : DaggerFragment(), HasDefaultViewModelProviderFactory {
MainActivity.menu.observe(viewLifecycleOwner) {
if(MainActivity.menu.value == MainActivity.MainMenu.HOME) {
requireActivity().window.statusBarColor = Color.parseColor("#f6f5f5")
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
}
Expand Down Expand Up @@ -145,7 +146,7 @@ class HomeFragment : DaggerFragment(), HasDefaultViewModelProviderFactory {
}
Timber.e(ssid)
// mViewModel.onWifiStateChanged(ssid)
mViewModel.onWifiStateChanged("234")
mViewModel.onWifiStateChanged("roro11")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.fundito.fundito.data.service.WifiStoreResponse
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

/**
Expand Down Expand Up @@ -61,7 +60,6 @@ class HomeViewModel @Inject constructor() : ViewModel() {
init {
viewModelScope.launch {
Broadcast.fundEvent.openSubscription().consumeEach {
Timber.e("밤ㄴ이ㅓㅁ")
if(it.first == connectedStoreData.value?.storeIdx) {
kotlin.runCatching {
NetworkClient.storeInfoService.listStoreFundingTimeLine(it.first)[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fundito.fundito.presentation.main.more

import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -8,7 +9,12 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.observe
import com.fundito.fundito.R
import com.fundito.fundito.common.util.AuthUtil
import com.fundito.fundito.common.util.startActivity
import com.fundito.fundito.common.widget.setOnDebounceClickListener
import com.fundito.fundito.presentation.main.MainActivity
import com.fundito.fundito.presentation.splash.SplashActivity
import kotlinx.android.synthetic.main.fragment_more.*

/**
* Created by mj on 26, December, 2019
Expand All @@ -25,12 +31,18 @@ class MoreFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
adjustSystemUI()

logoutButton setOnDebounceClickListener {
AuthUtil.logout()
startActivity(SplashActivity::class, Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
}
}
private fun adjustSystemUI() {

MainActivity.menu.observe(viewLifecycleOwner) {
if(MainActivity.menu.value == MainActivity.MainMenu.MORE) {
requireActivity().window.statusBarColor = Color.WHITE
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class FundingOnGoingAdapter(private val onItemClick : (CurrentFundingResponse) -
binding.executePendingBindings()
binding.name.text = item.storeName

if(item.remainingDays == -1 && item.progressPercent == -1) {
if(item.remainingDays < 0 && item.progressPercent < 0) {
binding.root.alpha = 0.5f
binding.remainDay.text = "마감"
binding.progress.text = "목표 실패"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ class StatusFragment : DaggerFragment(), HasDefaultViewModelProviderFactory {
private fun adjustSystemUIs() {

if(mViewModel.sceneIndex.value == 1 && MainActivity.menu.value == MainActivity.MainMenu.STATUS) {
requireActivity().window.statusBarColor = resources.getColor(R.color.blueberry_two)
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
requireActivity().window.statusBarColor = resources.getColor(R.color.gray_white)
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}else if(MainActivity.menu.value == MainActivity.MainMenu.STATUS){
requireActivity().window.statusBarColor = Color.WHITE
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ class StatusViewModel @Inject constructor() : ViewModel() {
kotlin.runCatching {
NetworkClient.fundingService.listCurrentFundingStore()
}.onSuccess {
Timber.e("ASDSAD : $it")
_currentFundingStores.value = it
}.onFailure {
Timber.e(it)
}
_loading.value = false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.fundito.fundito.presentation.splash

import android.animation.ValueAnimator
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.animation.doOnEnd
import androidx.lifecycle.lifecycleScope
import com.facebook.AccessToken
import com.fundito.fundito.R
Expand All @@ -13,6 +15,7 @@ import com.fundito.fundito.data.service.NetworkClient
import com.fundito.fundito.presentation.login.LoginActivity
import com.fundito.fundito.presentation.main.MainActivity
import com.google.firebase.iid.FirebaseInstanceId
import kotlinx.android.synthetic.main.activity_splash.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import timber.log.Timber
Expand All @@ -24,6 +27,8 @@ import kotlin.coroutines.resume
*/
class SplashActivity : AppCompatActivity() {

private var animator: ValueAnimator? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
Expand All @@ -32,6 +37,28 @@ class SplashActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()

animator = ValueAnimator.ofFloat(0.3f,1f).apply {
duration = 1500L
addUpdateListener {
val value = it.animatedValue as Float

splash_symbol.alpha = value
splash_symbol.scaleX = value
splash_symbol.scaleY = value
}
doOnEnd {
boot()
}
start()
}
}

override fun onPause() {
super.onPause()
animator?.cancel()
}

private fun boot() {
val accessToken = AccessToken.getCurrentAccessToken()
val isLoggedIn = accessToken != null && !accessToken.isExpired

Expand Down Expand Up @@ -59,14 +86,12 @@ class SplashActivity : AppCompatActivity() {
AuthUtil.logout()
startActivity(LoginActivity::class, Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
}
overridePendingTransition(0,0)
}

}else {
startActivity(LoginActivity::class, Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
overridePendingTransition(0,0)
}




}
}
Loading

0 comments on commit bdefd26

Please sign in to comment.