Remove old pattern lib, add new pattern lib

This commit is contained in:
Dominik Schürmann 2015-02-23 00:28:26 +01:00
parent 6b57afc350
commit 7bddd5be1d
6 changed files with 62 additions and 98 deletions

View file

@ -19,9 +19,9 @@ dependencies {
compile project(':extern:KeybaseLib:Lib') compile project(':extern:KeybaseLib:Lib')
compile project(':extern:TokenAutoComplete:library') compile project(':extern:TokenAutoComplete:library')
compile project(':extern:safeslinger-exchange') compile project(':extern:safeslinger-exchange')
compile project(':extern:android-lockpattern:code')
// TODO: include as submodule?: // TODO: Pin!
compile 'com.eftimoff:android-patternview:1.0.0@aar'
compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar' compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar'
compile 'com.journeyapps:zxing-android-integration:2.0.1@aar' compile 'com.journeyapps:zxing-android-integration:2.0.1@aar'
compile 'com.google.zxing:core:3.0.1' compile 'com.google.zxing:core:3.0.1'

View file

@ -67,8 +67,10 @@
<uses-permission android:name="android.permission.READ_PROFILE" /> <uses-permission android:name="android.permission.READ_PROFILE" />
<!-- android:allowBackup="false": Don't allow backup over adb backup or other apps! --> <!-- android:allowBackup="false": Don't allow backup over adb backup or other apps! -->
<!-- tools:replace="android:allowBackup" is a workaround for https://github.com/geftimov/android-patternview/pull/2 -->
<application <application
android:name=".KeychainApplication" android:name=".KeychainApplication"
tools:replace="android:allowBackup"
android:allowBackup="false" android:allowBackup="false"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
@ -653,12 +655,6 @@
<activity <activity
android:name=".ui.PassphraseDialogActivity" android:name=".ui.PassphraseDialogActivity"
android:theme="@android:style/Theme.NoDisplay" /> android:theme="@android:style/Theme.NoDisplay" />
<activity
android:name="com.haibison.android.lockpattern.LockPatternActivity"
android:label="@string/title_unlock"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden"
android:screenOrientation="user"
android:theme="@style/Alp.42447968.Theme.Dialog.Light" />
<activity android:name=".ui.PassphraseWizardActivity" /> <activity android:name=".ui.PassphraseWizardActivity" />
<!-- <!--
NOTE: singleTop is set to get NFC foreground dispatch to work. NOTE: singleTop is set to get NFC foreground dispatch to work.

View file

@ -41,8 +41,6 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.haibison.android.lockpattern.LockPatternActivity;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround; import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
@ -108,20 +106,20 @@ public class PassphraseDialogActivity extends FragmentActivity {
case RESULT_CANCELED: case RESULT_CANCELED:
// The user cancelled the task // The user cancelled the task
break; break;
case LockPatternActivity.RESULT_FAILED: // case LockPatternActivity.RESULT_FAILED:
// The user failed to enter the pattern // // The user failed to enter the pattern
break; // break;
case LockPatternActivity.RESULT_FORGOT_PATTERN: // case LockPatternActivity.RESULT_FORGOT_PATTERN:
// The user forgot the pattern and invoked your recovery Activity. // // The user forgot the pattern and invoked your recovery Activity.
break; // break;
} }
/* /*
* In any case, there's always a key EXTRA_RETRY_COUNT, which holds * In any case, there's always a key EXTRA_RETRY_COUNT, which holds
* the number of tries that the user did. * the number of tries that the user did.
*/ */
int retryCount = data.getIntExtra( // int retryCount = data.getIntExtra(
LockPatternActivity.EXTRA_RETRY_COUNT, 0); // LockPatternActivity.EXTRA_RETRY_COUNT, 0);
break; break;
} }
@ -253,9 +251,9 @@ public class PassphraseDialogActivity extends FragmentActivity {
if (keyType == CanonicalizedSecretKey.SecretKeyType.PATTERN) { if (keyType == CanonicalizedSecretKey.SecretKeyType.PATTERN) {
// start pattern dialog and show progress circle here... // start pattern dialog and show progress circle here...
Intent patternActivity = new Intent(getActivity(), LockPatternActivity.class); // Intent patternActivity = new Intent(getActivity(), LockPatternActivity.class);
patternActivity.putExtra(LockPatternActivity.EXTRA_PATTERN, "123"); // patternActivity.putExtra(LockPatternActivity.EXTRA_PATTERN, "123");
startActivityForResult(patternActivity, REQUEST_CODE_ENTER_PATTERN); // startActivityForResult(patternActivity, REQUEST_CODE_ENTER_PATTERN);
mInput.setVisibility(View.GONE); mInput.setVisibility(View.GONE);
mProgress.setVisibility(View.VISIBLE); mProgress.setVisibility(View.VISIBLE);
} else { } else {

View file

@ -43,10 +43,6 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.haibison.android.lockpattern.LockPatternFragment;
import com.haibison.android.lockpattern.LockPatternFragmentOld;
import com.haibison.android.lockpattern.widget.LockPatternView;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import java.io.IOException; import java.io.IOException;
@ -56,7 +52,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class PassphraseWizardActivity extends FragmentActivity implements LockPatternView.OnPatternListener { public class PassphraseWizardActivity extends FragmentActivity {
//public class PassphraseWizardActivity extends FragmentActivity implements LockPatternView.OnPatternListener {
//create or authenticate //create or authenticate
public String selectedAction; public String selectedAction;
//for lockpattern //for lockpattern
@ -117,10 +114,10 @@ public class PassphraseWizardActivity extends FragmentActivity implements LockPa
getActionBar().setTitle(R.string.draw_lockpattern); getActionBar().setTitle(R.string.draw_lockpattern);
} }
// LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction); // LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction);
LockPatternFragment lpf = LockPatternFragment.newInstance("asd"); // LockPatternFragment lpf = LockPatternFragment.newInstance("asd");
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit(); // transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit();
} }
public void cancel(View view) { public void cancel(View view) {
@ -205,9 +202,9 @@ public class PassphraseWizardActivity extends FragmentActivity implements LockPa
writeNFC = false; //just write once writeNFC = false; //just write once
Toast.makeText(this, R.string.nfc_write_succesful, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.nfc_write_succesful, Toast.LENGTH_SHORT).show();
//advance to lockpattern //advance to lockpattern
LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction); // LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit(); // transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit();
} }
} catch (IOException | FormatException e) { } catch (IOException | FormatException e) {
e.printStackTrace(); e.printStackTrace();
@ -224,9 +221,9 @@ public class PassphraseWizardActivity extends FragmentActivity implements LockPa
//passwort matches, go to next view //passwort matches, go to next view
Toast.makeText(this, R.string.passphrases_match + "!", Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.passphrases_match + "!", Toast.LENGTH_SHORT).show();
LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction); // LockPatternFragmentOld lpf = LockPatternFragmentOld.newInstance(selectedAction);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit(); // transaction.replace(R.id.fragmentContainer, lpf).addToBackStack(null).commit();
readNFC = false; //just once readNFC = false; //just once
} else { } else {
//passwort doesnt match //passwort doesnt match
@ -352,26 +349,6 @@ public class PassphraseWizardActivity extends FragmentActivity implements LockPa
adapter.disableForegroundDispatch(this); adapter.disableForegroundDispatch(this);
} }
@Override
public void onPatternStart() {
}
@Override
public void onPatternCleared() {
}
@Override
public void onPatternCellAdded(List<LockPatternView.Cell> pattern) {
}
@Override
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
}
public static class SelectMethods extends Fragment { public static class SelectMethods extends Fragment {
// private OnFragmentInteractionListener mListener; // private OnFragmentInteractionListener mListener;

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.haibison.android.lockpattern.widget.LockPatternView_v14
android:id="@+id/lockPattern"
android:layout_width="@dimen/alp_42447968_separator_size"
android:layout_height="@dimen/alp_42447968_separator_size"
android:layout_marginTop="@dimen/alp_42447968_separator_size"
android:layout_marginBottom="@dimen/alp_42447968_separator_size"
android:layout_gravity="center_horizontal" />
</LinearLayout>

View file

@ -7,13 +7,12 @@
tools:context="pSontag.testopenkeychain.Passphrase"> tools:context="pSontag.testopenkeychain.Passphrase">
<TableLayout <TableLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TableRow <TableRow android:layout_marginBottom="10dp">
android:layout_marginBottom="10dp">
<TextView <TextView
android:id="@+id/passphraseText" android:id="@+id/passphraseText"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -23,7 +22,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/passphrase" android:text="@string/passphrase"
android:layout_weight="1"/> android:layout_weight="1" />
</TableRow> </TableRow>
<View <View
@ -32,26 +31,29 @@
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<TableRow> <TableRow>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp" android:padding="8dp"
android:layout_weight="1" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/passphrase"/> android:text="@string/passphrase" />
<EditText <EditText
android:id="@+id/passphrase" android:id="@+id/passphrase"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textPassword" android:inputType="textPassword"
android:padding="8dp" android:padding="8dp"
android:layout_weight="6"/> android:layout_weight="6" />
</TableRow> </TableRow>
<TableRow <TableRow
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"> android:layout_marginBottom="10dp">
<TextView <TextView
android:id="@+id/passphraseTextAgain" android:id="@+id/passphraseTextAgain"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -59,7 +61,8 @@
android:padding="8dp" android:padding="8dp"
android:text="@string/passphrase_again" android:text="@string/passphrase_again"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_weight="1"/> android:layout_weight="1" />
<EditText <EditText
android:id="@+id/passphraseAgain" android:id="@+id/passphraseAgain"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -67,10 +70,11 @@
android:inputType="textPassword" android:inputType="textPassword"
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:padding="8dp" android:padding="8dp"
android:layout_weight="6"/> android:layout_weight="6" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dip" android:layout_height="1dip"
@ -80,28 +84,32 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<Button
android:layout_width="wrap_content" <!--<Button-->
android:layout_height="wrap_content" <!--android:layout_width="wrap_content"-->
android:text="Cancel" <!--android:layout_height="wrap_content"-->
android:onClick="cancel" <!--android:text="Cancel"-->
android:layout_weight="1" <!--android:onClick="cancel"-->
android:textAppearance="?android:attr/textAppearanceMedium" <!--android:layout_weight="1"-->
style="?attr/alp_42447968_button_bar_button_style"/> <!--android:textAppearance="?android:attr/textAppearanceMedium"-->
<View <!--style="?attr/alp_42447968_button_bar_button_style" />-->
android:layout_width="1dip"
android:layout_height="50dip" <!--<View-->
android:background="?android:attr/listDivider" /> <!--android:layout_width="1dip"-->
<Button <!--android:layout_height="50dip"-->
android:layout_width="wrap_content" <!--android:background="?android:attr/listDivider" />-->
android:layout_height="wrap_content"
android:text="Ok" <!--<Button-->
android:onClick="savePassphrase" <!--android:layout_width="wrap_content"-->
android:layout_weight="1" <!--android:layout_height="wrap_content"-->
android:textAppearance="?android:attr/textAppearanceMedium" <!--android:text="Ok"-->
style="?attr/alp_42447968_button_bar_button_style"/> <!--android:onClick="savePassphrase"-->
<!--android:layout_weight="1"-->
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
<!--style="?attr/alp_42447968_button_bar_button_style" />-->
</LinearLayout> </LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dip" android:layout_height="1dip"