Skip to content

Commit 259c704

Browse files
author
esdeathlove
committed
improve ssr sub delete
1 parent 7c812f2 commit 259c704

File tree

6 files changed

+53
-2
lines changed

6 files changed

+53
-2
lines changed

src/main/res/values-ja/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@
189189
<string name="ssrsub_toast_fail">サブスクリップションの更新に失敗しました!</string>
190190
<string name="group_name">グループ名</string>
191191
<string name="proxy_click">アドレスを表示し、編集するときにクリックします</string>
192+
<string name="ssrsub_remove_tip_title">削除</string>
193+
<string name="ssrsub_remove_tip">あなたはそれを削除したい、あるいは同じ名前およびサブスクリプションノードそれでグループを削除したいですか?</string>
194+
<string name="ssrsub_remove_tip_direct">削除</string>
195+
<string name="ssrsub_remove_tip_delete">ノードと一緒に削除されました</string>
192196

193197
<!-- status -->
194198
<string name="sent">送信済み:</string>

src/main/res/values-ru/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@
180180
<string name="ssrsub_toast_fail">Ошибка обновления подписки!</string>
181181
<string name="group_name">Название группы</string>
182182
<string name="proxy_click">Нажмите для просмотра и редактирования адреса</string>
183+
<string name="ssrsub_remove_tip_title">удалять</string>
184+
<string name="ssrsub_remove_tip">Вы хотите, чтобы удалить его, или даже хотите удалить группу с тем же именем и узлом подписки это?</string>
185+
<string name="ssrsub_remove_tip_direct">удалять</string>
186+
<string name="ssrsub_remove_tip_delete">Удаляется вместе с узлом</string>
183187

184188

185189
<string name="scan_qrcode_install_title">Сканирование подсказки кода</string>

src/main/res/values-zh-rCN/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@
192192
<string name="ssrsub_toast_fail">更新订阅失败!</string>
193193
<string name="group_name">群组名</string>
194194
<string name="proxy_click">点击查看和编辑地址</string>
195+
<string name="ssrsub_remove_tip_title">删除</string>
196+
<string name="ssrsub_remove_tip">您是想直接删除呢,还是想连带着删除群组和这个订阅名一样的节点呢?</string>
197+
<string name="ssrsub_remove_tip_direct">直接删除</string>
198+
<string name="ssrsub_remove_tip_delete">与节点一起删除</string>
195199

196200

197201

src/main/res/values-zh-rTW/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@
194194
<string name="ssrsub_toast_fail">更新訂閱失敗!</string>
195195
<string name="group_name">群組名</string>
196196
<string name="proxy_click">點擊查看和編輯地址</string>
197+
<string name="ssrsub_remove_tip_title">删除</string>
198+
<string name="ssrsub_remove_tip">您是想直接刪除呢,還是想連帶著刪除群組和這個訂閱名一樣的節點呢?</string>
199+
<string name="ssrsub_remove_tip_direct">直接刪除</string>
200+
<string name="ssrsub_remove_tip_delete">與節點一起刪除</string>
197201

198202

199203
<!-- status -->

src/main/res/values/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@
189189
<string name="ssrsub_toast_fail">Update subscription fail!</string>
190190
<string name="group_name">Group Name</string>
191191
<string name="proxy_click">Click to view and edit the address</string>
192+
<string name="ssrsub_remove_tip_title">Remove</string>
193+
<string name="ssrsub_remove_tip">Do you want to delete this subscription directly without remove the nodes which has the same node name with it or not?</string>
194+
<string name="ssrsub_remove_tip_direct">Delete directly</string>
195+
<string name="ssrsub_remove_tip_delete">Delete with it\'s nodes</string>
192196

193197

194198
<string name="scan_qrcode_install_title">Scan tips</string>

src/main/scala/com/github/shadowsocks/ProfileManagerActivity.scala

+33-2
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,39 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
660660
ItemTouchHelper.START | ItemTouchHelper.END) {
661661
def onSwiped(viewHolder: ViewHolder, direction: Int) = {
662662
val index = viewHolder.getAdapterPosition
663-
ssrsubAdapter.remove(index)
664-
app.ssrsubManager.delSSRSub(viewHolder.asInstanceOf[SSRSubViewHolder].item.id)
663+
new AlertDialog.Builder(ProfileManagerActivity.this)
664+
.setTitle(getString(R.string.ssrsub_remove_tip_title))
665+
.setPositiveButton(R.string.ssrsub_remove_tip_direct, ((_, _) => {
666+
ssrsubAdapter.remove(index)
667+
app.ssrsubManager.delSSRSub(viewHolder.asInstanceOf[SSRSubViewHolder].item.id)
668+
}): DialogInterface.OnClickListener)
669+
.setNegativeButton(android.R.string.no, ((_, _) => {
670+
ssrsubAdapter.notifyDataSetChanged()
671+
}): DialogInterface.OnClickListener)
672+
.setNeutralButton(R.string.ssrsub_remove_tip_delete, ((_, _) => {
673+
var delete_profiles = app.profileManager.getAllProfilesByGroup(viewHolder.asInstanceOf[SSRSubViewHolder].item.url_group) match {
674+
case Some(profiles) =>
675+
profiles
676+
case _ => null
677+
}
678+
679+
delete_profiles.foreach((profile: Profile) => {
680+
if (profile.id != app.profileId) {
681+
app.profileManager.delProfile(profile.id)
682+
}
683+
})
684+
685+
val index = viewHolder.getAdapterPosition
686+
ssrsubAdapter.remove(index)
687+
app.ssrsubManager.delSSRSub(viewHolder.asInstanceOf[SSRSubViewHolder].item.id)
688+
689+
finish()
690+
startActivity(new Intent(getIntent()))
691+
}): DialogInterface.OnClickListener)
692+
.setMessage(getString(R.string.ssrsub_remove_tip))
693+
.setCancelable(false)
694+
.create()
695+
.show()
665696
}
666697
def onMove(recyclerView: RecyclerView, viewHolder: ViewHolder, target: ViewHolder) = {
667698
true

0 commit comments

Comments
 (0)