diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-11 00:46:33 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-11 00:46:33 +0200 |
commit | bfb51aa744b09b248daacd3ada8f04e6c6f7d5a5 (patch) | |
tree | af278c4a7243807df6cf0e7774fd7cc810f7d1a9 /src/de/blinkt/openvpn/InlineFileTab.java | |
parent | be5159289c41a525b718363e3f7ab78019928d42 (diff) |
Rework FIle selection dialog.
Include possibility to include file content in VPN Profile. Allows safer storage of Certifcates and keys. (closes issue #13)
--HG--
rename : src/com/lamerman/FileDialog.java => src/de/blinkt/openvpn/FileSelectionFragment.java
Diffstat (limited to 'src/de/blinkt/openvpn/InlineFileTab.java')
-rw-r--r-- | src/de/blinkt/openvpn/InlineFileTab.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/InlineFileTab.java b/src/de/blinkt/openvpn/InlineFileTab.java new file mode 100644 index 00000000..1104d290 --- /dev/null +++ b/src/de/blinkt/openvpn/InlineFileTab.java @@ -0,0 +1,65 @@ +package de.blinkt.openvpn; + +import android.app.Fragment; +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.EditText; + +public class InlineFileTab extends Fragment +{ + + private static final int MENU_SAVE = 0; + private EditText mInlineData; + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + mInlineData.setText(((FileSelect)getActivity()).getInlineData()); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) + { + + View v = inflater.inflate(R.layout.file_dialog_inline, container, false); + mInlineData =(EditText) v.findViewById(R.id.inlineFileData); + return v; + } + + public void setData(String data) { + if(mInlineData!=null) + mInlineData.setText(data); + + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + menu.add(0, MENU_SAVE, 0, "Use inline data") + .setIcon(android.R.drawable.ic_menu_save) + .setAlphabeticShortcut('u') + .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM + | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if(item.getItemId()==MENU_SAVE){ + ((FileSelect)getActivity()).saveInlineData(mInlineData.getText().toString()); + return true; + } + return super.onOptionsItemSelected(item); + } + +}
\ No newline at end of file |