Search in sources :

Example 31 with ExpandableListView

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;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AbsListView(android.widget.AbsListView) ExpandableListView(android.widget.ExpandableListView) AbstractLoadLocalIndexTask(net.osmand.plus.download.ui.AbstractLoadLocalIndexTask) FragmentManager(android.support.v4.app.FragmentManager) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView)

Example 32 with ExpandableListView

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;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 33 with ExpandableListView

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;
}
Also used : ImageButton(android.widget.ImageButton) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) AbsListView(android.widget.AbsListView) Intent(android.content.Intent) InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) AbsListView(android.widget.AbsListView) ExpandableListView(android.widget.ExpandableListView) OsmandMonitoringPlugin(net.osmand.plus.monitoring.OsmandMonitoringPlugin)

Example 34 with ExpandableListView

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;
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView)

Example 35 with ExpandableListView

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);
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Aggregations

ExpandableListView (android.widget.ExpandableListView)86 View (android.view.View)59 TextView (android.widget.TextView)30 AdapterView (android.widget.AdapterView)18 Intent (android.content.Intent)16 ListView (android.widget.ListView)16 ArrayList (java.util.ArrayList)16 AbsListView (android.widget.AbsListView)14 DialogInterface (android.content.DialogInterface)11 ImageView (android.widget.ImageView)11 List (java.util.List)11 Builder (android.app.AlertDialog.Builder)9 ViewGroup (android.view.ViewGroup)9 ExpandableListAdapter (android.widget.ExpandableListAdapter)7 AbsSpinner (android.widget.AbsSpinner)6 QuickContactBadge (android.widget.QuickContactBadge)6 TabHost (android.widget.TabHost)6 AdapterBinding (com.android.ide.common.rendering.api.AdapterBinding)6 ResourceReference (com.android.ide.common.rendering.api.ResourceReference)6 SessionParams (com.android.ide.common.rendering.api.SessionParams)6