提交 7a32e25c 编写于 作者: W WenmuZhou

update edittext to list

上级 6a160e97
......@@ -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
......
......@@ -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);
......
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:id="@+id/pick_image">
<item
android:id="@+id/open_gallery"
android:title="Open Gallery"
app:showAsAction="withText"/>
<item
android:id="@+id/take_photo"
android:title="Take Photo"
app:showAsAction="withText"/>
</group>
<group>
<item
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="image_name_entries">
<item>0.jpg</item>
<item>90.jpg</item>
<item>180.jpg</item>
<item>270.jpg</item>
</string-array>
<string-array name="image_name_values">
<item>images/0.jpg</item>
<item>images/90.jpg</item>
<item>images/180.jpg</item>
<item>images/270.jpg</item>
</string-array>
<string-array name="cpu_thread_num_entries">
<item>1 threads</item>
<item>2 threads</item>
......
......@@ -14,7 +14,7 @@
<string name="SCORE_THRESHOLD_KEY">SCORE_THRESHOLD_KEY</string>
<string name="MODEL_PATH_DEFAULT">models/ocr_v2_for_cpu</string>
<string name="LABEL_PATH_DEFAULT">labels/ppocr_keys_v1.txt</string>
<string name="IMAGE_PATH_DEFAULT">images/5.jpg</string>
<string name="IMAGE_PATH_DEFAULT">images/0.jpg</string>
<string name="CPU_THREAD_NUM_DEFAULT">4</string>
<string name="CPU_POWER_MODE_DEFAULT">LITE_POWER_HIGH</string>
<string name="INPUT_COLOR_FORMAT_DEFAULT">BGR</string>
......
......@@ -21,9 +21,11 @@
android:key="@string/LABEL_PATH_KEY"
android:defaultValue="@string/LABEL_PATH_DEFAULT"
android:title="Label Path" />
<EditTextPreference
<ListPreference
android:key="@string/IMAGE_PATH_KEY"
android:defaultValue="@string/IMAGE_PATH_DEFAULT"
android:entries="@array/image_name_entries"
android:entryValues="@array/image_name_values"
android:title="Image Path" />
</PreferenceCategory>
<PreferenceCategory android:title="CPU Settings">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册