tls-psk: add compatibility fragment for android < 5

This commit is contained in:
Vincent Breitmoser
2017-05-30 23:41:48 +02:00
parent 99441660ca
commit f35a707d82
10 changed files with 79 additions and 4 deletions

View File

@@ -20,6 +20,8 @@
package org.sufficientlysecure.keychain.ui;
import android.content.Intent;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@@ -42,6 +44,7 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.remote.ui.AppsListFragment;
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
import org.sufficientlysecure.keychain.ui.transfer.view.TransferFragment;
import org.sufficientlysecure.keychain.ui.transfer.view.TransferNotAvailableFragment;
import org.sufficientlysecure.keychain.util.FabContainer;
import org.sufficientlysecure.keychain.util.Preferences;
@@ -176,7 +179,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
}
private void setFragment(Fragment fragment, boolean addToBackStack) {
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
@@ -221,8 +223,13 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
private void onTransferSelected() {
mToolbar.setTitle(R.string.nav_transfer);
mDrawer.setSelection(ID_TRANSFER, false);
Fragment frag = new TransferFragment();
setFragment(frag, true);
if (Build.VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) {
Fragment frag = new TransferNotAvailableFragment();
setFragment(frag, true);
} else {
Fragment frag = new TransferFragment();
setFragment(frag, true);
}
}
@Override

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2017 Vincent Breitmoser <look@my.amazin.horse>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.transfer.view;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.sufficientlysecure.keychain.R;
public class TransferNotAvailableFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.transfer_not_available_fragment, container, false);
}
}