diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-01-25 14:57:40 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-01-25 14:57:40 +0100 |
commit | 0cf62450e017a031afc637841a34105c25279067 (patch) | |
tree | 03817181a371a492b8b84ec73af24f80deb4f3b0 /src/de/blinkt/openvpn/views | |
parent | 491ea0e8bd9a9e200d2fe4e54c0084d54642eb3e (diff) |
Add the ability to select missing files from Convert Dialog
Diffstat (limited to 'src/de/blinkt/openvpn/views')
-rw-r--r-- | src/de/blinkt/openvpn/views/FileSelectLayout.java | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/de/blinkt/openvpn/views/FileSelectLayout.java b/src/de/blinkt/openvpn/views/FileSelectLayout.java index 18a2a766..04392b47 100644 --- a/src/de/blinkt/openvpn/views/FileSelectLayout.java +++ b/src/de/blinkt/openvpn/views/FileSelectLayout.java @@ -1,13 +1,10 @@ package de.blinkt.openvpn.views; -import android.net.Uri; -import android.util.Base64; import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.activities.FileSelect; import de.blinkt.openvpn.core.VpnStatus; import de.blinkt.openvpn.core.X509Utils; -import android.app.Fragment; import android.content.Context; import android.content.Intent; import android.content.res.TypedArray; @@ -44,10 +41,17 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener { } } - private final boolean mIsCertificate; + public interface FileSelectCallback { + + String getString(int res); + + void startActivityForResult(Intent startFC, int mTaskId); + } + + private boolean mIsCertificate; private TextView mDataView; private String mData; - private Fragment mFragment; + private FileSelectCallback mFragment; private int mTaskId; private Button mSelectButton; private Utils.FileType fileType; @@ -57,12 +61,27 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener { public FileSelectLayout(Context context, AttributeSet attrset) { super(context, attrset); - inflate(getContext(), R.layout.file_select, this); TypedArray ta = context.obtainStyledAttributes(attrset, R.styleable.FileSelectLayout); - mTitle = ta.getString(R.styleable.FileSelectLayout_title); - mIsCertificate = ta.getBoolean(R.styleable.FileSelectLayout_certificate, true); + setupViews(ta.getString(R.styleable.FileSelectLayout_title), ta.getBoolean(R.styleable.FileSelectLayout_certificate, true)); + + ta.recycle(); + } + + public FileSelectLayout (Context context, String title, boolean isCerticate) + { + super(context); + + setupViews(title, isCerticate); + + } + + private void setupViews(String title, boolean isCertificate) { + inflate(getContext(), R.layout.file_select, this); + + mTitle = title; + mIsCertificate = isCertificate; TextView tview = (TextView) findViewById(R.id.file_title); tview.setText(mTitle); @@ -71,11 +90,10 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener { mDataDetails = (TextView) findViewById(R.id.file_selected_description); mSelectButton = (Button) findViewById(R.id.file_select_button); mSelectButton.setOnClickListener(this); - - ta.recycle(); } - public void setFragment(Fragment fragment, int i, Utils.FileType ft) { + + public void setCaller(FileSelectCallback fragment, int i, Utils.FileType ft) { mTaskId = i; mFragment = fragment; fileType = ft; |