diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-02-09 17:03:27 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-02-09 17:03:27 +0100 |
commit | c89414179f77982751064a5709122913c3ffd6c4 (patch) | |
tree | 225211a18ce80513c4b05a9525538444b563f18b /src/de/blinkt/openvpn/ShowConfigFragment.java | |
parent | 9fab59b5c4b928989eec21bd598c01e5234a18d0 (diff) |
Merge non OpenVPN3 specific into main
Diffstat (limited to 'src/de/blinkt/openvpn/ShowConfigFragment.java')
-rw-r--r-- | src/de/blinkt/openvpn/ShowConfigFragment.java | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/de/blinkt/openvpn/ShowConfigFragment.java b/src/de/blinkt/openvpn/ShowConfigFragment.java index dae83438..c9c778df 100644 --- a/src/de/blinkt/openvpn/ShowConfigFragment.java +++ b/src/de/blinkt/openvpn/ShowConfigFragment.java @@ -17,21 +17,41 @@ public class ShowConfigFragment extends Fragment { public android.view.View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String profileUUID = getArguments().getString(getActivity().getPackageName() + ".profileUUID"); - VpnProfile vp = ProfileManager.get(profileUUID); + final VpnProfile vp = ProfileManager.get(profileUUID); View v=inflater.inflate(R.layout.viewconfig, container,false); - TextView cv = (TextView) v.findViewById(R.id.configview); + final TextView cv = (TextView) v.findViewById(R.id.configview); int check=vp.checkProfile(getActivity()); if(check!=R.string.no_error_found) { cv.setText(check); configtext = getString(check); } - else { - String cfg=vp.getConfigFile(getActivity()); - configtext= cfg; - cv.setText(cfg); + else { + // Run in own Thread since Keystore does not like to be queried from the main thread + + cv.setText("Generating config..."); + startGenConfig(vp, cv); } return v; + } + + private void startGenConfig(final VpnProfile vp, final TextView cv) { + + new Thread() { + public void run() { + final String cfg=vp.getConfigFile(getActivity(),false); + configtext= cfg; + getActivity().runOnUiThread(new Runnable() { + + @Override + public void run() { + cv.setText(cfg); + } + }); + + + }; + }.start(); }; @Override |