<commit_before>package com.renard.plugin;

import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;

import com.googlecode.leptonica.android.Pix;
import com.renard.ocr.LayoutQuestionDialog;
import com.renard.ocr.OCRActivity;
import com.renard.util.Screen;

import java.io.File;
import java.io.IOException;

/**
 * Created by ganymed on 18/08/15.
 */
public class PluginOCRActivity extends OCRActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  }

  @Override
  protected void readingDocumentDone(Pix pix, String hocrString, String utf8String, int accuracy) {
    OcrResultDispatcher.ocrRecognitionSuccessful(this, hocrString, utf8String, accuracy);

    cleanupDialog(pix);
    finish();
  }

  protected void cleanupDialog(Pix pix) {
    recycleResultPix(pix);
    Screen.unlockOrientation(this);
  }

  @Override
  protected void proceedToNextActivity() {
    // nothing to do here, we simply return to PluginStartActivity
  }

  @Override
  protected void askUserAboutDocumentLayout(Pix pixOrg, boolean accessibility) {
    // TODO: just set layout properties and continue to read text
    String ocrLanguage = "deu";
    LayoutQuestionDialog.LayoutKind layoutKind = LayoutQuestionDialog.LayoutKind.SIMPLE;

    startOcrLayoutAnalysis(pixOrg, ocrLanguage, layoutKind);
  }

  // avoid saving documents / images

  @Override
  protected void saveDocument(Pix pix, String hocrString, String utf8String, int accuracy) {

  }

  // these to methods may can be removed
  @Override
  protected Uri saveDocumentToDB(File imageFile, String hocr, String plainText) throws RemoteException {
    return null;
  }

  @Override
  protected File saveImage(Pix p) throws IOException {
    return null;
  }
}<commit_msg>PluginOCRActivity now uses selected values for language and layout<commit_after>package com.renard.plugin;

import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;

import com.googlecode.leptonica.android.Pix;
import com.renard.ocr.OCRActivity;
import com.renard.util.PreferencesUtils;
import com.renard.util.Screen;

import java.io.File;
import java.io.IOException;

/**
 * Created by ganymed on 18/08/15.
 */
public class PluginOCRActivity extends OCRActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  }

  @Override
  protected void readingDocumentDone(Pix pix, String hocrString, String utf8String, int accuracy) {
    OcrResultDispatcher.ocrRecognitionSuccessful(this, hocrString, utf8String, accuracy);

    cleanupDialog(pix);
    finish();
  }

  protected void cleanupDialog(Pix pix) {
    recycleResultPix(pix);
    Screen.unlockOrientation(this);
  }

  @Override
  protected void proceedToNextActivity() {
    // nothing to do here, we simply return to PluginStartActivity
  }

  @Override
  protected void askUserAboutDocumentLayout(Pix pixOrg, boolean accessibility) {
    startOcrLayoutAnalysis(pixOrg, PreferencesUtils.getPluginLastSelectedOCRLanguage(this), PreferencesUtils.getPluginLastSelectedLayoutKind(this));
  }

  // avoid saving documents / images

  @Override
  protected void saveDocument(Pix pix, String hocrString, String utf8String, int accuracy) {

  }

  // these to methods may can be removed
  @Override
  protected Uri saveDocumentToDB(File imageFile, String hocr, String plainText) throws RemoteException {
    return null;
  }

  @Override
  protected File saveImage(Pix p) throws IOException {
    return null;
  }
}
{'fraction_non_alphanumeric': 0.08150646430578977, 'fraction_numerical': 0.00505902192242833, 'mean_word_length': 4.543613707165109, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6538384', 'n_tokens_mistral': 1073, 'n_tokens_neox': 993, 'n_words': 276}