-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add SimpleDialog under the common dir
- display the dialog when error happens while processing image - change nullable signature of constructor of the adapter - add japanese resources
- Loading branch information
Moroi
committed
Dec 6, 2022
1 parent
03adf09
commit 7b8909a
Showing
13 changed files
with
124 additions
and
19 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
44 changes: 44 additions & 0 deletions
44
FishBun/src/main/java/com/sangcomz/fishbun/ui/common/SimpleDialog.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,44 @@ | ||
package com.sangcomz.fishbun.ui.common | ||
|
||
import android.app.Dialog | ||
import android.content.DialogInterface | ||
import android.os.Bundle | ||
import androidx.annotation.StringRes | ||
import androidx.fragment.app.DialogFragment | ||
import androidx.fragment.app.FragmentManager | ||
import com.sangcomz.fishbun.R | ||
|
||
internal class SimpleDialog(private val onDismiss: (DialogInterface) -> Unit) : DialogFragment() { | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
val mesId = arguments?.getInt(ARG_KEY_MESSAGE) | ||
?: throw IllegalArgumentException("can not access string resource.") | ||
return androidx.appcompat.app.AlertDialog.Builder(requireContext()) | ||
.setMessage(mesId) | ||
.setPositiveButton(R.string.common_positive_button_label, null) | ||
.show() | ||
} | ||
|
||
override fun onDismiss(dialog: DialogInterface) { | ||
super.onDismiss(dialog) | ||
onDismiss.invoke(dialog) | ||
} | ||
|
||
internal companion object { | ||
|
||
private const val ARG_KEY_MESSAGE = "message" | ||
|
||
fun show( | ||
fm: FragmentManager, | ||
tag: String = "SimpleDialog", | ||
@StringRes mesId: Int, | ||
onDismiss: (DialogInterface) -> Unit, | ||
) { | ||
SimpleDialog(onDismiss).apply { | ||
arguments = Bundle().apply { | ||
putInt(ARG_KEY_MESSAGE, mesId) | ||
} | ||
}.show(fm, tag) | ||
} | ||
} | ||
} |
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
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="album">アルバム</string> | ||
<string name="camera">カメラ</string> | ||
<string name="done">完了</string> | ||
<string name="done_all">全て完了</string> | ||
<string name="msg_no_selected">画像が選択されていません</string> | ||
<string name="str_all_view">全て</string> | ||
<string name="msg_permission">権限が却下されました</string> | ||
<string name="msg_no_image">アルバムがありません</string> | ||
<string name="msg_full_image">違う画像を選択するには選択済みの画像を外してください</string> | ||
<string name="msg_loading_image">読み込み中…</string> | ||
<string name="image">画像</string> | ||
<string name="msg_error">一時的なエラーが発生しました。少し経ってから試してください</string> | ||
<string name="title_toolbar" formatted="false" translatable="false">%s (%d/%d)</string> | ||
<string name="msg_minimum_image">最低でも <b>%d</b> 枚選択してください</string> | ||
</resources> |
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