Java Code Examples for android.widget.ExpandableListView#setEmptyView()

The following examples show how to use android.widget.ExpandableListView#setEmptyView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpandableListActivity.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the screen state (current list and other views) when the
 * content changes.
 * 
 * @see Activity#onContentChanged()
 */
@Override
public void onContentChanged() {
    super.onContentChanged();
    View emptyView = findViewById(com.android.internal.R.id.empty);
    mList = (ExpandableListView)findViewById(com.android.internal.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;
}
 
Example 2
Source File: A6OrderAty.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
private void initViews() {
	mNavigationIndex = getIntent()
			.getIntExtra(EXTRA_PRE_LOAD_DATA_INDEX, 0);
	llytOperate = (LinearLayout) findViewById(R.id.operate);
	btnCancel = (Button) findViewById(R.id.cancel);
	btnCancel.setOnClickListener(this);
	btnPay = (Button) findViewById(R.id.pay);
	btnPay.setOnClickListener(this);
	tvEmptyView = (TextView) findViewById(R.id.emptyView);
	lvOrders = (ExpandableListView) findViewById(R.id.orders);

	lvOrders.setEmptyView(tvEmptyView);
	LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
	View footerView = inflater.inflate(R.layout.fv_a6_order, null);
	lvOrders.addFooterView(footerView);
	mAdapter = new A6OrderExpandableAdapter(this, mLstODBInfos);
	lvOrders.setAdapter(mAdapter);

	// btnPay.setEnabled(false);
	setPanelGone(true);
}
 
Example 3
Source File: GenericChannelAdapter.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
protected void showNoResultsFoundView(final String emptyMsg) {
	if (parentView == null || TextUtils.isEmpty(emptyMsg)) return;
	
	ExpandableListView lv = (ExpandableListView)parentView.findViewById(R.id.channelListView);
	View emptyView = parentView.findViewById(R.id.channelListEmpty);
	if (lv != null && emptyView != null) {
		TextView tv = (TextView)emptyView.findViewById(R.id.results_not_found);
		tv.setText(emptyMsg);
		
		lv.setEmptyView(emptyView);
	}
	
	View progressView = parentView.findViewById(R.id.channelListProgress);
	if (progressView != null) {
		progressView.setVisibility(View.GONE);
	}
	
}
 
Example 4
Source File: GenericChannelsFragment.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.channel_list, container, false);
	
	OnChildClickListener channelItemListener = new OnChildClickListener() {
		@Override
		public boolean onChildClick(ExpandableListView parent, View v,
				int groupPosition, int childPosition, long id) {
			JSONObject channelItem = (JSONObject) adapter.getChild(groupPosition, childPosition);
			channelSelected(channelItem);
			return true;
		}
	};
	
	ExpandableListView channelsView = (ExpandableListView) view.findViewById(R.id.channelListView);
	channelsView.setEmptyView(view.findViewById(R.id.channelListProgress));
	channelsView.setAdapter(adapter);
	channelsView.setOnChildClickListener(channelItemListener);
	
	PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
	channelsView.setOnScrollListener(listener);
	expandAll(view);
	
	return view;
}
 
Example 5
Source File: PadListActivity.java    From padland with Apache License 2.0 5 votes vote down vote up
/**
 * Makes an empty ListView and returns it.
 *
 * @return ListView
 */
private void _initListView() {
    expandableListView = (ExpandableListView) findViewById(R.id.listView);
    expandableListView.setTextFilterEnabled(true);
    expandableListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    expandableListView.setEmptyView(findViewById(android.R.id.empty));

    // Set the data
    setAdapter();

    // events
    this._setListViewEvents();

    adapter.notifyDataSetChanged();
}
 
Example 6
Source File: DeviceServicesActivity.java    From BleSensorTag with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.device_services_activity);

    gattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
    gattServicesList.setOnChildClickListener(this);
    final View emptyView = findViewById(R.id.empty_view);
    gattServicesList.setEmptyView(emptyView);

    dataCharacteristic = (TextView) findViewById(R.id.data_characteristic_uuid);
    dataValue = (TextView) findViewById(R.id.data_characteristic_value);

    //noinspection ConstantConditions
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    final String deviceName = getDeviceName();
    if (TextUtils.isEmpty(deviceName)) {
        //noinspection ConstantConditions
        actionBar.setTitle(getDeviceAddress());
    } else {
        //noinspection ConstantConditions
        actionBar.setTitle(deviceName);
        actionBar.setSubtitle(getDeviceAddress());
    }
    actionBar.setDisplayHomeAsUpEnabled(true);
}
 
Example 7
Source File: SearchChannelsAdapter.java    From buddycloud-android with Apache License 2.0 5 votes vote down vote up
private void setLoading(final Context context) {
	ProgressBar progressBar = (ProgressBar)view.findViewById(R.id.channelListProgress);
	ExpandableListView elv = (ExpandableListView)view.findViewById(R.id.channelListView);
	View noResultsFound = view.findViewById(R.id.channelListEmpty);
	
	if (elv != null) {
		progressBar.setVisibility(View.VISIBLE);
		elv.setEmptyView(progressBar);
		
		if (noResultsFound != null) {
			noResultsFound.setVisibility(View.GONE);
		}
	}
}
 
Example 8
Source File: SearchChannelsFragment.java    From buddycloud-android with Apache License 2.0 5 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	View view = super.onCreateView(inflater, container, savedInstanceState);
	final View emptyView = View.inflate(container.getContext(), R.layout.list_empty_view, null);
	final ExpandableListView channelsView = (ExpandableListView) view.findViewById(R.id.channelListView);
	channelsView.setEmptyView(emptyView);
	view.findViewById(R.id.channelListProgress).setVisibility(View.GONE);
	adapter.configure(genericChannelFrag, view);
	return view;
}