use of android.widget.ExpandableListView in project Osmand by osmandapp.
the class LiveUpdatesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
listView = (ExpandableListView) view.findViewById(android.R.id.list);
View bottomShadowView = inflater.inflate(R.layout.card_bottom_divider, listView, false);
listView.addFooterView(bottomShadowView);
adapter = new LocalIndexesAdapter(this);
listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
if (!processing && InAppHelper.isSubscribedToLiveUpdates()) {
final FragmentManager fragmentManager = getChildFragmentManager();
LiveUpdatesSettingsDialogFragment.createInstance(adapter.getChild(groupPosition, childPosition).getFileName()).show(fragmentManager, "settings");
return true;
} else {
return false;
}
}
});
progressBar = (ProgressBar) view.findViewById(R.id.progress);
if (!Version.isDeveloperVersion(getMyApplication())) {
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
updateSubscriptionHeader();
listView.addHeaderView(subscriptionHeader);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0 && !processing && InAppHelper.isSubscribedToLiveUpdates()) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.setEditMode(true);
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
}
});
}
listView.setAdapter(adapter);
loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return view;
}
use of android.widget.ExpandableListView in project Osmand by osmandapp.
the class LocalIndexesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.local_index, container, false);
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
getDownloadActivity().getAccessibilityAssistant().registerPage(view, DownloadActivity.LOCAL_TAB_NUMBER);
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
listAdapter = new LocalIndexesAdapter(getDownloadActivity());
listView.setAdapter(listAdapter);
expandAllGroups();
setListView(listView);
return view;
}
use of android.widget.ExpandableListView in project Osmand by osmandapp.
the class AvailableGPXFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.available_gpx, container, false);
listView = (ExpandableListView) v.findViewById(android.R.id.list);
setHasOptionsMenu(true);
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
currentGpxView = inflater.inflate(R.layout.current_gpx_item, null, false);
createCurrentTrackView();
currentGpxView.findViewById(R.id.current_track_info).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
newIntent.putExtra(TrackActivity.CURRENT_RECORDING, true);
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(newIntent);
}
});
listView.addHeaderView(currentGpxView);
/*
currentTrackView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openTrack(getActivity(), null);
}
});
*/
} else {
View headerView = inflater.inflate(R.layout.list_shadow_header, null, false);
listView.addHeaderView(headerView);
}
footerView = inflater.inflate(R.layout.list_shadow_footer, null, false);
listView.addFooterView(footerView);
emptyView = v.findViewById(android.R.id.empty);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
if (Build.VERSION.SDK_INT >= 18) {
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day : R.drawable.ic_empty_state_trip_night);
} else {
emptyImageView.setVisibility(View.INVISIBLE);
}
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
importButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
addTrack();
}
});
if (this.adapter != null) {
listView.setAdapter(this.adapter);
}
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int i) {
View currentFocus = getActivity().getCurrentFocus();
if (currentFocus != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
}
}
@Override
public void onScroll(AbsListView absListView, int i, int i1, int i2) {
}
});
return v;
}
use of android.widget.ExpandableListView in project netxms by netxms.
the class ExpandableListFragment method onContentChanged.
public void onContentChanged() {
View emptyView = getView().findViewById(android.R.id.empty);
mList = (ExpandableListView) getView().findViewById(android.R.id.list);
if (mList == null) {
throw new RuntimeException("Your content must have a ExpandableListView whose id attribute is 'android.R.id.list'");
}
if (emptyView != null) {
mList.setEmptyView(emptyView);
}
mList.setOnChildClickListener(this);
mList.setOnGroupExpandListener(this);
mList.setOnGroupCollapseListener(this);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mFinishedStart = true;
}
use of android.widget.ExpandableListView in project netxms by netxms.
the class ExpandableListFragment method ensureList.
private void ensureList() {
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
if (root instanceof ExpandableListView) {
mList = (ExpandableListView) root;
} else {
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ExpandableListView)) {
if (rawListView == null) {
throw new RuntimeException("Your content must have a ExpandableListView whose id attribute is 'android.R.id.list'");
}
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' that is not a ExpandableListView class");
}
mList = (ExpandableListView) rawListView;
}
mList.setOnItemClickListener(mOnClickListener);
if (mAdapter != null) {
setListAdapter(mAdapter);
} else {
// We are starting without an adapter, so assume we won't
// have our data right away and start with the progress indicator.
setListShown(false, false);
}
mHandler.post(mRequestFocus);
}
Aggregations