0
0
mirror of https://github.com/schwabe/ics-openvpn.git synced 2024-09-20 03:52:27 +02:00

Band aid fix for old file select layout.

This commit is contained in:
Arne Schwabe 2019-12-12 00:08:03 +01:00
parent 8e9c9ff8f7
commit 89fd370033
4 changed files with 26 additions and 23 deletions

View File

@ -138,9 +138,9 @@ dependencies {
dependencies.add("uiImplementation", "com.google.android.material:material:$materialVersion")
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50")
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61")
testImplementation("junit:junit:4.12")
testImplementation("org.mockito:mockito-core:3.1.0")
testImplementation("org.mockito:mockito-core:3.2.0")
testImplementation("org.robolectric:robolectric:4.3.1")
}

View File

@ -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);

View File

@ -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;

View File

@ -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;