forked from tukcomCD2024/ISP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat : Add a shedule order change feature tukcomCD2024#85
- Loading branch information
Showing
11 changed files
with
192 additions
and
17 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
5 changes: 5 additions & 0 deletions
5
android/HowAboutTrip/app/src/main/java/com/project/how/interface_af/OnOrderChangeListener.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,5 @@ | ||
package com.project.how.interface_af | ||
|
||
interface OnOrderChangeListener { | ||
fun onOrderChangeListener(changedPosition : Int, previousPosition : Int) | ||
} |
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
71 changes: 71 additions & 0 deletions
71
android/HowAboutTrip/app/src/main/java/com/project/how/view/dialog/OrderChangeDialog.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,71 @@ | ||
package com.project.how.view.dialog | ||
|
||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.view.Window | ||
import androidx.databinding.DataBindingUtil | ||
import androidx.fragment.app.DialogFragment | ||
import com.project.how.R | ||
import com.project.how.adapter.recyclerview.RadioButtonAdapter | ||
import com.project.how.data_class.recyclerview.DaysSchedule | ||
import com.project.how.databinding.DialogOrderChangeBinding | ||
import com.project.how.interface_af.OnOrderChangeListener | ||
|
||
class OrderChangeDialog(private val data : MutableList<DaysSchedule>, private val currentPosition : Int, private val onOrderChangeListener: OnOrderChangeListener) : DialogFragment(), RadioButtonAdapter.OnItemClickListener { | ||
private var _binding : DialogOrderChangeBinding? = null | ||
private val binding : DialogOrderChangeBinding | ||
get() = _binding!! | ||
private lateinit var adapter : RadioButtonAdapter | ||
private lateinit var days : MutableList<String> | ||
private var position = currentPosition | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
days = mutableListOf() | ||
for (i in 1..data.size){ | ||
days.add("${i}번째 : ${data[i-1].todo}") | ||
} | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
_binding = DataBindingUtil.inflate(inflater, R.layout.dialog_order_change, container, false) | ||
binding.order = this | ||
binding.lifecycleOwner = viewLifecycleOwner | ||
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | ||
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE) | ||
adapter = RadioButtonAdapter(days, false, this, RadioButtonAdapter.ORDER) | ||
adapter.setCheck(currentPosition) | ||
binding.scheduleOrder.adapter = adapter | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
fun cancel(){ | ||
dismiss() | ||
} | ||
|
||
fun save(){ | ||
onOrderChangeListener.onOrderChangeListener(position, currentPosition) | ||
dismiss() | ||
} | ||
|
||
override fun onItemClickListener(data: String, type: Int, position: Int) { | ||
this.position = position | ||
} | ||
} |
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
72 changes: 72 additions & 0 deletions
72
android/HowAboutTrip/app/src/main/res/layout/dialog_order_change.xml
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,72 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
<data> | ||
<variable | ||
name="order" | ||
type="com.project.how.view.dialog.OrderChangeDialog" /> | ||
</data> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/white_round_rectangle"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/info_box" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:layout_marginHorizontal="20dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/schedule_order" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:maxHeight="300dp" | ||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
android:orientation="vertical" | ||
tools:listitem="@layout/simple_radiobutton_item" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
<androidx.appcompat.widget.AppCompatButton | ||
android:id="@+id/cancel" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:text="@string/cancel" | ||
android:textColor="@color/black" | ||
android:textSize="16sp" | ||
android:textStyle="bold" | ||
android:background="@drawable/gray_dialog_no" | ||
android:onClick="@{()-> order.cancel()}" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/save" | ||
app:layout_constraintTop_toBottomOf="@+id/info_box" /> | ||
|
||
<androidx.appcompat.widget.AppCompatButton | ||
android:id="@+id/save" | ||
android:layout_width="0dp" | ||
android:text="@string/edit" | ||
android:textColor="@color/white" | ||
android:textSize="16sp" | ||
android:textStyle="bold" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:background="@drawable/black_dialog_yes" | ||
android:onClick="@{()->order.save()}" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@+id/cancel" | ||
app:layout_constraintTop_toBottomOf="@+id/info_box" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</layout> |
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