From c38e37c06b437bcaa9a2419f9daffcb96766efb2 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 24 Dec 2016 02:21:26 +0800 Subject: [PATCH] Start configuring right after manual config was selected --- .../scala/com/github/shadowsocks/ProfilesFragment.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala b/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala index 0d9f911f..217c2eb3 100644 --- a/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala +++ b/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala @@ -58,8 +58,7 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene { val edit = itemView.findViewById(R.id.edit) - edit.setOnClickListener(_ => startActivity(new Intent(getActivity, classOf[ProfileConfigActivity]) - .putExtra(Action.EXTRA_PROFILE_ID, item.id))) + edit.setOnClickListener(_ => startConfig(item.id)) edit.setOnLongClickListener(_ => { Utils.positionToast(Toast.makeText(getActivity, edit.getContentDescription, Toast.LENGTH_SHORT), edit, getActivity.getWindow, 0, Utils.dpToPx(getActivity, 8)).show() @@ -224,6 +223,9 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene private lazy val isDemoMode = Build.VERSION.SDK_INT >= 25 && getActivity.getSystemService(classOf[UserManager]).isDemoUser + private def startConfig(id: Int) = startActivity(new Intent(getActivity, classOf[ProfileConfigActivity]) + .putExtra(Action.EXTRA_PROFILE_ID, id)) + override def onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle): View = inflater.inflate(R.layout.layout_profiles, container, false) @@ -292,6 +294,8 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene case R.id.action_manual_settings => val profile = app.profileManager.createProfile() app.profileManager.updateProfile(profile) + startConfig(profile.id) + true case R.id.action_export => app.profileManager.getAllProfiles match { case Some(profiles) =>