better onActivityResult handling for qr code import, remove unimplemented import button

This commit is contained in:
Dominik Schürmann 2014-01-18 21:20:20 +01:00
parent f3638d5b44
commit 1c5acc9721
3 changed files with 25 additions and 33 deletions

View File

@ -37,13 +37,13 @@
bootstrapbutton:bb_icon_left="fa-download" bootstrapbutton:bb_icon_left="fa-download"
bootstrapbutton:bb_type="info" /> bootstrapbutton:bb_type="info" />
<com.beardedhen.androidbootstrap.BootstrapButton <!-- <com.beardedhen.androidbootstrap.BootstrapButton -->
android:id="@+id/import_sign_and_upload" <!-- android:id="@+id/import_sign_and_upload" -->
android:layout_width="match_parent" <!-- android:layout_width="match_parent" -->
android:layout_height="60dp" <!-- android:layout_height="60dp" -->
android:padding="4dp" <!-- android:padding="4dp" -->
android:text="@string/import_sign_and_upload" <!-- android:text="@string/import_sign_and_upload" -->
bootstrapbutton:bb_type="info" /> <!-- bootstrapbutton:bb_type="info" /> -->
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout

View File

@ -79,7 +79,8 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
Fragment mCurrentFragment; Fragment mCurrentFragment;
BootstrapButton mImportButton; BootstrapButton mImportButton;
BootstrapButton mImportSignUploadButton;
// BootstrapButton mImportSignUploadButton;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -94,13 +95,13 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
importKeys(); importKeys();
} }
}); });
mImportSignUploadButton = (BootstrapButton) findViewById(R.id.import_sign_and_upload); // mImportSignUploadButton = (BootstrapButton) findViewById(R.id.import_sign_and_upload);
mImportSignUploadButton.setOnClickListener(new OnClickListener() { // mImportSignUploadButton.setOnClickListener(new OnClickListener() {
@Override // @Override
public void onClick(View v) { // public void onClick(View v) {
signAndUploadOnClick(); // signAndUploadOnClick();
} // }
}); // });
getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);
@ -300,15 +301,6 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
// } // }
// } // }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// required for qr code scanning
if (mCurrentFragment != null) {
mCurrentFragment.onActivityResult(requestCode, resultCode, data);
}
// super.onActivityResult(requestCode, resultCode, data);
}
/** /**
* Import keys with mImportData * Import keys with mImportData
*/ */
@ -419,14 +411,14 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
importKeys(); importKeys();
} }
public void signAndUploadOnClick() { // public void signAndUploadOnClick() {
// first, import! // // first, import!
// importOnClick(view); // // importOnClick(view);
//
// TODO: implement sign and upload! // // TODO: implement sign and upload!
Toast.makeText(ImportKeysActivity.this, "Not implemented right now!", Toast.LENGTH_SHORT) // Toast.makeText(ImportKeysActivity.this, "Not implemented right now!", Toast.LENGTH_SHORT)
.show(); // .show();
} // }
/** /**
* NFC * NFC

View File

@ -91,7 +91,7 @@ public class ImportKeysQrCodeFragment extends Fragment {
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) { switch (requestCode & 0xFFFF) {
case IntentIntegrator.REQUEST_CODE: { case IntentIntegrator.REQUEST_CODE: {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode,
data); data);