-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from greedy0110/develop
implement popup system
- Loading branch information
Showing
8 changed files
with
221 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.articrew.artic.util | ||
|
||
import android.app.Activity | ||
import android.app.AlertDialog | ||
import android.view.View | ||
|
||
object PopupSystem { | ||
/** | ||
* 버튼을 누르면 dialog를 종료하는 popup을 만든다. | ||
* @param activity popup이 나타나는 곳 | ||
* @param layoutId dialog의 layout id값 | ||
* @param map key는 click event가 적용될 view, value는 click이벤트 | ||
* */ | ||
fun show(activity: Activity?, layoutId: Int, map: Map<Int, (()->Any)?>) { | ||
activity?.run { | ||
val view = layoutInflater.inflate(layoutId, null, false) | ||
val dialog = AlertDialog.Builder(this) | ||
.setView(view) | ||
.create() | ||
|
||
for (pair in map) { | ||
view.findViewById<View>(pair.key).setOnClickListener { | ||
pair.value?.invoke() | ||
dialog.dismiss() | ||
} | ||
} | ||
|
||
dialog.show() | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="6dp" | ||
android:layout_marginHorizontal="45dp" | ||
app:cardElevation="0dp"> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/textView3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="41dp" | ||
android:layout_marginTop="38dp" | ||
android:layout_marginEnd="42dp" | ||
android:text="@string/label_do_you_delete_archive" | ||
android:textSize="15sp" | ||
android:lineSpacingExtra="9sp" | ||
android:fontFamily="@font/nanum_barungothic_bold" | ||
android:textColor="@color/black" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/textView5" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:text="@string/label_warning_delete_archive" | ||
android:textSize="12sp" | ||
android:lineSpacingExtra="12sp" | ||
android:fontFamily="@font/nanum_barungothic_regular" | ||
app:layout_constraintEnd_toEndOf="@+id/textView3" | ||
app:layout_constraintStart_toStartOf="@+id/textView3" | ||
app:layout_constraintTop_toBottomOf="@+id/textView3" /> | ||
|
||
<View | ||
android:id="@+id/view8" | ||
android:layout_width="match_parent" | ||
android:layout_height="1dp" | ||
android:layout_marginTop="36dp" | ||
android:background="@color/very_light_pink_two" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView5" /> | ||
|
||
<TextView | ||
android:id="@+id/btn_dlg_confirm_delete" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="@string/delete" | ||
android:textSize="14sp" | ||
android:lineSpacingExtra="2sp" | ||
android:fontFamily="@font/nanum_barungothic_regular" | ||
android:textStyle="bold" | ||
android:textColor="@color/red" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/view8" /> | ||
|
||
<View | ||
android:id="@+id/view9" | ||
android:layout_width="match_parent" | ||
android:layout_height="1dp" | ||
android:layout_marginTop="16dp" | ||
android:background="@color/very_light_pink_two" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/btn_dlg_confirm_delete" /> | ||
|
||
<TextView | ||
android:id="@+id/btn_dlg_confirm_cancel" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginBottom="17dp" | ||
android:text="@string/cancel" | ||
android:textSize="14sp" | ||
android:lineSpacingExtra="2sp" | ||
android:fontFamily="@font/nanum_barungothic_regular" | ||
android:textColor="@color/black" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/view9" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</androidx.cardview.widget.CardView> |
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,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="1dp" | ||
app:cardCornerRadius="6dp"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/btn_dlg_archive_modify" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="20dp" | ||
android:layout_marginTop="16dp" | ||
android:fontFamily="@font/nanum_barungothic_regular" | ||
android:lineSpacingExtra="10sp" | ||
android:text="@string/modify_archive_name" | ||
android:textColor="@color/black" | ||
android:textSize="14sp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/btn_dlg_archive_delete" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="19dp" | ||
android:layout_marginBottom="16dp" | ||
android:fontFamily="@font/nanum_barungothic_regular" | ||
android:lineSpacingExtra="10sp" | ||
android:text="@string/delete_archive" | ||
android:textColor="@color/red" | ||
android:textSize="14sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="@+id/btn_dlg_archive_modify" | ||
app:layout_constraintTop_toBottomOf="@+id/btn_dlg_archive_modify" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</androidx.cardview.widget.CardView> |
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