diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt index a948e91427..d94bac6ee4 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt @@ -30,7 +30,6 @@ import net.gini.android.bank.sdk.pay.getBusinessIntent import net.gini.android.bank.sdk.pay.getRequestId import net.gini.android.bank.sdk.util.parseAmountToBackendFormat import net.gini.android.capture.* -import net.gini.android.capture.analysis.AnalysisActivity import net.gini.android.capture.onboarding.view.ImageOnboardingIllustrationAdapter import net.gini.android.capture.onboarding.view.OnboardingIllustrationAdapter import net.gini.android.capture.requirements.GiniCaptureRequirements @@ -260,42 +259,49 @@ object GiniBank { resultLauncher.launch(Unit) } - fun createCaptureFlowFragment(): CaptureFlowFragment - { + fun createCaptureFlowFragment(): CaptureFlowFragment { check(giniCapture != null) { "Capture feature is not configured. Call setCaptureConfiguration before starting the flow." } return CaptureFlowFragment.createInstance() } - fun createCaptureFlowFragmentForIntent(context: Context, intent: Intent, callback: (CreateCaptureFlowFragmentForIntentResult) -> Unit): CancellationToken { + fun createCaptureFlowFragmentForIntent( + context: Context, + intent: Intent, + callback: (CreateCaptureFlowFragmentForIntentResult) -> Unit + ): CancellationToken { check(giniCapture != null) { "Capture feature is not configured. Call setCaptureConfiguration before starting the flow." } - return giniCapture!!.createIntentForImportedFiles(intent, context, object: AsyncCallback { - override fun onSuccess(result: Intent) { - when(result.component?.className) { - // Since version 3.x the SDK always goes to the analysis screen for "open with" files - AnalysisActivity::class.java.name -> { - callback(CreateCaptureFlowFragmentForIntentResult.Success( - CaptureFlowFragment.createInstance(result))) - } - else -> callback(CreateCaptureFlowFragmentForIntentResult.Error(ImportedFileValidationException("Unknown activity class: ${result.component?.className}"))) + return giniCapture!!.createDocumentForImportedFiles( + intent, + context, + object : AsyncCallback { + override fun onSuccess(document: Document) { + callback( + CreateCaptureFlowFragmentForIntentResult.Success( + CaptureFlowFragment.createInstance(document) + ) + ) } - } - override fun onError(exception: ImportedFileValidationException) { - callback(CreateCaptureFlowFragmentForIntentResult.Error(exception)) - } + override fun onError(exception: ImportedFileValidationException) { + callback(CreateCaptureFlowFragmentForIntentResult.Error(exception)) + } - override fun onCancelled() { - callback(CreateCaptureFlowFragmentForIntentResult.Cancelled) - } + override fun onCancelled() { + callback(CreateCaptureFlowFragmentForIntentResult.Cancelled) + } - }) + }) } sealed class CreateCaptureFlowFragmentForIntentResult { - data class Success(val fragment: CaptureFlowFragment): CreateCaptureFlowFragmentForIntentResult() - data class Error(val exception: ImportedFileValidationException): CreateCaptureFlowFragmentForIntentResult() - object Cancelled: CreateCaptureFlowFragmentForIntentResult() + data class Success(val fragment: CaptureFlowFragment) : + CreateCaptureFlowFragmentForIntentResult() + + data class Error(val exception: ImportedFileValidationException) : + CreateCaptureFlowFragmentForIntentResult() + + object Cancelled : CreateCaptureFlowFragmentForIntentResult() } /** diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/CaptureFlowFragment.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/CaptureFlowFragment.kt index d0f5587abc..a73afa606e 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/CaptureFlowFragment.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/CaptureFlowFragment.kt @@ -24,13 +24,13 @@ import net.gini.android.capture.camera.CameraFragmentListener import net.gini.android.capture.network.model.GiniCaptureCompoundExtraction import net.gini.android.capture.network.model.GiniCaptureSpecificExtraction -class CaptureFlowFragment(private val analysisIntent: Intent? = null) : +class CaptureFlowFragment(private val openWithDocument: Document? = null) : Fragment(), GiniCaptureFragmentListener, DigitalInvoiceFragmentListener { internal companion object { - fun createInstance(intent: Intent? = null): CaptureFlowFragment { - return CaptureFlowFragment(intent) + fun createInstance(openWithDocument: Document? = null): CaptureFlowFragment { + return CaptureFlowFragment(openWithDocument) } } @@ -64,7 +64,7 @@ class CaptureFlowFragment(private val analysisIntent: Intent? = null) : override fun onCreate(savedInstanceState: Bundle?) { - childFragmentManager.fragmentFactory = CaptureFlowFragmentFactory(this, analysisIntent, this) + childFragmentManager.fragmentFactory = CaptureFlowFragmentFactory(this, openWithDocument, this) super.onCreate(savedInstanceState) } @@ -151,12 +151,12 @@ interface CaptureFlowFragmentListener { class CaptureFlowFragmentFactory( private val giniCaptureFragmentListener: GiniCaptureFragmentListener, - private val analysisIntent: Intent? = null, + private val openWithDocument: Document? = null, private val digitalInvoiceListener: DigitalInvoiceFragmentListener ) : FragmentFactory() { override fun instantiate(classLoader: ClassLoader, className: String): Fragment { return when (className) { - GiniCaptureFragment::class.java.name -> GiniCaptureFragment(analysisIntent) + GiniCaptureFragment::class.java.name -> GiniCaptureFragment(openWithDocument) .apply { setListener( giniCaptureFragmentListener diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCapture.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCapture.java index bae75c3282..bd05035e94 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCapture.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCapture.java @@ -7,7 +7,6 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import net.gini.android.capture.analysis.AnalysisActivity; import net.gini.android.capture.camera.view.CameraNavigationBarBottomAdapter; import net.gini.android.capture.camera.view.DefaultCameraNavigationBarBottomAdapter; import net.gini.android.capture.help.HelpItem; @@ -514,7 +513,14 @@ public boolean isFlashOnByDefault() { */ @NonNull public CancellationToken createIntentForImportedFiles(@NonNull final Intent intent, @NonNull final Context context, @NonNull final AsyncCallback callback) { - return mGiniCaptureFileImport.createIntentForImportedFiles(intent, context, callback); + //return mGiniCaptureFileImport.createIntentForImportedFiles(intent, context, callback); + //TODO fix this when fixing CameraActivity + return null; + } + + @NonNull + public CancellationToken createDocumentForImportedFiles(@NonNull final Intent intent, @NonNull final Context context, @NonNull final AsyncCallback callback) { + return mGiniCaptureFileImport.createDocumentForImportedFiles(intent, context, callback); } /** @@ -665,14 +671,11 @@ public static GiniCaptureFragment createGiniCaptureFragment() { } public CancellationToken createGiniCaptureFragmentForIntent(Context context, Intent intent, GiniCaptureIntentCallback captureIntentCallback) { - return createIntentForImportedFiles(intent, context, new AsyncCallback() { + return createDocumentForImportedFiles(intent, context, new AsyncCallback() { @Override - public void onSuccess(Intent result) { - if (result.getComponent().getClassName().equals(AnalysisActivity.class.getName())) { + public void onSuccess(Document result) { + // TODO please refactor this piece captureIntentCallback.callback(new CreateCaptureFlowFragmentForIntentResult.Success(GiniCaptureFragment.Companion.createInstance(result))); - } else { - captureIntentCallback.callback(new CreateCaptureFlowFragmentForIntentResult.Error(new ImportedFileValidationException("Unknown activity class: ${result.component?.className}"))); - } } @Override diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFileImport.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFileImport.java index 9db9c03d15..2280e608bd 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFileImport.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFileImport.java @@ -1,18 +1,16 @@ package net.gini.android.capture; -import static net.gini.android.capture.internal.util.FileImportValidator.FILE_SIZE_LIMIT; - import android.content.Context; import android.content.Intent; import android.net.Uri; -import net.gini.android.capture.analysis.AnalysisActivity; +import androidx.annotation.NonNull; + import net.gini.android.capture.document.DocumentFactory; import net.gini.android.capture.document.ImageMultiPageDocument; import net.gini.android.capture.internal.util.DeviceHelper; import net.gini.android.capture.internal.util.FileImportValidator; import net.gini.android.capture.internal.util.MimeType; -import net.gini.android.capture.review.multipage.MultiPageReviewActivity; import net.gini.android.capture.util.CancellationToken; import net.gini.android.capture.util.IntentHelper; import net.gini.android.capture.util.NoOpCancellationToken; @@ -20,8 +18,7 @@ import java.util.List; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +import static net.gini.android.capture.internal.util.FileImportValidator.FILE_SIZE_LIMIT; /** * This class contains methods for preparing launching the Gini Capture SDK with a file received @@ -32,22 +29,6 @@ public final class GiniCaptureFileImport { @NonNull private final GiniCapture mGiniCapture; - @NonNull - private static Intent createIntentForMultiPageDocument(@NonNull final Context context, - final Document document) { - final Intent giniCaptureIntent; - if (document.isReviewable()) { - // The new ImageMultiPageDocument was already added to the memory store - giniCaptureIntent = MultiPageReviewActivity.createIntent(context, false); - } else { - giniCaptureIntent = new Intent(context, AnalysisActivity.class); - giniCaptureIntent.putExtra(AnalysisActivity.EXTRA_IN_DOCUMENT, document); - giniCaptureIntent.setExtrasClassLoader(GiniCaptureFileImport.class.getClassLoader()); - } - - return giniCaptureIntent; - } - @NonNull private static Document createDocumentForImportedFile(@NonNull final Intent intent, @NonNull final Context context) throws ImportedFileValidationException { @@ -79,35 +60,6 @@ private static Document createDocumentForImportedFile(@NonNull final Intent inte mGiniCapture = giniCapture; } - CancellationToken createIntentForImportedFiles(@NonNull final Intent intent, - @NonNull final Context context, - @NonNull final AsyncCallback callback) { - final CancellationToken cancellationToken = - createDocumentForImportedFiles(intent, context, - new AsyncCallback() { - @Override - public void onSuccess(final Document result) { - final Intent giniCaptureIntent = createIntentForMultiPageDocument(context, result); - callback.onSuccess(giniCaptureIntent); - } - - @Override - public void onError(final ImportedFileValidationException exception) { - callback.onError(exception); - } - - @Override - public void onCancelled() { - callback.onCancelled(); - } - }); - return new CancellationToken() { - @Override - public void cancel() { - cancellationToken.cancel(); - } - }; - } CancellationToken createDocumentForImportedFiles(@NonNull final Intent intent, @NonNull final Context context, diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFragment.kt b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFragment.kt index 5caf198c66..905d48e411 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFragment.kt +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/GiniCaptureFragment.kt @@ -1,6 +1,5 @@ package net.gini.android.capture -import android.content.Intent import android.os.Bundle import android.util.Log import android.view.LayoutInflater @@ -10,9 +9,8 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentFactory import androidx.navigation.NavController import androidx.navigation.fragment.findNavController -import net.gini.android.capture.analysis.AnalysisActivity import net.gini.android.capture.analysis.AnalysisFragment -import net.gini.android.capture.analysis.AnalysisFragmentCompatDirections +import net.gini.android.capture.analysis.AnalysisFragmentDirections import net.gini.android.capture.analysis.AnalysisFragmentListener import net.gini.android.capture.camera.CameraFragment import net.gini.android.capture.camera.CameraFragmentDirections @@ -30,7 +28,7 @@ import net.gini.android.capture.review.multipage.MultiPageReviewFragment import net.gini.android.capture.review.multipage.MultiPageReviewFragmentDirections import net.gini.android.capture.review.multipage.MultiPageReviewFragmentListener -class GiniCaptureFragment(private val analysisIntent: Intent? = null) : +class GiniCaptureFragment(private val openWithDocument: Document? = null) : Fragment(), CameraFragmentListener, MultiPageReviewFragmentListener, @@ -38,8 +36,8 @@ class GiniCaptureFragment(private val analysisIntent: Intent? = null) : EnterManuallyButtonListener { internal companion object { - fun createInstance(intent: Intent? = null): GiniCaptureFragment { - return GiniCaptureFragment(intent) + fun createInstance(document: Document? = null): GiniCaptureFragment { + return GiniCaptureFragment(document) } } @@ -71,12 +69,11 @@ class GiniCaptureFragment(private val analysisIntent: Intent? = null) : super.onViewCreated(view, savedInstanceState) navController = (childFragmentManager.fragments[0]).findNavController() oncePerInstallEventStore = OncePerInstallEventStore(requireContext()) - if (analysisIntent != null) { + if (openWithDocument != null) { navController.navigate( CameraFragmentDirections.toAnalysisFragment( - analysisIntent.getParcelableExtra( - AnalysisActivity.EXTRA_IN_DOCUMENT - )!!, "" + openWithDocument, + "" ) ) } else { @@ -207,7 +204,7 @@ class GiniCaptureFragment(private val analysisIntent: Intent? = null) : override fun onProceedToNoExtractionsScreen(document: Document) { NoResultsFragment.navigateToNoResultsFragment( navController, - AnalysisFragmentCompatDirections.toNoResultsFragment(document) + AnalysisFragmentDirections.toNoResultsFragment(document) ) } diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisActivity.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisActivity.java deleted file mode 100644 index 37fd190916..0000000000 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisActivity.java +++ /dev/null @@ -1,249 +0,0 @@ -package net.gini.android.capture.analysis; - -import android.content.Intent; -import android.os.Bundle; -import android.view.MenuItem; - -import androidx.activity.OnBackPressedCallback; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; -import androidx.appcompat.app.AppCompatActivity; - -import net.gini.android.capture.Document; -import net.gini.android.capture.GiniCapture; -import net.gini.android.capture.GiniCaptureError; -import net.gini.android.capture.R; -import net.gini.android.capture.camera.CameraActivity; -import net.gini.android.capture.network.model.GiniCaptureCompoundExtraction; -import net.gini.android.capture.network.model.GiniCaptureReturnReason; -import net.gini.android.capture.network.model.GiniCaptureSpecificExtraction; -import net.gini.android.capture.tracking.AnalysisScreenEvent; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static net.gini.android.capture.camera.CameraActivity.RESULT_CAMERA_SCREEN; -import static net.gini.android.capture.camera.CameraActivity.RESULT_ENTER_MANUALLY; -import static net.gini.android.capture.internal.util.ActivityHelper.enableHomeAsUp; -import static net.gini.android.capture.internal.util.ActivityHelper.interceptOnBackPressed; -import static net.gini.android.capture.tracking.EventTrackingHelper.trackAnalysisScreenEvent; - -/** - * Internal use only. - */ -public class AnalysisActivity extends AppCompatActivity implements - AnalysisFragmentListener, AnalysisFragmentInterface { - - /** - * Internal use only. - * - * @suppress - */ - public static final String EXTRA_IN_DOCUMENT = "GC_EXTRA_IN_DOCUMENT"; - /** - * Internal use only. - * - * @suppress - */ - public static final String EXTRA_IN_DOCUMENT_ANALYSIS_ERROR_MESSAGE = - "GC_EXTRA_IN_DOCUMENT_ANALYSIS_ERROR_MESSAGE"; - /** - * Internal use only. - * - * @suppress - */ - public static final String EXTRA_OUT_ERROR = "GC_EXTRA_OUT_ERROR"; - - /** - * Internal use only. - * - * @suppress - */ - public static final int RESULT_ERROR = RESULT_FIRST_USER + 1; - - /** - * Internal use only. - * - * @suppress - */ - public static final int RESULT_NO_EXTRACTIONS = RESULT_FIRST_USER + 2; - - /** - * Internal use only. - * - * @suppress - */ - private static final int NO_RESULT_REQUEST = 999; - - /** - * Internal use only. - * - * @suppress - */ - private static final String ANALYSIS_FRAGMENT = "ANALYSIS_FRAGMENT"; - - private String mAnalysisErrorMessage; - private Document mDocument; - private AnalysisFragment mFragment; - - @Override - protected void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.gc_activity_analysis); - setTitle(""); - readExtras(); - if (savedInstanceState == null) { - initFragment(); - } else { - retainFragment(); - } - enableHomeAsUp(this); - handleOnBackPressed(); - } - - private void handleOnBackPressed() { - interceptOnBackPressed(this, new OnBackPressedCallback(true) { - @Override - public void handleOnBackPressed() { - trackAnalysisScreenEvent(AnalysisScreenEvent.CANCEL); - } - }); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - clearMemory(); - } - - @Override - public void onError(@NonNull final GiniCaptureError error) { - final Intent result = new Intent(); - result.putExtra(EXTRA_OUT_ERROR, error); - setResult(RESULT_ERROR, result); - finish(); - } - - @Override - public boolean onOptionsItemSelected(final MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - return super.onOptionsItemSelected(item); - } - - @VisibleForTesting - AnalysisFragment getFragment() { - return mFragment; - } - - private void checkRequiredExtras() { - if (mDocument == null) { - throw new IllegalStateException( - "AnalysisActivity requires a Document. Set it as an extra using the " - + "EXTRA_IN_DOCUMENT key."); - } - } - - private void clearMemory() { - mDocument = null; // NOPMD - } - - private void createFragment() { - mFragment = AnalysisFragment.createInstance(mDocument, mAnalysisErrorMessage); - } - - private void initFragment() { - if (!isFragmentShown()) { - createFragment(); - showFragment(); - } - } - - private boolean isFragmentShown() { - return getSupportFragmentManager().findFragmentByTag(ANALYSIS_FRAGMENT) != null; - } - - private void readExtras() { - final Bundle extras = getIntent().getExtras(); - if (extras != null) { - mDocument = extras.getParcelable(EXTRA_IN_DOCUMENT); - mAnalysisErrorMessage = extras.getString(EXTRA_IN_DOCUMENT_ANALYSIS_ERROR_MESSAGE); - } - checkRequiredExtras(); - } - - private void retainFragment() { - mFragment = (AnalysisFragment) getSupportFragmentManager().findFragmentByTag( - ANALYSIS_FRAGMENT); - } - - private void showFragment() { - getSupportFragmentManager().beginTransaction().add(R.id.gc_fragment_analyze_document, - mFragment, ANALYSIS_FRAGMENT).commit(); - } - - @Override - public void setListener(@NonNull final AnalysisFragmentListener listener) { - throw new IllegalStateException("AnalysisFragmentListener must not be altered in the " - + "AnalysisActivity. Override listener methods in an AnalysisActivity subclass " - + "instead."); - } - - @Override - public void onExtractionsAvailable( - @NonNull final Map extractions, - @NonNull final Map compoundExtractions, - @NonNull final List returnReasons) { - final Intent result = new Intent(); - - final Bundle extractionsBundle = new Bundle(); - for (final Map.Entry extraction - : extractions.entrySet()) { - extractionsBundle.putParcelable(extraction.getKey(), extraction.getValue()); - } - result.putExtra(CameraActivity.EXTRA_OUT_EXTRACTIONS, extractionsBundle); - - final Bundle compoundExtractionsBundle = new Bundle(); - for (final Map.Entry extraction - : compoundExtractions.entrySet()) { - compoundExtractionsBundle.putParcelable(extraction.getKey(), extraction.getValue()); - } - result.putExtra(CameraActivity.EXTRA_OUT_COMPOUND_EXTRACTIONS, compoundExtractionsBundle); - - ArrayList returnReasonsExtra = new ArrayList<>(returnReasons); - result.putParcelableArrayListExtra(CameraActivity.EXTRA_OUT_RETURN_REASONS, returnReasonsExtra); - - setResult(RESULT_OK, result); - finish(); - clearMemory(); - } - - @Override - public void onProceedToNoExtractionsScreen(@NonNull final Document document) { - - } - - @Override - public void onDefaultPDFAppAlertDialogCancelled() { - finish(); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if ((requestCode == NO_RESULT_REQUEST) && - ((resultCode == RESULT_CANCELED && data != null) || resultCode == RESULT_ENTER_MANUALLY || resultCode == RESULT_CAMERA_SCREEN)) { - if (resultCode == RESULT_CAMERA_SCREEN) { - if (GiniCapture.hasInstance()) { - GiniCapture.getInstance().internal().getImageMultiPageDocumentMemoryStore().clear(); - } - } - setResult(resultCode, data); - } - - finish(); - } -} diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisFragmentImpl.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisFragmentImpl.java index 7aabce684c..397f9fd66d 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisFragmentImpl.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/analysis/AnalysisFragmentImpl.java @@ -44,7 +44,7 @@ import static net.gini.android.capture.internal.util.ActivityHelper.forcePortraitOrientationOnPhones; /** - * Main logic implementation for analysis UI presented by {@link AnalysisActivity} + * Main logic implementation for analysis UI presented by {@link AnalysisFragment} */ class AnalysisFragmentImpl extends AnalysisScreenContract.View { @@ -165,7 +165,7 @@ void showHints(final List hints) { void showError(String error, Document document) { ErrorFragment.Companion.navigateToErrorFragment( mFragment.findNavController(), - AnalysisFragmentCompatDirections.toErrorFragmentWithErrorMessage(error, document) + AnalysisFragmentDirections.toErrorFragmentWithErrorMessage(error, document) ); } @@ -173,7 +173,7 @@ void showError(String error, Document document) { void showError(ErrorType errorType, Document document) { ErrorFragment.Companion.navigateToErrorFragment( mFragment.findNavController(), - AnalysisFragmentCompatDirections.toErrorFragmentWithErrorType(errorType, document) + AnalysisFragmentDirections.toErrorFragmentWithErrorType(errorType, document) ); } diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraActivity.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraActivity.java index cd1539b2d3..11c93fcd82 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraActivity.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/camera/CameraActivity.java @@ -16,7 +16,6 @@ import net.gini.android.capture.GiniCapture; import net.gini.android.capture.GiniCaptureError; import net.gini.android.capture.R; -import net.gini.android.capture.analysis.AnalysisActivity; import net.gini.android.capture.document.GiniCaptureMultiPageDocument; import net.gini.android.capture.document.QRCodeDocument; import net.gini.android.capture.internal.util.ContextHelper; @@ -230,7 +229,7 @@ public boolean onOptionsItemSelected(final MenuItem item) { @Override public void onProceedToAnalysisScreen(@NonNull final Document document) { - startAnalysisActivity(document); + } @Override @@ -265,13 +264,6 @@ public void onCheckImportedDocument(@NonNull final Document document, callback.documentAccepted(); } - private void startAnalysisActivity(@NonNull final Document document) { - final Intent analysisIntent = new Intent(this, AnalysisActivity.class); - analysisIntent.putExtra(AnalysisActivity.EXTRA_IN_DOCUMENT, document); - analysisIntent.setExtrasClassLoader(CameraActivity.class.getClassLoader()); - startActivityForResult(analysisIntent, ANALYSE_DOCUMENT_REQUEST); - } - @Override public void onError(@NonNull final GiniCaptureError error) { final Intent result = new Intent(); diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewActivity.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewActivity.java index 86ec3d9ea8..18ed2204ae 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewActivity.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewActivity.java @@ -13,7 +13,6 @@ import net.gini.android.capture.GiniCaptureError; import net.gini.android.capture.R; -import net.gini.android.capture.analysis.AnalysisActivity; import net.gini.android.capture.camera.CameraActivity; import net.gini.android.capture.document.GiniCaptureMultiPageDocument; import net.gini.android.capture.tracking.ReviewScreenEvent; @@ -163,10 +162,7 @@ public void onProceedToAnalysisScreen( if (documents.isEmpty()) { return; } - final Intent intent = new Intent(this, AnalysisActivity.class); - intent.putExtra(AnalysisActivity.EXTRA_IN_DOCUMENT, multiPageDocument); - intent.setExtrasClassLoader(MultiPageReviewActivity.class.getClassLoader()); - startActivityForResult(intent, ANALYSE_DOCUMENT_REQUEST); + } @Override diff --git a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragmentListener.java b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragmentListener.java index d9fe6237dd..dcf8514d36 100644 --- a/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragmentListener.java +++ b/capture-sdk/sdk/src/main/java/net/gini/android/capture/review/multipage/MultiPageReviewFragmentListener.java @@ -1,14 +1,13 @@ package net.gini.android.capture.review.multipage; +import androidx.annotation.NonNull; + import net.gini.android.capture.Document; import net.gini.android.capture.GiniCaptureError; -import net.gini.android.capture.analysis.AnalysisActivity; import net.gini.android.capture.analysis.AnalysisFragment; import net.gini.android.capture.camera.CameraFragment; import net.gini.android.capture.document.GiniCaptureMultiPageDocument; -import androidx.annotation.NonNull; - /** * Created by Alpar Szotyori on 07.05.2018. * @@ -26,8 +25,7 @@ public interface MultiPageReviewFragmentListener { /** * Called when all pages were uploaded successfully and the user tapped on the "next" button. * - *

If you use the Screen API you should start the {@link AnalysisActivity} and set the - * document as the {@link AnalysisActivity#EXTRA_IN_DOCUMENT} extra. + *

If you use the Screen API you should start the {@link AnalysisFragment} and * *

If you use the Component API you should start the {@link AnalysisFragment} * and pass the document when creating it with {@link