mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 22:12:55 +00:00
Some more intro logic fixes
This commit is contained in:
parent
7d5bd8f812
commit
f26dfac1b6
4 changed files with 33 additions and 31 deletions
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -24,7 +24,7 @@
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -19,7 +19,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import com.github.paolorotolo.appintro.ISlidePolicy;
|
import com.github.paolorotolo.appintro.ISlidePolicy;
|
||||||
|
|
||||||
public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy {
|
public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy, RadioGroup.OnCheckedChangeListener {
|
||||||
public static final int CRYPT_TYPE_INVALID = 0;
|
public static final int CRYPT_TYPE_INVALID = 0;
|
||||||
public static final int CRYPT_TYPE_NONE = 1;
|
public static final int CRYPT_TYPE_NONE = 1;
|
||||||
public static final int CRYPT_TYPE_PASS = 2;
|
public static final int CRYPT_TYPE_PASS = 2;
|
||||||
|
@ -34,31 +34,8 @@ public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
|
|
||||||
_buttonGroup = (RadioGroup) view.findViewById(R.id.rg_authenticationMethod);
|
_buttonGroup = (RadioGroup) view.findViewById(R.id.rg_authenticationMethod);
|
||||||
_buttonGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
_buttonGroup.setOnCheckedChangeListener(this);
|
||||||
@Override
|
onCheckedChanged(_buttonGroup, _buttonGroup.getCheckedRadioButtonId());
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
||||||
if (checkedId == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int id;
|
|
||||||
switch (checkedId) {
|
|
||||||
case R.id.rb_none:
|
|
||||||
id = CRYPT_TYPE_NONE;
|
|
||||||
break;
|
|
||||||
case R.id.rb_password:
|
|
||||||
id = CRYPT_TYPE_PASS;
|
|
||||||
break;
|
|
||||||
case R.id.rb_fingerprint:
|
|
||||||
id = CRYPT_TYPE_FINGER;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
Intent intent = getActivity().getIntent();
|
|
||||||
intent.putExtra("cryptType", id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// only show the fingerprint option if the api version is new enough, permission is granted and a scanner is found
|
// only show the fingerprint option if the api version is new enough, permission is granted and a scanner is found
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
@ -89,4 +66,28 @@ public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy
|
||||||
Snackbar snackbar = Snackbar.make(getView(), "Please select an authentication method", Snackbar.LENGTH_LONG);
|
Snackbar snackbar = Snackbar.make(getView(), "Please select an authentication method", Snackbar.LENGTH_LONG);
|
||||||
snackbar.show();
|
snackbar.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(RadioGroup radioGroup, int i) {
|
||||||
|
if (i == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id;
|
||||||
|
switch (i) {
|
||||||
|
case R.id.rb_none:
|
||||||
|
id = CRYPT_TYPE_NONE;
|
||||||
|
break;
|
||||||
|
case R.id.rb_password:
|
||||||
|
id = CRYPT_TYPE_PASS;
|
||||||
|
break;
|
||||||
|
case R.id.rb_fingerprint:
|
||||||
|
id = CRYPT_TYPE_FINGER;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
Intent intent = getActivity().getIntent();
|
||||||
|
intent.putExtra("cryptType", id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,8 @@ public class IntroActivity extends AppIntro implements DerivationTask.Callback {
|
||||||
|
|
||||||
int cryptType = _authenticatedSlide.getCryptType();
|
int cryptType = _authenticatedSlide.getCryptType();
|
||||||
// wait for the key derivation background task
|
// wait for the key derivation background task
|
||||||
if (cryptType == CustomAuthenticationSlide.CRYPT_TYPE_NONE ||
|
if (cryptType != CustomAuthenticationSlide.CRYPT_TYPE_NONE &&
|
||||||
_passwordSlot == null || _passwordCipher == null) {
|
(_passwordSlot == null || _passwordCipher == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,6 @@ public class MainActivity extends AppCompatActivity {
|
||||||
Intent intent = new Intent(this, AuthActivity.class);
|
Intent intent = new Intent(this, AuthActivity.class);
|
||||||
intent.putExtra("slots", _db.getFile().getSlots());
|
intent.putExtra("slots", _db.getFile().getSlots());
|
||||||
startActivityForResult(intent, CODE_DECRYPT);
|
startActivityForResult(intent, CODE_DECRYPT);
|
||||||
} else {
|
|
||||||
loadKeyProfiles();
|
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// start the intro if the db file was not found
|
// start the intro if the db file was not found
|
||||||
|
@ -118,6 +116,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
_keyProfiles = new ArrayList<>();
|
_keyProfiles = new ArrayList<>();
|
||||||
_keyProfileAdapter = new KeyProfileAdapter(_keyProfiles);
|
_keyProfileAdapter = new KeyProfileAdapter(_keyProfiles);
|
||||||
_keyProfileAdapter.setOnItemClickListener((position, v) -> createBottomSheet(position).show());
|
_keyProfileAdapter.setOnItemClickListener((position, v) -> createBottomSheet(position).show());
|
||||||
|
if (_db.isDecrypted()) {
|
||||||
|
loadKeyProfiles();
|
||||||
|
}
|
||||||
|
|
||||||
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(_keyProfileAdapter);
|
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(_keyProfileAdapter);
|
||||||
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
|
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue