From 7a32e25cd21cc0d30c2b75d0a73598ec95486c8b Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 9 Apr 2021 18:04:00 +0800 Subject: [PATCH] update edittext to list --- .../app/src/main/assets/images/{5.jpg => 0.jpg} | Bin .../baidu/paddle/lite/demo/ocr/MiniActivity.java | 2 +- .../paddle/lite/demo/ocr/SettingsActivity.java | 8 ++++---- .../app/src/main/res/menu/menu_action_options.xml | 11 ----------- .../android_demo/app/src/main/res/values/arrays.xml | 12 ++++++++++++ .../app/src/main/res/values/strings.xml | 2 +- .../android_demo/app/src/main/res/xml/settings.xml | 4 +++- 7 files changed, 21 insertions(+), 18 deletions(-) rename deploy/android_demo/app/src/main/assets/images/{5.jpg => 0.jpg} (100%) diff --git a/deploy/android_demo/app/src/main/assets/images/5.jpg b/deploy/android_demo/app/src/main/assets/images/0.jpg similarity index 100% rename from deploy/android_demo/app/src/main/assets/images/5.jpg rename to deploy/android_demo/app/src/main/assets/images/0.jpg diff --git a/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MiniActivity.java b/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MiniActivity.java index c25c6fce..38c98294 100644 --- a/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MiniActivity.java +++ b/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MiniActivity.java @@ -131,7 +131,7 @@ public class MiniActivity extends AppCompatActivity { */ private boolean onRunModel() { try { - String assetImagePath = "images/5.jpg"; + String assetImagePath = "images/0.jpg"; InputStream imageStream = getAssets().open(assetImagePath); Bitmap image = BitmapFactory.decodeStream(imageStream); // Input is Bitmap diff --git a/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/SettingsActivity.java b/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/SettingsActivity.java index b3653ccc..c26fe6ea 100644 --- a/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/SettingsActivity.java +++ b/deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/SettingsActivity.java @@ -17,7 +17,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha CheckBoxPreference cbEnableCustomSettings = null; EditTextPreference etModelPath = null; EditTextPreference etLabelPath = null; - EditTextPreference etImagePath = null; + ListPreference etImagePath = null; ListPreference lpCPUThreadNum = null; ListPreference lpCPUPowerMode = null; ListPreference lpInputColorFormat = null; @@ -84,7 +84,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha etModelPath = (EditTextPreference) findPreference(getString(R.string.MODEL_PATH_KEY)); etModelPath.setTitle("Model Path (SDCard: " + Utils.getSDCardDirectory() + ")"); etLabelPath = (EditTextPreference) findPreference(getString(R.string.LABEL_PATH_KEY)); - etImagePath = (EditTextPreference) findPreference(getString(R.string.IMAGE_PATH_KEY)); + etImagePath = (ListPreference) findPreference(getString(R.string.IMAGE_PATH_KEY)); lpCPUThreadNum = (ListPreference) findPreference(getString(R.string.CPU_THREAD_NUM_KEY)); lpCPUPowerMode = @@ -119,7 +119,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha editor.putString(getString(R.string.INPUT_STD_KEY), preInstalledInputStds.get(modelIdx)); editor.putString(getString(R.string.SCORE_THRESHOLD_KEY), preInstalledScoreThresholds.get(modelIdx)); - editor.commit(); + editor.apply(); } lpChoosePreInstalledModel.setSummary(modelPath); } @@ -159,7 +159,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha etLabelPath.setSummary(labelPath); etLabelPath.setText(labelPath); etImagePath.setSummary(imagePath); - etImagePath.setText(imagePath); + etImagePath.setValue(imagePath); lpCPUThreadNum.setValue(cpuThreadNum); lpCPUThreadNum.setSummary(cpuThreadNum); lpCPUPowerMode.setValue(cpuPowerMode); diff --git a/deploy/android_demo/app/src/main/res/menu/menu_action_options.xml b/deploy/android_demo/app/src/main/res/menu/menu_action_options.xml index fe74758a..049bd7ec 100644 --- a/deploy/android_demo/app/src/main/res/menu/menu_action_options.xml +++ b/deploy/android_demo/app/src/main/res/menu/menu_action_options.xml @@ -1,16 +1,5 @@ - - - - - + + 0.jpg + 90.jpg + 180.jpg + 270.jpg + + + images/0.jpg + images/90.jpg + images/180.jpg + images/270.jpg + 1 threads 2 threads diff --git a/deploy/android_demo/app/src/main/res/values/strings.xml b/deploy/android_demo/app/src/main/res/values/strings.xml index 473c8f6a..0228af09 100644 --- a/deploy/android_demo/app/src/main/res/values/strings.xml +++ b/deploy/android_demo/app/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ SCORE_THRESHOLD_KEY models/ocr_v2_for_cpu labels/ppocr_keys_v1.txt - images/5.jpg + images/0.jpg 4 LITE_POWER_HIGH BGR diff --git a/deploy/android_demo/app/src/main/res/xml/settings.xml b/deploy/android_demo/app/src/main/res/xml/settings.xml index 440f3e47..049727e8 100644 --- a/deploy/android_demo/app/src/main/res/xml/settings.xml +++ b/deploy/android_demo/app/src/main/res/xml/settings.xml @@ -21,9 +21,11 @@ android:key="@string/LABEL_PATH_KEY" android:defaultValue="@string/LABEL_PATH_DEFAULT" android:title="Label Path" /> - -- GitLab