Less strict HOTP parsing, Remove fabs
This commit is contained in:
parent
2045326d04
commit
90590936df
@ -142,11 +142,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
setSupportActionBar(binding.toolbar);
|
||||
|
||||
//binding.fabMenu.setOnClickListener(view -> NavigationUtil.navigate(this, MenuFragment.class, null)); TODO: remove old menu
|
||||
binding.fabMenu.setOnClickListener(view -> NavigationUtil.openMenu(this, null));
|
||||
binding.fabScan.setOnClickListener(view -> scanCode(null));
|
||||
binding.fabScanImage.setOnClickListener(view -> scanCodeFromImage(null));
|
||||
binding.fabInput.setOnClickListener(view -> inputCode(null));
|
||||
|
||||
Fragment fragment = NavigationUtil.getCurrentFragment(this);
|
||||
if(fragment instanceof NamedFragment) {
|
||||
|
@ -1,33 +1,26 @@
|
||||
package com.cringe_studios.cringe_authenticator.fragment;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator.R;
|
||||
import com.cringe_studios.cringe_authenticator.crypto.CryptoException;
|
||||
import com.cringe_studios.cringe_authenticator.databinding.FragmentGroupBinding;
|
||||
import com.cringe_studios.cringe_authenticator.grouplist.GroupListItem;
|
||||
import com.cringe_studios.cringe_authenticator.model.OTPData;
|
||||
import com.cringe_studios.cringe_authenticator.otplist.OTPListAdapter;
|
||||
import com.cringe_studios.cringe_authenticator.otplist.OTPListItem;
|
||||
import com.cringe_studios.cringe_authenticator.util.DialogUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabase;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabaseException;
|
||||
import com.cringe_studios.cringe_authenticator.util.SettingsUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.StyledDialogBuilder;
|
||||
import com.cringe_studios.cringe_authenticator_library.OTPException;
|
||||
import com.cringe_studios.cringe_authenticator_library.OTPType;
|
||||
|
||||
import java.util.List;
|
||||
@ -63,8 +56,6 @@ public class GroupFragment extends NamedFragment {
|
||||
|
||||
groupID = requireArguments().getString(GroupFragment.BUNDLE_GROUP);
|
||||
|
||||
//FabUtil.showFabs(requireActivity());
|
||||
|
||||
otpListAdapter = new OTPListAdapter(requireContext(), binding.itemList);
|
||||
binding.itemList.setAdapter(otpListAdapter);
|
||||
|
||||
|
@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator.R;
|
||||
import com.cringe_studios.cringe_authenticator.databinding.FragmentHomeBinding;
|
||||
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
||||
|
||||
public class HomeFragment extends NamedFragment {
|
||||
|
||||
@ -23,7 +22,6 @@ public class HomeFragment extends NamedFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
||||
FabUtil.hideFabs(requireActivity());
|
||||
return binding.getRoot();
|
||||
|
||||
}
|
||||
|
@ -13,9 +13,7 @@ import com.cringe_studios.cringe_authenticator.crypto.CryptoException;
|
||||
import com.cringe_studios.cringe_authenticator.databinding.FragmentMenuDrawerBinding;
|
||||
import com.cringe_studios.cringe_authenticator.grouplist.GroupListAdapter;
|
||||
import com.cringe_studios.cringe_authenticator.grouplist.GroupListItem;
|
||||
import com.cringe_studios.cringe_authenticator.model.OTPData;
|
||||
import com.cringe_studios.cringe_authenticator.util.DialogUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.NavigationUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabase;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabaseException;
|
||||
|
@ -1,10 +1,5 @@
|
||||
package com.cringe_studios.cringe_authenticator.fragment;
|
||||
|
||||
import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
||||
import static androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL;
|
||||
|
||||
import android.location.SettingInjectorService;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -15,7 +10,6 @@ import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.biometric.BiometricManager;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator.MainActivity;
|
||||
import com.cringe_studios.cringe_authenticator.R;
|
||||
@ -27,7 +21,6 @@ import com.cringe_studios.cringe_authenticator.databinding.FragmentSettingsBindi
|
||||
import com.cringe_studios.cringe_authenticator.util.Appearance;
|
||||
import com.cringe_studios.cringe_authenticator.util.BiometricUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.DialogUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabase;
|
||||
import com.cringe_studios.cringe_authenticator.util.OTPDatabaseException;
|
||||
import com.cringe_studios.cringe_authenticator.util.SettingsUtil;
|
||||
@ -35,7 +28,6 @@ import com.cringe_studios.cringe_authenticator.util.Theme;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
@ -199,8 +191,6 @@ public class SettingsFragment extends NamedFragment {
|
||||
public void onNothingSelected(AdapterView<?> parent) {}
|
||||
});
|
||||
|
||||
FabUtil.hideFabs(requireActivity());
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
package com.cringe_studios.cringe_authenticator.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator.R;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
public class FabUtil {
|
||||
|
||||
public static void showFabs(Activity activity) {
|
||||
FloatingActionButton fabScanImage = activity.findViewById(R.id.fab_scan_image);
|
||||
if(fabScanImage != null) {
|
||||
fabScanImage.setVisibility(View.VISIBLE);
|
||||
fabScanImage.setClickable(true);
|
||||
fabScanImage.animate().translationX(-activity.getResources().getDimension(R.dimen.fab1_offset));
|
||||
}
|
||||
|
||||
FloatingActionButton fabScan = activity.findViewById(R.id.fab_scan);
|
||||
if(fabScan != null) {
|
||||
fabScan.setVisibility(View.VISIBLE);
|
||||
fabScan.setClickable(true);
|
||||
fabScan.animate().translationX(-activity.getResources().getDimension(R.dimen.fab2_offset));
|
||||
}
|
||||
|
||||
FloatingActionButton fabInput = activity.findViewById(R.id.fab_input);
|
||||
if(fabInput != null) {
|
||||
fabInput.setVisibility(View.VISIBLE);
|
||||
fabInput.setClickable(true);
|
||||
fabInput.animate().translationX(-activity.getResources().getDimension(R.dimen.fab3_offset));
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideFabs(Activity activity) {
|
||||
FloatingActionButton fabScan = activity.findViewById(R.id.fab_scan);
|
||||
if(fabScan != null) {
|
||||
fabScan.setClickable(false);
|
||||
fabScan.animate().translationX(0).withEndAction(() -> fabScan.setVisibility(View.GONE));
|
||||
}
|
||||
|
||||
FloatingActionButton fabScanImage = activity.findViewById(R.id.fab_scan_image);
|
||||
if(fabScan != null) {
|
||||
fabScanImage.setClickable(false);
|
||||
fabScanImage.animate().translationX(0).withEndAction(() -> fabScanImage.setVisibility(View.GONE));
|
||||
}
|
||||
|
||||
FloatingActionButton fabInput = activity.findViewById(R.id.fab_input);
|
||||
if(fabInput != null) {
|
||||
fabInput.setClickable(false);
|
||||
fabInput.animate().translationX(0).withEndAction(() -> fabInput.setVisibility(View.GONE));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -163,10 +163,6 @@ public class OTPParser {
|
||||
throw new IllegalArgumentException("Failed to parse OTP parameters");
|
||||
}
|
||||
|
||||
if(fType == OTPType.HOTP && counter == null) {
|
||||
throw new IllegalArgumentException("Missing required parameters");
|
||||
}
|
||||
|
||||
if(accountName.length() == 0 || (issuer != null && issuer.length() == 0)) {
|
||||
throw new IllegalArgumentException("Missing required parameters");
|
||||
}
|
||||
|
@ -22,39 +22,6 @@
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:srcCompat="@drawable/baseline_edit_24"
|
||||
android:backgroundTint="?attr/colorTheme1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_scan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:srcCompat="@drawable/baseline_qr_code_scanner_24"
|
||||
android:backgroundTint="?attr/colorTheme1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_scan_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:backgroundTint="?attr/colorTheme1"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/baseline_compare_24" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_menu"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user