-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Team-Going/Going-Android …
…into feat/#89-my-todo-finish
- Loading branch information
Showing
28 changed files
with
295 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...on/dashboard/triplist/CompletedAdapter.kt → ...rd/triplist/completed/CompletedAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dashboard/triplist/CompletedViewHolder.kt → ...triplist/completed/CompletedViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tion/dashboard/triplist/OngoingAdapter.kt → ...hboard/triplist/ongoing/OngoingAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/dashboard/triplist/OngoingViewHolder.kt → ...ard/triplist/ongoing/OngoingViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
presentation/src/main/java/com/going/presentation/enter/FinishPreferenceActivity.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...n/src/main/java/com/going/presentation/preferencetag/entertrip/EnterPreferenceActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package com.going.presentation.preferencetag.entertrip | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import androidx.core.content.ContextCompat | ||
import com.going.domain.entity.PreferenceData | ||
import com.going.presentation.R | ||
import com.going.presentation.databinding.ActivityEnterPreferenceBinding | ||
import com.going.presentation.preferencetag.PreferenceTagAdapter | ||
import com.going.presentation.preferencetag.PreferenceTagDecoration | ||
import com.going.presentation.preferencetag.PreferenceTagViewModel | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.END_DAY | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.END_MONTH | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.END_YEAR | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.NAME | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.START_DAY | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.START_MONTH | ||
import com.going.presentation.starttrip.createtrip.CreateTripActivity.Companion.START_YEAR | ||
import com.going.ui.base.BaseActivity | ||
import com.going.ui.extension.setOnSingleClickListener | ||
|
||
class EnterPreferenceActivity : | ||
BaseActivity<ActivityEnterPreferenceBinding>(R.layout.activity_enter_preference), | ||
PreferenceTagAdapter.OnPreferenceSelectedListener { | ||
|
||
private var _adapter: PreferenceTagAdapter? = null | ||
private val adapter get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } | ||
|
||
private val viewModel by viewModels<PreferenceTagViewModel>() | ||
|
||
private val preferenceAnswers = MutableList(5) { Int.MAX_VALUE } | ||
|
||
private var title: String? = "" | ||
private var startDate: String? = "" | ||
private var endDate: String? = "" | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initAdapter() | ||
initItemDecoration() | ||
initBackClickListener() | ||
getCreateTripInfo() | ||
sendStyleInfo() | ||
|
||
} | ||
|
||
private fun initAdapter() { | ||
_adapter = PreferenceTagAdapter(this, this) | ||
binding.rvPreferenceTag.adapter = adapter | ||
adapter.submitList(viewModel.preferenceTagList) | ||
} | ||
|
||
private fun initItemDecoration() { | ||
val itemDeco = PreferenceTagDecoration(this) | ||
binding.rvPreferenceTag.addItemDecoration(itemDeco) | ||
} | ||
|
||
private fun initBackClickListener() { | ||
binding.btnPreferenceStart.setOnSingleClickListener { | ||
sendStyleInfo() | ||
} | ||
} | ||
|
||
private fun isButtonValid() { | ||
val isValid = preferenceAnswers.all { it != Int.MAX_VALUE } | ||
|
||
if (isValid) { | ||
binding.btnPreferenceStart.isEnabled = isValid | ||
binding.btnPreferenceStart.setTextColor( | ||
ContextCompat.getColorStateList(this, R.color.white_000) | ||
) | ||
} | ||
} | ||
|
||
private fun getCreateTripInfo() { | ||
val serverList = getIntent() | ||
|
||
if (serverList != null) { | ||
title = intent.getStringExtra(NAME) | ||
val startYear = intent.getIntExtra(START_YEAR, 0) | ||
val startMonth = intent.getIntExtra(START_MONTH, 0) | ||
val startDay = intent.getIntExtra(START_DAY, 0) | ||
val endYear = intent.getIntExtra(END_YEAR, 0) | ||
val endMonth = intent.getIntExtra(END_MONTH, 0) | ||
val endDay = intent.getIntExtra(END_DAY, 0) | ||
|
||
startDate = String.format(SERVER_DATE, startYear, startMonth, startDay) | ||
endDate = String.format(SERVER_DATE, endYear, endMonth, endDay) | ||
} | ||
|
||
} | ||
|
||
private fun sendStyleInfo() { | ||
var styleA = preferenceAnswers[0] | ||
} | ||
|
||
override fun onPreferenceSelected(item: PreferenceData, checkList: Int) { | ||
preferenceAnswers[item.number.toInt() - 1] = checkList | ||
isButtonValid() | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
_adapter = null | ||
} | ||
|
||
companion object { | ||
const val SERVER_DATE = "%s.%s.%s" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.