Skip to content

Commit 4db8489

Browse files
committed
Changed fold unfold mechanism and arrow for barcode symbologies selection
1 parent f2520f1 commit 4db8489

File tree

5 files changed

+61
-24
lines changed

5 files changed

+61
-24
lines changed

AI_MutliBarcodes_Capture/src/main/java/com/zebra/ai_multibarcodes_capture/settings/SettingsActivity.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import android.widget.CheckBox;
1616
import android.widget.CompoundButton;
1717
import android.widget.EditText;
18+
import android.widget.ImageView;
1819
import android.widget.RadioButton;
1920
import android.widget.ScrollView;
2021
import android.widget.Spinner;
@@ -47,8 +48,9 @@ public class SettingsActivity extends AppCompatActivity {
4748

4849
private EditText etPrefix;
4950
private RadioButton rbCSV, rbTXT, rbXSLX;
50-
private CheckBox cbOpenSymbologies;
51+
private ImageView ivToggleSymbologies;
5152
private ScrollView svSymbologies;
53+
private boolean isSymbologiesExpanded = false;
5254
private Spinner spinnerLanguage;
5355
private LanguageAdapter languageAdapter;
5456
private List<LanguageItem> languageList;
@@ -98,7 +100,7 @@ protected void onCreate(Bundle savedInstanceState) {
98100
rbCSV = findViewById(R.id.rbCSV);
99101
rbTXT = findViewById(R.id.rbTxt);
100102
rbXSLX = findViewById(R.id.rbXSLX);
101-
cbOpenSymbologies = findViewById(R.id.cbOpenSymbologies);
103+
ivToggleSymbologies = findViewById(R.id.ivToggleSymbologies);
102104
svSymbologies = findViewById(R.id.svSymbologies);
103105
spinnerLanguage = findViewById(R.id.spinnerLanguage);
104106

@@ -153,18 +155,16 @@ protected void onCreate(Bundle savedInstanceState) {
153155
cbUS4STATE = findViewById(R.id.cbUS4STATE);
154156
cbUS4STATE_FICS = findViewById(R.id.cbUS4STATE_FICS);
155157

156-
// Initially hide the ScrollView
158+
// Initially hide the ScrollView and set collapsed state
157159
svSymbologies.setVisibility(View.GONE);
160+
isSymbologiesExpanded = false;
161+
ivToggleSymbologies.setImageResource(R.drawable.ic_expand_less_24);
158162

159-
// Set up checkbox listener to show/hide symbologies ScrollView
160-
cbOpenSymbologies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
163+
// Set up click listener for toggle ImageView
164+
ivToggleSymbologies.setOnClickListener(new View.OnClickListener() {
161165
@Override
162-
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
163-
if (isChecked) {
164-
svSymbologies.setVisibility(View.VISIBLE);
165-
} else {
166-
svSymbologies.setVisibility(View.GONE);
167-
}
166+
public void onClick(View v) {
167+
toggleSymbologies();
168168
}
169169
});
170170

@@ -488,6 +488,18 @@ private void selectExtensionRadioButton(String extension)
488488

489489
}
490490
}
491+
private void toggleSymbologies() {
492+
isSymbologiesExpanded = !isSymbologiesExpanded;
493+
494+
if (isSymbologiesExpanded) {
495+
svSymbologies.setVisibility(View.VISIBLE);
496+
ivToggleSymbologies.setImageResource(R.drawable.ic_expand_more_24);
497+
} else {
498+
svSymbologies.setVisibility(View.GONE);
499+
ivToggleSymbologies.setImageResource(R.drawable.ic_expand_less_24);
500+
}
501+
}
502+
491503
private void configureSystemBars() {
492504
Window window = getWindow();
493505
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:viewportWidth="24"
6+
android:viewportHeight="24">
7+
<path
8+
android:fillColor="#FF000000"
9+
android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
10+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:viewportWidth="24"
6+
android:viewportHeight="24">
7+
<path
8+
android:fillColor="#FF000000"
9+
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
10+
</vector>

AI_MutliBarcodes_Capture/src/main/res/layout/activity_setup.xml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,42 +131,46 @@
131131
<LinearLayout
132132
android:id="@+id/llSymbologyTitle"
133133
android:layout_width="match_parent"
134-
android:layout_height="wrap_content"
134+
android:layout_height="48dp"
135135
android:backgroundTint="@color/zebra"
136136
android:background="@color/zebra"
137137
android:layout_below="@id/llLanguage"
138138
android:layout_marginBottom="10dp"
139-
android:orientation="horizontal">
139+
android:orientation="horizontal"
140+
android:gravity="center_vertical">
140141

141142
<View
142143
android:layout_width="0dp"
143-
android:layout_height="5dp"
144+
android:layout_height="match_parent"
144145
android:layout_weight="1" />
145146

146147
<TextView
147148
android:id="@+id/textView2"
148149
android:layout_width="0dp"
149150
android:layout_height="wrap_content"
150151
android:layout_weight="1"
151-
android:gravity="center_horizontal"
152+
android:gravity="center_horizontal|center_vertical"
152153
android:text="@string/symbologies"
153154
android:textColor="@color/white" />
154155

155156
<View
156157
android:layout_width="0dp"
157-
android:layout_height="5dp"
158-
android:layout_weight="0.6" />
158+
android:layout_height="match_parent"
159+
android:layout_weight="0.4" />
159160

160-
<CheckBox
161-
android:id="@+id/cbOpenSymbologies"
162-
android:layout_width="0dp"
163-
android:layout_height="wrap_content"
164-
android:layout_weight="0.2"
165-
android:buttonTint="@color/white" />
161+
<ImageView
162+
android:id="@+id/ivToggleSymbologies"
163+
android:layout_width="48dp"
164+
android:layout_height="48dp"
165+
android:src="@drawable/ic_expand_more_24"
166+
android:contentDescription="@string/toggle_symbologies"
167+
android:padding="12dp"
168+
android:background="?android:attr/selectableItemBackgroundBorderless"
169+
app:tint="@color/white" />
166170

167171
<View
168172
android:layout_width="0dp"
169-
android:layout_height="5dp"
173+
android:layout_height="match_parent"
170174
android:layout_weight="0.2" />
171175
</LinearLayout>
172176

AI_MutliBarcodes_Capture/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
<!-- Content Descriptions for Accessibility -->
160160
<string name="toggle_flashlight">Toggle flashlight</string>
161161
<string name="toggle_capture_zone">Toggle capture zone</string>
162+
<string name="toggle_symbologies">Toggle symbologies</string>
162163
<string name="edit_item">Edit item</string>
163164
<string name="delete_item">Delete item</string>
164165

0 commit comments

Comments
 (0)