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

update edittext to list

上级 6a160e97
...@@ -131,7 +131,7 @@ public class MiniActivity extends AppCompatActivity { ...@@ -131,7 +131,7 @@ public class MiniActivity extends AppCompatActivity {
*/ */
private boolean onRunModel() { private boolean onRunModel() {
try { try {
String assetImagePath = "images/5.jpg"; String assetImagePath = "images/0.jpg";
InputStream imageStream = getAssets().open(assetImagePath); InputStream imageStream = getAssets().open(assetImagePath);
Bitmap image = BitmapFactory.decodeStream(imageStream); Bitmap image = BitmapFactory.decodeStream(imageStream);
// Input is Bitmap // Input is Bitmap
......
...@@ -17,7 +17,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha ...@@ -17,7 +17,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
CheckBoxPreference cbEnableCustomSettings = null; CheckBoxPreference cbEnableCustomSettings = null;
EditTextPreference etModelPath = null; EditTextPreference etModelPath = null;
EditTextPreference etLabelPath = null; EditTextPreference etLabelPath = null;
EditTextPreference etImagePath = null; ListPreference etImagePath = null;
ListPreference lpCPUThreadNum = null; ListPreference lpCPUThreadNum = null;
ListPreference lpCPUPowerMode = null; ListPreference lpCPUPowerMode = null;
ListPreference lpInputColorFormat = null; ListPreference lpInputColorFormat = null;
...@@ -84,7 +84,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha ...@@ -84,7 +84,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
etModelPath = (EditTextPreference) findPreference(getString(R.string.MODEL_PATH_KEY)); etModelPath = (EditTextPreference) findPreference(getString(R.string.MODEL_PATH_KEY));
etModelPath.setTitle("Model Path (SDCard: " + Utils.getSDCardDirectory() + ")"); etModelPath.setTitle("Model Path (SDCard: " + Utils.getSDCardDirectory() + ")");
etLabelPath = (EditTextPreference) findPreference(getString(R.string.LABEL_PATH_KEY)); 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 = lpCPUThreadNum =
(ListPreference) findPreference(getString(R.string.CPU_THREAD_NUM_KEY)); (ListPreference) findPreference(getString(R.string.CPU_THREAD_NUM_KEY));
lpCPUPowerMode = lpCPUPowerMode =
...@@ -119,7 +119,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha ...@@ -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.INPUT_STD_KEY), preInstalledInputStds.get(modelIdx));
editor.putString(getString(R.string.SCORE_THRESHOLD_KEY), editor.putString(getString(R.string.SCORE_THRESHOLD_KEY),
preInstalledScoreThresholds.get(modelIdx)); preInstalledScoreThresholds.get(modelIdx));
editor.commit(); editor.apply();
} }
lpChoosePreInstalledModel.setSummary(modelPath); lpChoosePreInstalledModel.setSummary(modelPath);
} }
...@@ -159,7 +159,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha ...@@ -159,7 +159,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
etLabelPath.setSummary(labelPath); etLabelPath.setSummary(labelPath);
etLabelPath.setText(labelPath); etLabelPath.setText(labelPath);
etImagePath.setSummary(imagePath); etImagePath.setSummary(imagePath);
etImagePath.setText(imagePath); etImagePath.setValue(imagePath);
lpCPUThreadNum.setValue(cpuThreadNum); lpCPUThreadNum.setValue(cpuThreadNum);
lpCPUThreadNum.setSummary(cpuThreadNum); lpCPUThreadNum.setSummary(cpuThreadNum);
lpCPUPowerMode.setValue(cpuPowerMode); lpCPUPowerMode.setValue(cpuPowerMode);
......
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> 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> <group>
<item <item
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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"> <string-array name="cpu_thread_num_entries">
<item>1 threads</item> <item>1 threads</item>
<item>2 threads</item> <item>2 threads</item>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<string name="SCORE_THRESHOLD_KEY">SCORE_THRESHOLD_KEY</string> <string name="SCORE_THRESHOLD_KEY">SCORE_THRESHOLD_KEY</string>
<string name="MODEL_PATH_DEFAULT">models/ocr_v2_for_cpu</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="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_THREAD_NUM_DEFAULT">4</string>
<string name="CPU_POWER_MODE_DEFAULT">LITE_POWER_HIGH</string> <string name="CPU_POWER_MODE_DEFAULT">LITE_POWER_HIGH</string>
<string name="INPUT_COLOR_FORMAT_DEFAULT">BGR</string> <string name="INPUT_COLOR_FORMAT_DEFAULT">BGR</string>
......
...@@ -21,9 +21,11 @@ ...@@ -21,9 +21,11 @@
android:key="@string/LABEL_PATH_KEY" android:key="@string/LABEL_PATH_KEY"
android:defaultValue="@string/LABEL_PATH_DEFAULT" android:defaultValue="@string/LABEL_PATH_DEFAULT"
android:title="Label Path" /> android:title="Label Path" />
<EditTextPreference <ListPreference
android:key="@string/IMAGE_PATH_KEY" android:key="@string/IMAGE_PATH_KEY"
android:defaultValue="@string/IMAGE_PATH_DEFAULT" android:defaultValue="@string/IMAGE_PATH_DEFAULT"
android:entries="@array/image_name_entries"
android:entryValues="@array/image_name_values"
android:title="Image Path" /> android:title="Image Path" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="CPU Settings"> <PreferenceCategory android:title="CPU Settings">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册