Skip to content

Commit b195ca2

Browse files
committed
replace () > 0) with isempty
1 parent 1bfbf3e commit b195ca2

16 files changed

+36
-36
lines changed

library/src/main/java/candybar/lib/activities/CandyBarMainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ private void initNavigationViewHeader() {
865865
image.setRatio(16, 9);
866866
}
867867

868-
if (titleText.length() == 0) {
868+
if (titleText.isEmpty()) {
869869
container.setVisibility(View.GONE);
870870
} else {
871871
title.setText(titleText);

library/src/main/java/candybar/lib/activities/CandyBarSplashActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected boolean run() {
153153
return false;
154154
}
155155

156-
if (list.size() > 0 && list.get(0) instanceof Map) {
156+
if (!list.isEmpty() && list.get(0) instanceof Map) {
157157
Map<?, ?> map = (Map<?, ?>) list.get(0);
158158
String thumbUrl = JsonHelper.getThumbUrl(map);
159159

library/src/main/java/candybar/lib/adapters/IconsAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
118118
mode.setTitle(mContext.getResources().getString(R.string.items_selected, mSelectedIcons.size()));
119119
menu.findItem(R.id.menu_select_all).setIcon(mSelectedIcons.size() == mIcons.size()
120120
? R.drawable.ic_toolbar_select_all_selected : R.drawable.ic_toolbar_select_all);
121-
menu.findItem(R.id.menu_delete).setVisible(mSelectedIcons.size() > 0);
121+
menu.findItem(R.id.menu_delete).setVisible(!mSelectedIcons.isEmpty());
122122
return true;
123123
}
124124

@@ -382,7 +382,7 @@ public void search(String string) {
382382
String query = string.toLowerCase(Locale.ENGLISH).trim();
383383

384384
mIcons = new ArrayList<>();
385-
if (query.length() == 0) mIcons.addAll(mIconsAll);
385+
if (query.isEmpty()) mIcons.addAll(mIconsAll);
386386
else {
387387
for (int i = 0; i < mIconsAll.size(); i++) {
388388
Icon icon = mIconsAll.get(i);
@@ -394,7 +394,7 @@ public void search(String string) {
394394
}
395395
}
396396

397-
if (mIcons.size() == 0) {
397+
if (mIcons.isEmpty()) {
398398
CandyBarApplication.getConfiguration().getAnalyticsHandler().logEvent(
399399
"click",
400400
new HashMap<String, Object>() {{

library/src/main/java/candybar/lib/adapters/SettingsAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
102102
ContentViewHolder contentViewHolder = (ContentViewHolder) holder;
103103
Setting setting = mSettings.get(position);
104104

105-
if (setting.getTitle().length() == 0) {
105+
if (setting.getTitle().isEmpty()) {
106106
contentViewHolder.title.setVisibility(View.GONE);
107107
contentViewHolder.divider.setVisibility(View.GONE);
108108
contentViewHolder.container.setVisibility(View.VISIBLE);
109109

110110
contentViewHolder.subtitle.setText(setting.getSubtitle());
111111

112-
if (setting.getContent().length() == 0) {
112+
if (setting.getContent().isEmpty()) {
113113
contentViewHolder.content.setVisibility(View.GONE);
114114
} else {
115115
contentViewHolder.content.setText(setting.getContent());
116116
contentViewHolder.content.setVisibility(View.VISIBLE);
117117
}
118118

119-
if (setting.getFooter().length() == 0) {
119+
if (setting.getFooter().isEmpty()) {
120120
contentViewHolder.footer.setVisibility(View.GONE);
121121
} else {
122122
contentViewHolder.footer.setText(setting.getFooter());

library/src/main/java/candybar/lib/adapters/WallpapersAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> tar
127127
public void search(String string) {
128128
String query = string.toLowerCase(Locale.getDefault()).trim();
129129
mWallpapers.clear();
130-
if (query.length() == 0) mWallpapers.addAll(mWallpapersAll);
130+
if (query.isEmpty()) mWallpapers.addAll(mWallpapersAll);
131131
else {
132132
for (int i = 0; i < mWallpapersAll.size(); i++) {
133133
Wallpaper wallpaper = mWallpapersAll.get(i);

library/src/main/java/candybar/lib/adapters/dialog/OtherAppsAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public View getView(int position, View view, ViewGroup viewGroup) {
101101

102102
holder.title.setText(otherApp.getTitle());
103103

104-
if (otherApp.getDescription() == null || otherApp.getDescription().length() == 0) {
104+
if (otherApp.getDescription() == null || otherApp.getDescription().isEmpty()) {
105105
holder.desc.setVisibility(View.GONE);
106106
} else {
107107
holder.desc.setText(otherApp.getDescription());

library/src/main/java/candybar/lib/applications/CandyBarApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public Configuration setShowTabAllIcons(boolean showTabAllIcons) {
303303

304304
public Configuration setTabAllIconsTitle(@NonNull String title) {
305305
mTabAllIconsTitle = title;
306-
if (mTabAllIconsTitle.length() == 0) mTabAllIconsTitle = "All Icons";
306+
if (mTabAllIconsTitle.isEmpty()) mTabAllIconsTitle = "All Icons";
307307
return this;
308308
}
309309

library/src/main/java/candybar/lib/fragments/RequestFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public void onClick(View view) {
276276
}
277277

278278
if ((requireActivity().getResources().getBoolean(R.bool.json_check_before_request)) &&
279-
(CandyBarApplication.getConfiguration().getConfigHandler().configJson(requireActivity()).length() != 0)) {
279+
(!CandyBarApplication.getConfiguration().getConfigHandler().configJson(requireActivity()).isEmpty())) {
280280
mAsyncTask = new CheckConfig().executeOnThreadPool();
281281
} else {
282282
mAsyncTask = new RequestLoader().executeOnThreadPool();
@@ -479,7 +479,7 @@ protected boolean run() {
479479

480480
List<ResolveInfo> resolveInfos = requireActivity().getPackageManager()
481481
.queryIntentActivities(intent, 0);
482-
if (resolveInfos.size() == 0) {
482+
if (resolveInfos.isEmpty()) {
483483
noEmailClientError = true;
484484
return false;
485485
}

library/src/main/java/candybar/lib/fragments/SettingsFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ protected boolean run() {
263263
Thread.sleep(1);
264264
File directory = requireActivity().getCacheDir();
265265
requests = Database.get(requireActivity()).getPremiumRequest(null);
266-
if (requests.size() == 0) return true;
266+
if (requests.isEmpty()) return true;
267267

268268
List<String> files = new ArrayList<>();
269269

@@ -335,7 +335,7 @@ protected void postRun(boolean ok) {
335335
dialog = null;
336336

337337
if (ok) {
338-
if (requests.size() == 0) {
338+
if (requests.isEmpty()) {
339339
Toast.makeText(getActivity(), R.string.premium_request_rebuilding_empty,
340340
Toast.LENGTH_LONG).show();
341341
return;

library/src/main/java/candybar/lib/helpers/IconsHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static List<Icon> getIconsList(@NonNull Context context) throws Exception
9696
if (parser.getName().equals("category")) {
9797
String title = parser.getAttributeValue(null, "title");
9898
if (!sectionTitle.equals(title)) {
99-
if (sectionTitle.length() > 0 && icons.size() > 0) {
99+
if (!sectionTitle.isEmpty() && !icons.isEmpty()) {
100100
count += icons.size();
101101
sections.add(new Icon(sectionTitle, icons));
102102
}
@@ -121,7 +121,7 @@ public static List<Icon> getIconsList(@NonNull Context context) throws Exception
121121
CandyBarApplication.getConfiguration().getCustomIconsCount() == 0) {
122122
CandyBarApplication.getConfiguration().setCustomIconsCount(count);
123123
}
124-
if (icons.size() > 0) {
124+
if (!icons.isEmpty()) {
125125
sections.add(new Icon(sectionTitle, icons));
126126
}
127127
parser.close();
@@ -158,7 +158,7 @@ public static void computeTitles(@NonNull Context context, List<Icon> icons) {
158158
// Title is already computed, so continue
159159
continue;
160160
}
161-
if (icon.getCustomName() != null && !icon.getCustomName().equals("")) {
161+
if (icon.getCustomName() != null && !icon.getCustomName().isEmpty()) {
162162
icon.setTitle(icon.getCustomName());
163163
} else {
164164
icon.setTitle(replaceName(context, iconReplacer, icon.getDrawableName()));

0 commit comments

Comments
 (0)