@@ -660,8 +660,39 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
660
660
ItemTouchHelper .START | ItemTouchHelper .END ) {
661
661
def onSwiped (viewHolder : ViewHolder , direction : Int ) = {
662
662
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()
665
696
}
666
697
def onMove (recyclerView : RecyclerView , viewHolder : ViewHolder , target : ViewHolder ) = {
667
698
true
0 commit comments