diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-02-07 23:40:38 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-02-07 23:40:38 +0100 |
commit | 811436bea4925a657ce8a986c64513f76a5f2aa5 (patch) | |
tree | 3d1f879c07e3a249444d68c9614ea64a74b8a5e8 /src/de/blinkt/openvpn/ShowConfigFragment.java | |
parent | b6386e685176add87a06943d34bf01d8cd1dbea4 (diff) |
First working version of OpenVPN 3 Core (still much left to do
--HG--
branch : ovpn3
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 |