Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit f48e649

Browse files
committed
ToolbarLayout selectAll > ActionMode
1 parent 0525d5e commit f48e649

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

app/src/main/java/de/dlyt/yanndroid/oneuiexample/tabs/IconsTab.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ public void setSelecting(boolean enabled) {
300300
if (enabled) {
301301
mSelecting = true;
302302
imageAdapter.notifyItemRangeChanged(0, imageAdapter.getItemCount()-1);
303-
drawerLayout.showSelectAllMode(true);
304-
drawerLayout.setSelectAllCheckedChangeListener((buttonView, isChecked) -> {
303+
drawerLayout.showActionMode(true);
304+
drawerLayout.setActionModeSelectAllCheckedChangeListener((buttonView, isChecked) -> {
305305
if (checkAllListening) {
306306
for (int i = 0; i < imageAdapter.getItemCount()-1; i++) {
307307
selected.put(i, isChecked);
@@ -310,7 +310,7 @@ public void setSelecting(boolean enabled) {
310310
}
311311
int count = 0;
312312
for (Boolean b : selected.values()) if (b) count++;
313-
drawerLayout.setSelectAllCount(count);
313+
drawerLayout.setActionModeSelectCount(count);
314314
});
315315
tabLayout.setEnabled(false);
316316
bnv.setEnabled(false);
@@ -321,8 +321,8 @@ public void setSelecting(boolean enabled) {
321321
for (int i = 0; i < imageAdapter.getItemCount()-1; i++) selected.put(i, false);
322322
imageAdapter.notifyItemRangeChanged(0, imageAdapter.getItemCount()-1);
323323

324-
drawerLayout.setSelectAllCount(0);
325-
drawerLayout.showSelectAllMode(false);
324+
drawerLayout.setActionModeSelectCount(0);
325+
drawerLayout.showActionMode(false);
326326
tabLayout.setEnabled(true);
327327
bnv.setEnabled(true);
328328
viewPager.setPagingEnabled(true);
@@ -338,8 +338,8 @@ public void toggleItemSelected(int position) {
338338
int count = 0;
339339
for (Boolean b : selected.values()) if (b) count++;
340340
DrawerLayout drawerLayout = getActivity().findViewById(R.id.drawer_view);
341-
drawerLayout.setSelectAllChecked(count == imageAdapter.getItemCount()-1);
342-
drawerLayout.setSelectAllCount(count);
341+
drawerLayout.setActionModeSelectAllChecked(count == imageAdapter.getItemCount()-1);
342+
drawerLayout.setActionModeSelectCount(count);
343343
checkAllListening = true;
344344
}
345345

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/layout/DrawerLayout.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,27 @@ public void setDrawerOpen(Boolean open, Boolean animate) {
244244
}
245245

246246
//
247-
// Select all checkbox methods
247+
// Action Mode methods
248248
//
249-
public void showSelectAllMode(boolean visible) {
250-
toolbarLayout.showSelectAllMode(visible);
249+
public void showActionMode(boolean visible) {
250+
toolbarLayout.showActionMode(visible);
251251
if (visible) {
252252
drawerLayout.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
253253
} else {
254254
drawerLayout.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED);
255255
}
256256
}
257257

258-
public void setSelectAllCount(int count) {
259-
toolbarLayout.setSelectAllCount(count);
258+
public void setActionModeSelectCount(int count) {
259+
toolbarLayout.setActionModeSelectCount(count);
260260
}
261261

262-
public void setSelectAllCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener){
263-
toolbarLayout.setSelectAllCheckedChangeListener(listener);
262+
public void setActionModeSelectAllCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener){
263+
toolbarLayout.setActionModeSelectAllCheckedChangeListener(listener);
264264
}
265265

266-
public void setSelectAllChecked(boolean checked){
267-
toolbarLayout.setSelectAllChecked(checked);
266+
public void setActionModeSelectAllChecked(boolean checked){
267+
toolbarLayout.setActionModeSelectAllChecked(checked);
268268
}
269269

270270
private Activity getActivity() {

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/layout/ToolbarLayout.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class ToolbarLayout extends LinearLayout {
100100
private OnMenuItemClickListener onMenuItemClickListener = item -> {
101101
};
102102

103-
private boolean mSelectAll = false;
103+
private boolean mActionMode = false;
104104
private RelativeLayout checkbox_withtext;
105105
private CheckBox checkbox_all;
106106

@@ -316,14 +316,14 @@ public void setCustomTitleView(View view, SamsungCollapsingToolbarLayout.LayoutP
316316
}
317317

318318
//
319-
// Select all checkbox methods
319+
// Action Mode methods
320320
//
321-
public void showSelectAllMode(boolean visible) {
322-
mSelectAll = visible;
321+
public void showActionMode(boolean visible) {
322+
mActionMode = visible;
323323
setNavigationButtonVisible(!visible);
324324
if (visible) {
325325
checkbox_withtext.setVisibility(View.VISIBLE);
326-
setSelectAllCount(0);
326+
setActionModeSelectCount(0);
327327
overflowButton.setVisibility(GONE);
328328
actionButtonContainer.setVisibility(GONE);
329329
} else {
@@ -334,17 +334,17 @@ public void showSelectAllMode(boolean visible) {
334334
}
335335
}
336336

337-
public void setSelectAllCount(int count) {
337+
public void setActionModeSelectCount(int count) {
338338
String title = getResources().getString(R.string.selected_check_info, count);
339339
if (mExpandable) collapsingToolbarLayout.setTitle(title);
340340
collapsedTitleView.setText(title);
341341
}
342342

343-
public void setSelectAllCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener) {
343+
public void setActionModeSelectAllCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener) {
344344
checkbox_all.setOnCheckedChangeListener(listener);
345345
}
346346

347-
public void setSelectAllChecked(boolean checked) {
347+
public void setActionModeSelectAllChecked(boolean checked) {
348348
checkbox_all.setChecked(checked);
349349
}
350350

@@ -360,7 +360,7 @@ public void setNavigationButtonIcon(Drawable navigationIcon) {
360360
public void setNavigationButtonVisible(boolean visible) {
361361
navigationButtonContainer.setVisibility(visible ? View.VISIBLE : View.GONE);
362362
toolbar.setPaddingRelative(0, 0, 0, 0);
363-
toolbar.setPaddingRelative(visible || mSelectAll ? 0 : getResources().getDimensionPixelSize(R.dimen.sesl_action_bar_content_inset), 0, 0, 0);
363+
toolbar.setPaddingRelative(visible || mActionMode ? 0 : getResources().getDimensionPixelSize(R.dimen.sesl_action_bar_content_inset), 0, 0, 0);
364364
}
365365

366366
public void setNavigationButtonBadge(int count) {

0 commit comments

Comments
 (0)