add new class for parser and refactored contents

This commit is contained in:
Chumva 2018-04-10 14:33:08 +03:00
parent dbce9cb1fe
commit 0e3894f11b
8 changed files with 181 additions and 167 deletions

View file

@ -3,8 +3,7 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/wikivoyage_bg_color">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@ -59,14 +58,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/ctx_menu_card_btn_light"
android:orientation="vertical">
<View
@ -78,15 +76,15 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/wikivoyage_bg_color"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/contents_button"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
android:layout_weight="0.5"
android:background="?attr/selectableItemBackground"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"
@ -97,7 +95,7 @@
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:text="@string/article_contents_title"
android:text="@string/shared_string_contents"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
@ -112,37 +110,29 @@
android:background="?attr/dashboard_divider"
android:visibility="visible" />
<FrameLayout
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/save_button"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" >
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/save_text_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/bottom_sheet_content_padding_small"
android:layout_marginRight="@dimen/bottom_sheet_content_padding_small"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"
android:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:text="@string/shared_string_save"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableRight="@drawable/ic_action_read_later_fill"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:ignore="UnusedAttribute" />
</FrameLayout>
android:layout_gravity="center_vertical|end"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"
android:gravity="center_vertical|end"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:text="@string/shared_string_save"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableRight="@drawable/ic_action_read_later_fill"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:ignore="UnusedAttribute" />
</LinearLayout>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="@color/color_transparent"
android:divider="@android:color/darker_gray"
android:dividerHeight="0.5dp" />
</LinearLayout>

View file

@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/expandable_list_item_background"
android:orientation="vertical">
<TextView
android:id="@+id/group_label"
android:id="@+id/item_label"
android:layout_width="wrap_content"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:layout_gravity="center_vertical"
android:paddingLeft="@dimen/showAllButtonMarginRight"
android:gravity="center"
android:drawablePadding="@dimen/showAllButtonMarginRight"
android:gravity="center"
android:paddingLeft="@dimen/showAllButtonMarginRight"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:drawableStart="@drawable/ic_action_list_sort"
tools:text="@string/article_contents_title"
tools:text="@string/shared_string_contents"
tools:textStyle="bold" />
</LinearLayout>

View file

@ -13,7 +13,7 @@
<string name="shared_string_read">Read</string>
<string name="saved_articles">Saved articles</string>
<string name="shared_string_explore">Explore</string>
<string name="article_contents_title">Contents</string>
<string name="shared_string_contents">Contents</string>
<string name="shared_string_result">Result</string>
<string name="use_two_digits_longitude">Use two digits longitude</string>
<string name="shared_string_travel">Travel</string>

View file

@ -311,6 +311,12 @@ public class AndroidUtils {
return dm.heightPixels;
}
public static int getScreenWidth(Activity activity) {
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.widthPixels;
}
public static boolean isValidEmail(CharSequence target) {
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}

View file

@ -17,6 +17,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.TextView;
import net.osmand.AndroidUtils;
@ -56,7 +57,6 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
private TextView selectedLangTv;
private WebView contentWebView;
private WikivoyageArticleDialogFragment thiss;
@Nullable
@Override
@ -69,7 +69,6 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
selectedLang = args.getString(SELECTED_LANG_KEY);
}
}
thiss = this;
final View mainView = inflate(R.layout.fragment_wikivoyage_article_dialog, container);
setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
@ -92,20 +91,19 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
}
});
final View buttomBar = mainView.findViewById(R.id.bottom_bar);
final View buttonBar = mainView.findViewById(R.id.bottom_bar);
buttomBar.setBackgroundColor(getResolvedColor(isNightMode(false) ? R.color.status_bar_wikivoyage_article_dark : R.color.ctx_menu_card_btn_light));
buttonBar.setBackgroundColor(getResolvedColor(nightMode ? R.color.status_bar_wikivoyage_article_dark : R.color.ctx_menu_card_btn_light));
TextViewEx contentsButton = mainView.findViewById(R.id.contents_button);
TextViewEx saveButton = (TextViewEx) mainView.findViewById(R.id.save_text_button);
TextViewEx contentsButton = (TextViewEx) mainView.findViewById(R.id.contents_button);
TextViewEx saveButton = (TextViewEx) mainView.findViewById(R.id.save_button);
saveButton.setCompoundDrawablesWithIntrinsicBounds(null,
null, getMyApplication().getIconsCache()
.getIcon(R.drawable.ic_action_read_later, isNightMode(false) ?
R.color.wikivoyage_active_dark : R.color.ctx_menu_bottom_buttons_text_color_light), null);
null, getIcon(R.drawable.ic_action_read_later, nightMode ?
R.color.wikivoyage_active_dark : R.color.ctx_menu_bottom_buttons_text_color_light), null);
contentsButton.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_list_header,
isNightMode(false) ? R.color.wikivoyage_active_dark : R.color.ctx_menu_bottom_buttons_text_color_light),
nightMode ? R.color.wikivoyage_active_dark : R.color.ctx_menu_bottom_buttons_text_color_light),
null, null, null);
contentsButton.setOnClickListener(new View.OnClickListener() {
@ -113,11 +111,11 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
public void onClick(View v) {
FragmentManager fm = getActivity().getSupportFragmentManager();
Bundle args = new Bundle();
args.putString("CONTENTS_JSON", contentsJson);
args.putString(WikivoyageArticleContentsBottomSheetDialogFragment.CONTENTS_JSON, contentsJson);
WikivoyageArticleContentsBottomSheetDialogFragment fragment = new WikivoyageArticleContentsBottomSheetDialogFragment();
fragment.setUsedOnMap(false);
fragment.setArguments(args);
fragment.setTargetFragment(thiss, 0);
fragment.setTargetFragment(WikivoyageArticleDialogFragment.this, 0);
fragment.show(fm, WikivoyageArticleContentsBottomSheetDialogFragment.TAG);
}
});
@ -142,7 +140,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
String link = data.getStringExtra("test");
String link = data.getStringExtra(WikivoyageArticleContentsBottomSheetDialogFragment.CONTENTS_LINK);
moveAnchor(link);
}
}

