Skip to content

Commit

Permalink
コンテンツ長押しで削除できるように機能追加
Browse files Browse the repository at this point in the history
  • Loading branch information
daigorian committed Sep 18, 2021
1 parent 433c4a2 commit beb254c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class OriginalCardPresenter : Presenter() {
viewHolder.view.setOnLongClickListener{

AlertDialog.Builder(it.context, R.style.Theme_AppCompat_Light_Dialog_MinWidth)
.setTitle(cardView.titleText.toString() + "を削除しますか")
.setPositiveButton("削除") { dialog, which ->
.setTitle(it.context.getString(R.string.do_you_want_to_delete,cardView.titleText.toString()))
.setPositiveButton(it.context.getString(R.string.delete)) { dialog, which ->
when (item) {
is RecordedProgram -> {
// EPGStation Version 1.x.x のアイテム
Expand All @@ -75,10 +75,10 @@ class OriginalCardPresenter : Presenter() {
response.body()!!.code != null &&
response.body()!!.code == 200L
) {
Toast.makeText(it.context, "削除しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.successfully_deleted), Toast.LENGTH_LONG)
.show()
} else {
Toast.makeText(it.context, "削除に失敗しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.delete_failed), Toast.LENGTH_LONG)
.show()
}
}
Expand All @@ -87,7 +87,7 @@ class OriginalCardPresenter : Presenter() {
call: Call<ApiError>,
t: Throwable
) {
Toast.makeText(it.context, "削除に失敗しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.delete_failed), Toast.LENGTH_LONG)
.show()
}
})
Expand All @@ -105,10 +105,10 @@ class OriginalCardPresenter : Presenter() {
response.body()!!.code != null &&
response.body()!!.code == 200L
) {
Toast.makeText(it.context, "削除しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.successfully_deleted), Toast.LENGTH_LONG)
.show()
} else {
Toast.makeText(it.context, "削除に失敗しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.delete_failed), Toast.LENGTH_LONG)
.show()
}
}
Expand All @@ -117,7 +117,7 @@ class OriginalCardPresenter : Presenter() {
call: Call<ApiErrorV2>,
t: Throwable
) {
Toast.makeText(it.context, "削除に失敗しました", Toast.LENGTH_LONG)
Toast.makeText(it.context, it.context.getString(R.string.delete_failed), Toast.LENGTH_LONG)
.show()
}
})
Expand All @@ -126,7 +126,7 @@ class OriginalCardPresenter : Presenter() {


}
.setNegativeButton("キャンセル") { dialogInterface, i ->
.setNegativeButton(it.context.getString(R.string.cancel)) { dialogInterface, i ->
// User chose NO
}.create().show()
true
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values-ja-rJP/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@
<string name="set_oldest_rule_first">録画ルールを古い順に並べ替え</string>
<string name="use_custom_base_url">API Base URLを編集する</string>
<string name="customize_base_url">API Base URL</string>
<string name="do_you_want_to_delete">%1$s を削除しますか</string>
<string name="successfully_deleted">削除しました。リストを再読み込みしてください。</string>
<string name="delete_failed">削除に失敗しました</string>
<string name="delete">削除</string>
<string name="cancel">キャンセル</string>

</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<string name="pref_key_custom_base_url" translatable="false">KEY_RULES_CUSTOM_BASE_URL</string>
<string name="customize_base_url">Customized Base URL</string>
<string name="pref_val_custom_base_url_default" translatable="false">http://192.168.0.0:8888/api/</string>
<string name="do_you_want_to_delete">Do you want to delete %1$s</string>
<string name="successfully_deleted">Successfully deleted. Please reload items.</string>
<string name="delete_failed">Delete failed</string>
<string name="delete">Delete</string>
<string name="cancel">Cancel</string>


</resources>

0 comments on commit beb254c

Please sign in to comment.