Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
string improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhamTyagi committed Nov 10, 2019
1 parent e94dc96 commit ea67cf1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/ai/loko/hk/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ protected void onResume() {
Data.BASE_SEARCH_URL = sharedPref.getString(getString(R.string.search_engine_key), "https://www.google.com/search?q=");

Data.GRAYSCALE_IAMGE_FOR_OCR = sharedPref.getBoolean(getString(R.string.grayscale_image_ocr), false);
Data.ENLARGE_IMAGE_FOR_OCR=sharedPref.getBoolean(getString(R.string.enlarge_image_key),false);
Data.ENLARGE_IMAGE_FOR_OCR = sharedPref.getBoolean(getString(R.string.enlarge_image_key), false);

Data.IMAGE_LOGS_STORAGE = sharedPref.getBoolean(getString(R.string.save_image_and_file_to_storage_key), true);
Data.IS_TESSERACT_OCR_USE = sharedPref.getBoolean(getString(R.string.tesseract_key), false);
Expand Down
14 changes: 5 additions & 9 deletions app/src/main/java/ai/loko/hk/ui/activities/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public boolean onPreferenceChange(final Preference preference, Object value) {
mSweetAlertDialogForProgressBar.setTitleText("Downloading Failed").setContentText("You are not connected to Internet").setConfirmText("Ok").changeAlertType(SweetAlertDialog.WARNING_TYPE);
} else if (ni.isConnected()) {
change = true;
new DownloadTrainingTask().execute(Data.TESSERACT_DATA,lang);
new DownloadTrainingTask().execute(Data.TESSERACT_DATA, lang);
} else {
mSweetAlertDialogForProgressBar.setTitleText("Downloading Failed").setContentText("You are not connected to Internet").setConfirmText("Ok").changeAlertType(SweetAlertDialog.WARNING_TYPE);
change = false;
Expand All @@ -116,7 +116,7 @@ public boolean onPreferenceChange(final Preference preference, Object value) {
mSweetAlertDialogForProgressBar.setTitleText("Downloading Failed").setContentText("You are not connected to Internet").setConfirmText("Ok").changeAlertType(SweetAlertDialog.WARNING_TYPE);
} else if (ni.isConnected()) {
change = true;
new DownloadTrainingTask().execute(data,Data.TESSERACT_LANGUAGE);
new DownloadTrainingTask().execute(data, Data.TESSERACT_LANGUAGE);
} else {
mSweetAlertDialogForProgressBar.setTitleText("Downloading Failed").setContentText("You are not connected to Internet").setConfirmText("Ok").changeAlertType(SweetAlertDialog.WARNING_TYPE);
change = false;
Expand Down Expand Up @@ -223,19 +223,19 @@ protected void onPostExecute(Boolean bool) {
@Override
protected Boolean doInBackground(String... languages) {

return downloadTraningData(languages[0],languages[1]);
return downloadTraningData(languages[0], languages[1]);
}

@Override
protected void onProgressUpdate(Integer... values) {

}

private boolean downloadTraningData(String dataSource,String lang) {
private boolean downloadTraningData(String dataSource, String lang) {
boolean result = true;
String downloadURL;
String location;
String destFileName ;
String destFileName;

switch (dataSource) {
case "best":
Expand All @@ -252,7 +252,6 @@ private boolean downloadTraningData(String dataSource,String lang) {
}



URL url, base, next;
HttpURLConnection conn;
try {
Expand Down Expand Up @@ -302,9 +301,6 @@ private boolean downloadTraningData(String dataSource,String lang) {
}





@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class MainPreferenceFragment extends PreferenceFragment {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.IBinder;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
Expand All @@ -57,6 +53,9 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;

import com.dd.processbutton.iml.ActionProcessButton;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -170,7 +169,7 @@ public boolean onTouch(View v, MotionEvent event) {

imageTextReader4 = new ImageTextReader4(getApplicationContext());
String path;
switch (Data.TESSERACT_DATA){
switch (Data.TESSERACT_DATA) {
case "best":
path = Constant.TESSERACT_PATH_BEST;
break;
Expand All @@ -180,7 +179,7 @@ public boolean onTouch(View v, MotionEvent event) {
default:
path = Constant.TESSERACT_PATH_FAST;
}
tesseractImageTextReader4 = TesseractImageTextReader4.geInstance(path,Data.TESSERACT_LANGUAGE);
tesseractImageTextReader4 = TesseractImageTextReader4.geInstance(path, Data.TESSERACT_LANGUAGE);


Display display = getWindowManager().getDefaultDisplay();
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/ai/loko/hk/ui/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

import androidx.annotation.Nullable;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<string name="language_not_exists">Training data for language %s does not exist; cannot do recognition</string>
<string name="fast_mode_key">fast_mode_key</string>
<string name="fast_mode_title">Fast mode for OCR</string>
<string name="fast_mode_summary">When this option is on Trivia Hack will find Answer fast but there may be misbehave by Trivia Hack(Not work when tesseract ocr is used)</string>
<string name="fast_mode_summary">When this option is on Trivia Hack will find Answer fast but there may be misbehave by Trivia Hack(Not work when tesseract ocr is in use)</string>
<string name="d">D:</string>
<string name="option_d">Option D</string>
<string name="enlarge_image_key">enlarge_image_key</string>
Expand Down

0 comments on commit ea67cf1

Please sign in to comment.