diff options
author | Parménides GV <parmegv@sdf.org> | 2014-05-19 17:44:25 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-05-19 17:44:25 +0200 |
commit | baad99940a0bfa2e4c27a9cbc0f478e94b6d20ff (patch) | |
tree | 3332b0f32843652ec4a76bd32497d5593b81965b /app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java | |
parent | a7f8db4fdb308f2fcd1cc1c5013ac930cc063ec1 (diff) |
Copy necessary activities and fragments.
Now we need to decide what's our relationship with LogWindow and
LaunchVPN, refactor its classes and fix ours so that we use the
currently supported methods.
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java b/app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java deleted file mode 100644 index 0cf2bbb7..00000000 --- a/app/src/main/java/de/blinkt/openvpn/fragments/ShowConfigFragment.java +++ /dev/null @@ -1,89 +0,0 @@ -package de.blinkt.openvpn.fragments; - -import android.app.Fragment; -import android.content.Intent; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import se.leap.bitmaskclient.R; -import de.blinkt.openvpn.VpnProfile; -import de.blinkt.openvpn.core.ProfileManager; - - -public class ShowConfigFragment extends Fragment { - private String configtext; - public android.view.View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) - { - String profileUUID = getArguments().getString(getActivity().getPackageName() + ".profileUUID"); - final VpnProfile vp = ProfileManager.get(getActivity(),profileUUID); - View v=inflater.inflate(R.layout.viewconfig, container,false); - 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 { - // 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 - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - inflater.inflate(R.menu.configmenu, menu); - } - - private void shareConfig() { - Intent shareIntent = new Intent(Intent.ACTION_SEND); - shareIntent.putExtra(Intent.EXTRA_TEXT, configtext); - shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_config_title)); - shareIntent.setType("text/plain"); - startActivity(Intent.createChooser(shareIntent, "Export Configfile")); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - final int itemId = item.getItemId(); - if (itemId == R.id.sendConfig) { - shareConfig(); - return true; - } else { - return super.onOptionsItemSelected(item); - } - } -} |