diff options
author | Arne Schwabe <arne@rfc2549.org> | 2019-12-12 00:08:03 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2019-12-12 00:08:03 +0100 |
commit | 89fd370033222c470a8689649baa259f5e308bf4 (patch) | |
tree | 2370bdca3629234db0a894492fce36cd8a38aafe /main/src/ui | |
parent | 8e9c9ff8f71d09365eae346280617bd95124c3d7 (diff) |
Band aid fix for old file select layout.
Diffstat (limited to 'main/src/ui')
3 files changed, 24 insertions, 21 deletions
diff --git a/main/src/ui/java/de/blinkt/openvpn/activities/FileSelect.java b/main/src/ui/java/de/blinkt/openvpn/activities/FileSelect.java index 80a134a9..1ac9ccdf 100644 --- a/main/src/ui/java/de/blinkt/openvpn/activities/FileSelect.java +++ b/main/src/ui/java/de/blinkt/openvpn/activities/FileSelect.java @@ -8,26 +8,26 @@ package de.blinkt.openvpn.activities; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import android.Manifest; import android.annotation.TargetApi; -import android.app.ActionBar; -import android.app.ActionBar.Tab; import android.app.Activity; -import android.app.AlertDialog; -import android.app.AlertDialog.Builder; -import android.app.Fragment; -import android.app.FragmentTransaction; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.util.Base64; -import android.widget.Toast; + + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import com.google.android.material.tabs.TabLayout; import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; @@ -46,8 +46,8 @@ public class FileSelect extends BaseActivity { private FileSelectionFragment mFSFragment; private InlineFileTab mInlineFragment; private String mData; - private Tab inlineFileTab; - private Tab fileExplorerTab; + private ActionBar.Tab inlineFileTab; + private ActionBar.Tab fileExplorerTab; private boolean mNoInline; private boolean mShowClear; private boolean mBase64Encode; @@ -76,18 +76,18 @@ public class FileSelect extends BaseActivity { mShowClear = getIntent().getBooleanExtra(SHOW_CLEAR_BUTTON, false); mBase64Encode = getIntent().getBooleanExtra(DO_BASE64_ENCODE, false); - ActionBar bar = getActionBar(); + ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); fileExplorerTab = bar.newTab().setText(R.string.file_explorer_tab); inlineFileTab = bar.newTab().setText(R.string.inline_file_tab); mFSFragment = new FileSelectionFragment(); - fileExplorerTab.setTabListener(new MyTabsListener<FileSelectionFragment>(this, mFSFragment)); + fileExplorerTab.setTabListener(new MyTabsListener<FileSelectionFragment>(mFSFragment)); bar.addTab(fileExplorerTab); if(!mNoInline) { mInlineFragment = new InlineFileTab(); - inlineFileTab.setTabListener(new MyTabsListener<InlineFileTab>(this, mInlineFragment)); + inlineFileTab.setTabListener(new MyTabsListener<InlineFileTab>( mInlineFragment)); bar.addTab(inlineFileTab); } else { mFSFragment.setNoInLine(); @@ -114,7 +114,7 @@ public class FileSelect extends BaseActivity { finish(); } else { if (fileExplorerTab!=null) - getActionBar().removeTab(fileExplorerTab); + getSupportActionBar().removeTab(fileExplorerTab); } } else { mFSFragment.refresh(); @@ -133,11 +133,11 @@ public class FileSelect extends BaseActivity { private Fragment mFragment; private boolean mAdded=false; - public MyTabsListener( Activity activity, Fragment fragment){ + public MyTabsListener(Fragment fragment){ this.mFragment = fragment; } - public void onTabSelected(Tab tab, FragmentTransaction ft) { + public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { // Check if the fragment is already initialized if (!mAdded) { // If not, instantiate and add it to the activity @@ -150,12 +150,12 @@ public class FileSelect extends BaseActivity { } @Override - public void onTabUnselected(Tab tab, FragmentTransaction ft) { + public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { ft.detach(mFragment); } @Override - public void onTabReselected(Tab tab, FragmentTransaction ft) { + public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { } } @@ -183,7 +183,7 @@ public class FileSelect extends BaseActivity { fe =e; } if(fe!=null) { - Builder ab = new AlertDialog.Builder(this); + AlertDialog.Builder ab = new AlertDialog.Builder(this); ab.setTitle(R.string.error_importing_file); ab.setMessage(getString(R.string.import_error_message) + "\n" + fe.getLocalizedMessage()); ab.setPositiveButton(android.R.string.ok, null); diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java b/main/src/ui/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java index 9d12b83d..121cf324 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java @@ -5,7 +5,6 @@ package de.blinkt.openvpn.fragments; -import android.app.ListFragment; import android.os.Build; import android.os.Bundle; import android.os.Environment; @@ -21,6 +20,8 @@ import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; +import androidx.fragment.app.ListFragment; + import java.io.File; import java.util.ArrayList; import java.util.Collection; diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/InlineFileTab.java b/main/src/ui/java/de/blinkt/openvpn/fragments/InlineFileTab.java index 41206a54..ed6418ed 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/InlineFileTab.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/InlineFileTab.java @@ -5,7 +5,6 @@ package de.blinkt.openvpn.fragments; -import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; @@ -14,6 +13,9 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; + +import androidx.fragment.app.Fragment; + import de.blinkt.openvpn.activities.FileSelect; import de.blinkt.openvpn.R; |