1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 09:49:19 +02:00

code simplification

This commit is contained in:
Nikolay Pultsin 2013-09-15 20:32:07 +03:00
parent 3fd8f4ebc8
commit 799a03dc5c

View file

@ -61,7 +61,7 @@ public class AllCatalogsActivity extends Activity {
myAllItems.clear();
if (myIds.size() > 0) {
myAllItems.add(new SectionItem(getLabelByKey("active")));
myAllItems.add(new SectionItem("active"));
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
for (String id : myIds) {
cItems.add(new CatalogItem(id, true, myLibrary.getCatalogTreeByUrlAll(id)));
@ -70,7 +70,7 @@ public class AllCatalogsActivity extends Activity {
}
if (myInactiveIds.size() > 0) {
myAllItems.add(new SectionItem(getLabelByKey("inactive")));
myAllItems.add(new SectionItem("inactive"));
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
for (String id : myInactiveIds) {
cItems.add(new CatalogItem(id, false, myLibrary.getCatalogTreeByUrlAll(id)));
@ -82,10 +82,6 @@ public class AllCatalogsActivity extends Activity {
selectedList.setAdapter(new CatalogsListAdapter());
}
private String getLabelByKey(String keyName) {
return NetworkLibrary.resource().getResource("allCatalogs").getResource(keyName).getValue();
}
@Override
protected void onResume() {
super.onResume();
@ -120,8 +116,8 @@ public class AllCatalogsActivity extends Activity {
private static class SectionItem implements Item {
private final String Title;
public SectionItem(String title) {
Title = title;
public SectionItem(String key) {
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())) {
view = convertView;
} else {
view = LayoutInflater.from(getContext()).inflate(
view = getLayoutInflater().inflate(
item instanceof SectionItem
? R.layout.checkbox_section : R.layout.checkbox_item,
null