mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
code simplification
This commit is contained in:
parent
3fd8f4ebc8
commit
799a03dc5c
1 changed files with 5 additions and 9 deletions
|
@ -61,7 +61,7 @@ public class AllCatalogsActivity extends Activity {
|
||||||
myAllItems.clear();
|
myAllItems.clear();
|
||||||
|
|
||||||
if (myIds.size() > 0) {
|
if (myIds.size() > 0) {
|
||||||
myAllItems.add(new SectionItem(getLabelByKey("active")));
|
myAllItems.add(new SectionItem("active"));
|
||||||
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
|
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
|
||||||
for (String id : myIds) {
|
for (String id : myIds) {
|
||||||
cItems.add(new CatalogItem(id, true, myLibrary.getCatalogTreeByUrlAll(id)));
|
cItems.add(new CatalogItem(id, true, myLibrary.getCatalogTreeByUrlAll(id)));
|
||||||
|
@ -70,7 +70,7 @@ public class AllCatalogsActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myInactiveIds.size() > 0) {
|
if (myInactiveIds.size() > 0) {
|
||||||
myAllItems.add(new SectionItem(getLabelByKey("inactive")));
|
myAllItems.add(new SectionItem("inactive"));
|
||||||
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
|
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
|
||||||
for (String id : myInactiveIds) {
|
for (String id : myInactiveIds) {
|
||||||
cItems.add(new CatalogItem(id, false, myLibrary.getCatalogTreeByUrlAll(id)));
|
cItems.add(new CatalogItem(id, false, myLibrary.getCatalogTreeByUrlAll(id)));
|
||||||
|
@ -82,10 +82,6 @@ public class AllCatalogsActivity extends Activity {
|
||||||
selectedList.setAdapter(new CatalogsListAdapter());
|
selectedList.setAdapter(new CatalogsListAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabelByKey(String keyName) {
|
|
||||||
return NetworkLibrary.resource().getResource("allCatalogs").getResource(keyName).getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -120,8 +116,8 @@ public class AllCatalogsActivity extends Activity {
|
||||||
private static class SectionItem implements Item {
|
private static class SectionItem implements Item {
|
||||||
private final String Title;
|
private final String Title;
|
||||||
|
|
||||||
public SectionItem(String title) {
|
public SectionItem(String key) {
|
||||||
Title = title;
|
Title = NetworkLibrary.resource().getResource("allCatalogs").getResource(key).getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +161,7 @@ public class AllCatalogsActivity extends Activity {
|
||||||
if (convertView != null && item.getClass().equals(convertView.getTag())) {
|
if (convertView != null && item.getClass().equals(convertView.getTag())) {
|
||||||
view = convertView;
|
view = convertView;
|
||||||
} else {
|
} else {
|
||||||
view = LayoutInflater.from(getContext()).inflate(
|
view = getLayoutInflater().inflate(
|
||||||
item instanceof SectionItem
|
item instanceof SectionItem
|
||||||
? R.layout.checkbox_section : R.layout.checkbox_item,
|
? R.layout.checkbox_section : R.layout.checkbox_item,
|
||||||
null
|
null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue