use of net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion in project Osmand by osmandapp.
the class SearchDialogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.maps_in_category_fragment, container, false);
if (savedInstanceState != null) {
searchText = savedInstanceState.getString(SEARCH_TEXT_DLG_KEY);
}
if (searchText == null) {
searchText = getArguments().getString(SEARCH_TEXT_DLG_KEY);
}
if (searchText == null)
searchText = "";
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity(), false);
LinearLayout ll = (LinearLayout) view;
ExpandableListView expandablelistView = (ExpandableListView) view.findViewById(android.R.id.list);
ll.removeView(expandablelistView);
listView = new ListView(getActivity());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
layoutParams.weight = 1;
layoutParams.setMargins(0, 0, 0, 0);
listView.setLayoutParams(layoutParams);
ll.addView(listView);
listView.setOnItemClickListener(this);
listAdapter = new SearchListAdapter(getDownloadActivity());
listView.setOnItemClickListener(this);
listView.setAdapter(listAdapter);
TypedValue typedValue = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.toolbar_theme, typedValue, true);
searchView = inflater.inflate(R.layout.search_text_layout, toolbar, false);
toolbar.addView(searchView);
searchEditText = (EditText) view.findViewById(R.id.searchEditText);
searchEditText.setHint(R.string.search_map_hint);
searchEditText.setTextColor(Color.WHITE);
boolean isLight = getMyApplication().getSettings().isLightContent();
searchEditText.setHintTextColor(isLight ? getMyApplication().getResources().getColor(R.color.inactive_item_orange) : getMyApplication().getResources().getColor(R.color.searchbar_tab_inactive_dark));
progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar);
clearButton = (ImageButton) view.findViewById(R.id.clearButton);
clearButton.setVisibility(View.GONE);
searchEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
updateSearchText(s.toString());
}
});
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (searchEditText.getText().length() == 0) {
dismiss();
} else {
searchEditText.setText("");
}
}
});
searchEditText.requestFocus();
return view;
}
use of net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion in project Osmand by osmandapp.
the class DownloadResourceGroupFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.maps_in_category_fragment, container, false);
if (savedInstanceState != null) {
groupId = savedInstanceState.getString(REGION_ID_DLG_KEY);
}
if (groupId == null && getArguments() != null) {
groupId = getArguments().getString(REGION_ID_DLG_KEY);
}
if (groupId == null) {
groupId = "";
}
activity = (DownloadActivity) getActivity();
activity.getAccessibilityAssistant().registerPage(view, DownloadActivity.DOWNLOAD_TAB_NUMBER);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
if (!openAsDialog()) {
toolbar.setVisibility(View.GONE);
}
setHasOptionsMenu(true);
if (openAsDialog()) {
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity(), false);
} else {
banner = null;
view.findViewById(R.id.freeVersionBanner).setVisibility(View.GONE);
}
listView = (ExpandableListView) view.findViewById(android.R.id.list);
addSubscribeEmailRow();
addSearchRow();
addRestorePurchasesRow();
listView.setOnChildClickListener(this);
listAdapter = new DownloadResourceGroupAdapter(activity);
listView.setAdapter(listAdapter);
return view;
}
Aggregations