View file

@ -0,0 +1,71 @@
package net.osmand.plus.wikivoyage.data;
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
class ContentsJsonParser {
static ContentsContainer parseJsonContents(String contentsJson, Context context) {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
ArrayList<String> listDataHeader = new ArrayList<String>();
LinkedHashMap<String, List<String>> listDataChild = new LinkedHashMap<String, List<String>>();
JSONObject reader = null;
try {
reader = new JSONObject(contentsJson);
} catch (JSONException e) {
e.printStackTrace();
return null;
}
List<String> secondLevel = null;
JSONArray jArray = reader.names();
for (int i = 0; i < jArray.length(); i++) {
try {
JSONArray contacts = reader.getJSONArray(reader.names().getString(i));
String link = contacts.getString(1);
map.put(reader.names().getString(i), link);
int level = contacts.getInt(0);
if (level == 2) {
listDataHeader.add(reader.names().getString(i));
secondLevel = new ArrayList<String>();
}
if (level == 3) {
if (secondLevel == null) {
secondLevel = new ArrayList<String>();
}
secondLevel.add(reader.names().getString(i));
listDataChild.put(listDataHeader.get(listDataHeader.size() - 1), secondLevel);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return new ContentsContainer(map, listDataHeader, listDataChild);
}
static class ContentsContainer {
public LinkedHashMap<String, String> map;
public ArrayList<String> listDataHeader;
public LinkedHashMap<String, List<String>> listDataChild;
public ContentsContainer(LinkedHashMap<String, String> map, ArrayList<String> listDataHeader,
LinkedHashMap<String, List<String>> listChildData) {
this.map = map;
this.listDataHeader = listDataHeader;
this.listDataChild = listChildData;
}
}
}

View file

@ -3,27 +3,23 @@ package net.osmand.plus.wikivoyage.data;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnGroupClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.plus.OsmandApplication;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -31,64 +27,43 @@ import java.util.List;
public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "WikivoyageArticleContentsBottomSheetDialogFragment";
public final static String CONTENTS_JSON = "contents_json";
public final static String CONTENTS_LINK = "contents_link";
private LinkedHashMap<String, String> map;
private String link;
private OsmandApplication app;
@Override
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
String contentsJson;
if (args != null) {
contentsJson = args.getString("CONTENTS_JSON");
contentsJson = args.getString(CONTENTS_JSON);
} else {
return;
}
app = getMyApplication();
final ArrayList<String> listDataHeader = new ArrayList<String>();
final LinkedHashMap<String, List<String>> listDataChild = new LinkedHashMap<String, List<String>>();
map = new LinkedHashMap<>();
JSONObject reader = null;
try {
reader = new JSONObject(contentsJson);
} catch (JSONException e) {
e.printStackTrace();
ContentsJsonParser.ContentsContainer contentsContainer = ContentsJsonParser.parseJsonContents(contentsJson, getContext());
if (contentsContainer == null) {
return;
}
List<String> secondLevel = null;
JSONArray jArray = reader.names();
for (int i = 0; i < jArray.length(); i++) {
try {
JSONArray contacts = reader.getJSONArray(reader.names().getString(i));
String link = contacts.getString(1);
final ArrayList<String> listDataHeader = contentsContainer.listDataHeader;
final LinkedHashMap<String, List<String>> listDataChild = contentsContainer.listDataChild;
map.put(reader.names().getString(i), link);
map = contentsContainer.map;
int level = contacts.getInt(0);
if (level == 2) {
listDataHeader.add(reader.names().getString(i));
secondLevel = new ArrayList<String>();
}
if (level == 3) {
if (secondLevel == null) {
secondLevel = new ArrayList<String>();
}
secondLevel.add(reader.names().getString(i));
listDataChild.put(listDataHeader.get(listDataHeader.size() - 1), secondLevel);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
items.add(new TitleItem(getString(R.string.article_contents_title)));
LayoutInflater li = LayoutInflater.from(getContext());
View view = li.inflate(R.layout.wikivoyage_contents_expandablelistview, null);
ExpandableListView expListView = view.findViewById(R.id.expandableListView);
items.add(new TitleItem(getString(R.string.shared_string_contents)));
ExpandableListView expListView = new ExpandableListView(getContext());
ExpandableListAdapter listAdapter = new ExpandableListAdapter(getContext(), listDataHeader, listDataChild);
expListView.setAdapter(listAdapter);
expListView.setChildDivider(getResources().getDrawable(R.color.color_transparent));
expListView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
@ -100,17 +75,13 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
return false;
}
});
DisplayMetrics diaplayMetrics;
int width;
diaplayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(diaplayMetrics);
width = diaplayMetrics.widthPixels;
int width = AndroidUtils.getScreenWidth(getActivity());
if (android.os.Build.VERSION.SDK_INT < 18) {
expListView.setIndicatorBounds(width - ((int) (50 * getResources().getDisplayMetrics().density + 0.5f)), width - ((int) (10 * getResources().getDisplayMetrics().density + 0.5f)));
expListView.setIndicatorBounds(width - (AndroidUtils.dpToPx(getContext(), 50)), width - (AndroidUtils.dpToPx(getContext(), 10)));
} else {
expListView.setIndicatorBoundsRelative(width - ((int) (50 * getResources().getDisplayMetrics().density + 0.5f)), width - ((int) (10 * getResources().getDisplayMetrics().density + 0.5f)));
expListView.setIndicatorBoundsRelative(width - (AndroidUtils.dpToPx(getContext(), 50)), width - (AndroidUtils.dpToPx(getContext(), 10)));
}
expListView.setIndicatorBounds(200, 50);
expListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
@ -122,19 +93,22 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
return false;
}
});
expListView.setAdapter(listAdapter);
LinearLayout container = new LinearLayout(getContext());
container.addView(expListView);
BaseBottomSheetItem favoritesItem = new SimpleBottomSheetItem.Builder()
.setCustomView(view)
.setCustomView(container)
.create();
items.add(favoritesItem);
}
private void sendResult(int REQUEST_CODE) {
Intent intent = new Intent();
intent.putExtra("test", link);
getTargetFragment().onActivityResult(
getTargetRequestCode(), REQUEST_CODE, intent);
intent.putExtra(CONTENTS_LINK, link);
Fragment fragment = getTargetFragment();
if (fragment != null) {
fragment.onActivityResult(
getTargetRequestCode(), REQUEST_CODE, intent);
}
}
@Override
@ -142,23 +116,22 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
return false;
}
class ExpandableListAdapter extends BaseExpandableListAdapter {
class ExpandableListAdapter extends OsmandBaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader;
private LinkedHashMap<String, List<String>> _listDataChild;
private Context context;
private List<String> listDataHeader;
private LinkedHashMap<String, List<String>> listDataChild;
public ExpandableListAdapter(Context context, List<String> listDataHeader,
LinkedHashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
this.context = context;
this.listDataHeader = listDataHeader;
this.listDataChild = listChildData;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
return this.listDataChild.get(this.listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
@ -169,22 +142,17 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
LayoutInflater infalInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.wikivoyage_contents_group_list_item, null);
convertView = infalInflater.inflate(R.layout.wikivoyage_contents_list_item, null);
}
TextView txtListChild = (TextView) convertView.findViewById(R.id.group_label);
TextView txtListChild = (TextView) convertView.findViewById(R.id.item_label);
txtListChild.setText(childText);
txtListChild.setTextColor(getResolvedColor(isNightMode() ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light));
txtListChild.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache()
.getIcon(R.drawable.ic_action_list_bullet, isNightMode() ?
R.color.route_info_unchecked_mode_icon_color : R.color.ctx_menu_nearby_routes_text_color_dark),
txtListChild.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_list_bullet,
isNightMode() ? R.color.route_info_unchecked_mode_icon_color : R.color.ctx_menu_nearby_routes_text_color_dark),
null, null, null);
return convertView;
@ -192,8 +160,8 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
@Override
public int getChildrenCount(int groupPosition) {
if (this._listDataChild.get(this._listDataHeader.get(groupPosition)) != null) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition)).size();
if (this.listDataChild.get(this.listDataHeader.get(groupPosition)) != null) {
return this.listDataChild.get(this.listDataHeader.get(groupPosition)).size();
} else {
return 0;
}
@ -201,12 +169,12 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
return this.listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
return this.listDataHeader.size();
}
@Override
@ -219,17 +187,15 @@ public class WikivoyageArticleContentsBottomSheetDialogFragment extends MenuBott
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
LayoutInflater infalInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.wikivoyage_contents_group_list_item, null);
convertView = infalInflater.inflate(R.layout.wikivoyage_contents_list_item, null);
}
TextView lblListHeader = (TextView) convertView.findViewById(R.id.group_label);
TextView lblListHeader = (TextView) convertView.findViewById(R.id.item_label);
lblListHeader.setText(headerTitle);
lblListHeader.setTextColor(getResolvedColor(isNightMode() ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light));
lblListHeader.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache()
.getIcon(R.drawable.ic_action_list_sort, isNightMode() ?
R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light),
lblListHeader.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_contents,
isNightMode() ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light),
null, null, null);
return convertView;