android.widget.ExpandableListView Java Examples

The following examples show how to use android.widget.ExpandableListView. 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: ResultsActivity.java    From arcgis-runtime-samples-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstance) {
  super.onCreate(savedInstance);
  setContentView(R.layout.results_expandable_list);

  // get intent from main activity
  Intent intent = getIntent();
  // get the HashMap created in MainActivity
  HashMap<String,ArrayList<String>> child = (HashMap<String,ArrayList<String>>) intent.getSerializableExtra("HashMap");
  ArrayList<String> header = new ArrayList<>();
  header.add("Point");
  header.add("Polyline");
  header.add("Polygon");

  // create an expandable list view and an adapter to display in new activity.
  ExpandableListView expandableListView = findViewById(R.id.expandableList);
  ExpandableListAdapter expandableListAdapter = new ExpandableListAdapter(this,header,child);
  expandableListView.setAdapter(expandableListAdapter);
}
 
Example #2
Source File: RecentTabsPage.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = buildAdapter(activity, recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setOnChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setOnGroupCollapseListener(this);
    mListView.setOnGroupExpandListener(this);
    mListView.setOnCreateContextMenuListener(this);

    mView.addOnAttachStateChangeListener(this);
    ApplicationStatus.registerStateListenerForActivity(this, activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    onUpdated();
}
 
Example #3
Source File: elvDemo2_Fragment.java    From ui with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	// Inflate the layout for this fragment
	View myView = inflater.inflate(R.layout.elvdemo2_fragment, container, false);
	
    // get the listview
       expListView = (ExpandableListView) myView.findViewById(R.id.lvExp2);
       prepareListData();
       
       listAdapter =  new SimpleExpandableListAdapter(
                       myContext,						    //context
                       listDataGroup,                  // group list in the form:  List<? extends Map<String, ?>>
                       R.layout.evl2_group_row,        // Group item layout XML.
                       new String[] { "Group Item" },  // the key of group item.   String[] groupFrom, 
                       new int[] { R.id.row_name },    // ID of each group item.-Data under the key goes into this TextView.  int[] groupTo
                       listDataChild,              // childData describes second-level entries. in the form List<? extends List<? extends Map<String, ?>>>
                       R.layout.evl2_child_row,             // Layout for sub-level entries(second level).
                       new String[] {"Sub Item A", "Sub Item B"},      // Keys in childData maps to display.
                       new int[] { R.id.grp_childA, R.id.grp_childB}     // Data under the keys above go into these TextViews.
                   );
      expListView.setAdapter( listAdapter );       // setting the adapter in the list.
    
       return myView;
}
 
Example #4
Source File: HelpActivity.java    From privacy-friendly-weather with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_help);
    ExpandableListAdapter expandableListAdapter;
    HelpDataDump helpDataDump = new HelpDataDump(this);

    ExpandableListView generalExpandableListView = (ExpandableListView) findViewById(R.id.generalExpandableListView);

    LinkedHashMap<String, List<String>> expandableListDetail = helpDataDump.getDataGeneral();
    List<String> expandableListTitleGeneral = new ArrayList<String>(expandableListDetail.keySet());
    expandableListAdapter = new ExpandableListAdapter(this, expandableListTitleGeneral, expandableListDetail);
    generalExpandableListView.setAdapter(expandableListAdapter);

    overridePendingTransition(0, 0);
}
 
Example #5
Source File: HelpActivity.java    From privacy-friendly-pedometer with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);

    ExpandableListAdapter expandableListAdapter;
    HelpDataDump helpDataDump = new HelpDataDump(this);

    ExpandableListView generalExpandableListView = (ExpandableListView) findViewById(R.id.generalExpandableListView);

    LinkedHashMap<String, List<String>> expandableListDetail = helpDataDump.getDataGeneral();
    List<String> expandableListTitleGeneral = new ArrayList<String>(expandableListDetail.keySet());
    expandableListAdapter = new ExpandableListAdapter(this, expandableListTitleGeneral, expandableListDetail);
    generalExpandableListView.setAdapter(expandableListAdapter);

    overridePendingTransition(0, 0);
}
 
Example #6
Source File: DeviceControlActivity.java    From connectivity-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                            int childPosition, long id) {
    if (mGattCharacteristics != null) {
        final BluetoothGattCharacteristic characteristic =
                mGattCharacteristics.get(groupPosition).get(childPosition);
        final int charaProp = characteristic.getProperties();
        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
            // If there is an active notification on a characteristic, clear
            // it first so it doesn't update the data field on the user interface.
            if (mNotifyCharacteristic != null) {
                mBluetoothLeService.setCharacteristicNotification(
                        mNotifyCharacteristic, false);
                mNotifyCharacteristic = null;
            }
            mBluetoothLeService.readCharacteristic(characteristic);
        }
        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
            mNotifyCharacteristic = characteristic;
            mBluetoothLeService.setCharacteristicNotification(
                    characteristic, true);
        }
        return true;
    }
    return false;
}
 
Example #7
Source File: FilterFriendsChooseLeadersFragment.java    From PADListener with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
	MyLog.entry("menuItem = " + menuItem);

	final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuItem.getMenuInfo();
	final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition);

	//final MonsterInfoModel monsterInfo = getGroupMonsterItem(menuItem.getMenuInfo());

	switch (menuItem.getItemId()) {
		case MENU_ID_SELECT_ALL:
			mAdapter.flagAllChildren(groupPosition, true);
			break;
		case MENU_ID_DESELECT_ALL:
			mAdapter.flagAllChildren(groupPosition, false);
			break;
		default:
	}

	MyLog.exit();
	return true;
}
 
Example #8
Source File: OPDSActivity.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.emdev.ui.AbstractActionActivity#onCreateImpl(android.os.Bundle)
 */
@Override
protected void onCreateImpl(final Bundle savedInstanceState) {

    setContentView(R.layout.opds);
    setActionForView(R.id.opdsaddfeed);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    
    final OPDSActivityController c = getController();

    list = (ExpandableListView) findViewById(R.id.opdslist);
    list.setGroupIndicator(null);
    list.setChildIndicator(null);
    list.setOnGroupClickListener(c);
    list.setOnChildClickListener(c);
    list.setAdapter(c.adapter);

    this.registerForContextMenu(list);
}
 
Example #9
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
public void onCurrentRootChanged() {
    if (mAdapter == null || mList == null) return;

    final RootInfo root = ((BaseActivity) getActivity()).getCurrentRoot();
    for (int i = 0; i < mAdapter.getGroupCount(); i++) {
        for (int j = 0; j < mAdapter.getChildrenCount(i); j++) {
            final Object item = mAdapter.getChild(i,j);
            if (item instanceof RootItem) {
                final RootInfo testRoot = ((RootItem) item).root;
                if (Objects.equal(testRoot, root)) {
                    try {
                        long id = ExpandableListView.getPackedPositionForChild(i, j);
                        int index = mList.getFlatListPosition(id);
                        //mList.setSelection(index);
                        mList.setItemChecked(index, true);
                    } catch (Exception e){
                        CrashReportingManager.logException(e);
                    }

                    return;
                }
            }
        }
    }
}
 
Example #10
Source File: MainExpListActivity.java    From ListView-Swipe-to-Delete with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main_explist);

	list = (ExpandableListView) findViewById(android.R.id.list);
	
	listHandler = new ItemExpListHandler(list);
	
	ArrayList<MenuItemDesc> menuItems = fillMenu();
	
	listAdapter = new ItemExpListAdapter(R.layout.item, menuItems, listHandler);
	fillAdapter();
	list.setAdapter(listAdapter);

	listManager = new ItemExpListManager(this, listHandler, true);
}
 
Example #11
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
Example #12
Source File: PinnedHeaderExpandableListView.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public void setPinnedHeaderView(View view) {
	mHeaderView = view;
	if (mHeaderView != null) {
		setFadingEdgeLength(0);
		mHeaderView.setOnTouchListener(new OnTouchListener() {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_UP) {
					final long flatPos = getExpandableListPosition(getFirstVisiblePosition());
					final int groupPos = ExpandableListView
							.getPackedPositionGroup(flatPos);
					collapseGroup(groupPos);
				}
				return true;
			}
		});
	}
	requestLayout();
}
 
Example #13
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
Example #14
Source File: HelpActivity.java    From privacy-friendly-netmonitor with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);
    RunStore.setContext(this);

    ExpandableListAdapter expandableListAdapter;
    HelpDataDump helpDataDump = new HelpDataDump(this);

    ExpandableListView generalExpandableListView = (ExpandableListView) findViewById(R.id.generalExpandableListView);

    HashMap<String, List<String>> expandableListDetail = helpDataDump.getDataGeneral();
    List<String> expandableListTitleGeneral = new ArrayList<>(expandableListDetail.keySet());
    expandableListAdapter = new ExpandableListAdapter(this, expandableListTitleGeneral, expandableListDetail);
    generalExpandableListView.setAdapter(expandableListAdapter);

    overridePendingTransition(0, 0);
}
 
Example #15
Source File: RecentTabsPage.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    // Would prefer to have this context menu view managed internal to RecentTabsGroupView
    // Unfortunately, setting either onCreateContextMenuListener or onLongClickListener
    // disables the native onClick (expand/collapse) behaviour of the group view.
    ExpandableListView.ExpandableListContextMenuInfo info =
            (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu, mActivity);
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
        mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition, menu,
                mActivity);
    }
}
 
Example #16
Source File: FloatingGroupExpandableListView.java    From FloatingGroupExpandableListView with Apache License 2.0 6 votes vote down vote up
private void drawFloatingGroupIndicator(Canvas canvas) {
	final Drawable groupIndicator = (Drawable) ReflectionUtils.getFieldValue(ExpandableListView.class, "mGroupIndicator", FloatingGroupExpandableListView.this);
	if(groupIndicator != null) {
		final int stateSetIndex =
				(mAdapter.isGroupExpanded(mFloatingGroupPosition) ? 1 : 0) | // Expanded?
				(mAdapter.getChildrenCount(mFloatingGroupPosition) > 0 ? 2 : 0); // Empty?
		groupIndicator.setState(GROUP_STATE_SETS[stateSetIndex]);

		final int indicatorLeft = (Integer) ReflectionUtils.getFieldValue(ExpandableListView.class, "mIndicatorLeft", FloatingGroupExpandableListView.this);
		final int indicatorRight = (Integer) ReflectionUtils.getFieldValue(ExpandableListView.class, "mIndicatorRight", FloatingGroupExpandableListView.this);

		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
			mIndicatorRect.set(indicatorLeft + getPaddingLeft(), mFloatingGroupView.getTop(), indicatorRight + getPaddingLeft(), mFloatingGroupView.getBottom());
		} else {
			mIndicatorRect.set(indicatorLeft, mFloatingGroupView.getTop(), indicatorRight, mFloatingGroupView.getBottom());
		}

		groupIndicator.setBounds(mIndicatorRect);
		groupIndicator.draw(canvas);
	}
}
 
Example #17
Source File: CommentsAdapter.java    From SkyTube with GNU General Public License v3.0 6 votes vote down vote up
public CommentsAdapter(Context context, String videoId, ExpandableListView expandableListView, View commentsProgressBar, View noVideoCommentsView) {
	this.context = context;
	this.videoId = videoId;
	this.expandableListView = expandableListView;
	this.expandableListView.setAdapter(this);
	this.expandableListView.setOnGroupClickListener((parent, v, groupPosition, id) -> true);
	this.commentsProgressBar = commentsProgressBar;
	this.noVideoCommentsView = noVideoCommentsView;
	this.layoutInflater = LayoutInflater.from(expandableListView.getContext());
	try {
		this.commentThreadPager = NewPipeService.isPreferred() ? NewPipeService.get().getCommentPager(videoId) : new GetCommentThreads(videoId);
		this.getCommentsTask = new GetCommentsTask();
		this.getCommentsTask.execute();
	} catch (Exception e) {
		SkyTubeApp.notifyUserOnError(context, e);
	}
}
 
Example #18
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 #19
Source File: TreeView.java    From TreeView with Apache License 2.0 6 votes vote down vote up
private void onHeaderViewClick() {
    long packedPosition = getExpandableListPosition(getFirstVisiblePosition());

    int groupPosition = ExpandableListView.getPackedPositionGroup(packedPosition);

    int status = mUpdater.getHeaderClickStatus(groupPosition);
    if (ITreeViewHeaderUpdater.STATE_VISIBLE_ALL == status) {
        collapseGroup(groupPosition);
        mUpdater.onHeaderClick(groupPosition, ITreeViewHeaderUpdater.STATE_GONE);
    } else {
        expandGroup(groupPosition);
        mUpdater.onHeaderClick(groupPosition, ITreeViewHeaderUpdater.STATE_VISIBLE_ALL);
    }

    setSelectedGroup(groupPosition);
}
 
Example #20
Source File: elvDemo1_Fragment.java    From ui with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	// Inflate the layout for this fragment
	View myView = inflater.inflate(R.layout.elvdemo1_fragment, container, false);


	// get the listview
	expListView = (ExpandableListView) myView.findViewById(R.id.lvExp);

	// preparing list data
	prepareListData();

	listAdapter = new ExpandableListAdapter(myContext, listDataHeader, listDataChild);

	// setting list adapter
	expListView.setAdapter(listAdapter);
	
	return myView;
}
 
Example #21
Source File: AllTasksListFragment.java    From ActivityLauncher with ISC License 6 votes vote down vote up
@Override
public void onCreateContextMenu(@NonNull ContextMenu menu, @NonNull View v,
                                ContextMenuInfo menuInfo) {
    menu.add(Menu.NONE, 0, Menu.NONE, R.string.context_action_shortcut);
    menu.add(Menu.NONE, 1, Menu.NONE, R.string.context_action_launch);

    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
    ExpandableListView list = getView().findViewById(R.id.expandableListView1);

    switch (ExpandableListView.getPackedPositionType(info.packedPosition)) {
        case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
            MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
            menu.setHeaderIcon(activity.icon);
            menu.setHeaderTitle(activity.name);
            menu.add(Menu.NONE, 2, Menu.NONE, R.string.context_action_edit);
            break;
        case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
            MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
            menu.setHeaderIcon(pack.icon);
            menu.setHeaderTitle(pack.name);
            break;
    }

    super.onCreateContextMenu(menu, v, menuInfo);
}
 
Example #22
Source File: QuestExpandableListFragment.java    From MonsterHunter4UDatabase with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_generic_expandable_list, container, false);
    ExpandableListView elv = (ExpandableListView) v
            .findViewById(R.id.expandableListView);
    if (mHub.equals("Caravan")) {
        elv.setAdapter(new QuestListAdapter(caravan));
    } else if(mHub.equals("Guild")) {
        elv.setAdapter(new QuestListAdapter(guild));
    } else {
        elv.setAdapter(new QuestListAdapter(event));
    }

    return v;

}
 
Example #23
Source File: HelpActivity.java    From privacy-friendly-ludo with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);

    ExpandableListAdapter expandableListAdapter;
    HelpDataDump helpDataDump = new HelpDataDump(this);

    ExpandableListView generalExpandableListView = (ExpandableListView) findViewById(R.id.generalExpandableListView);

    LinkedHashMap<String, List<String>> expandableListDetail = helpDataDump.getDataGeneral();
    List<String> expandableListTitleGeneral = new ArrayList<>(expandableListDetail.keySet());
    expandableListAdapter = new ExpandableListAdapter(this, expandableListTitleGeneral, expandableListDetail);
    generalExpandableListView.setAdapter(expandableListAdapter);

    overridePendingTransition(0, 0);
}
 
Example #24
Source File: VipFragment.java    From letv with Apache License 2.0 6 votes vote down vote up
private void setRootView(ChannelHomeBean result, boolean isFromNet) {
    if (result != null) {
        this.mChannelHomeBean = result;
        if (!BaseTypeUtils.isListEmpty(this.mChannelHomeBean.searchWords)) {
            initFooterSearchView(this.mChannelHomeBean.searchWords);
        }
        setFocusView(this.mChannelHomeBean.focus);
        if (this.mChannelHomeBean.isShowTextMark) {
            setVipTipsView();
        }
        initTabView(result);
        finishLoading();
        this.mPullView.setPullToRefreshEnabled(true);
        ((ExpandableListView) this.mPullView.getRefreshableView()).setAdapter(this.mListAdapter);
        this.mListAdapter.setDataList((ExpandableListView) this.mPullView.getRefreshableView(), this.mChannelHomeBean, isFromNet);
    }
}
 
Example #25
Source File: DeviceControlActivity.java    From android-BluetoothLeGatt with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gatt_services_characteristics);

    final Intent intent = getIntent();
    mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
    mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

    // Sets up UI references.
    ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
    mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
    mGattServicesList.setOnChildClickListener(servicesListClickListner);
    mConnectionState = (TextView) findViewById(R.id.connection_state);
    mDataField = (TextView) findViewById(R.id.data_value);

    getActionBar().setTitle(mDeviceName);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
    bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
}
 
Example #26
Source File: DoingListFragment.java    From AnyTime with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.fragment_main_doing_list,
			container, false);
	mDoingListData = new ArrayList<DoingListData>();
	expandableListView = (ExpandableListView) rootView
			.findViewById(R.id.expandableListView_doing_list);
	adapter = new AnytimeExpandableListAdapter(activity);
	expandableListView.setAdapter(adapter);
	expandableListView.setOnChildClickListener(listener);
	messageText = (TextView) rootView
			.findViewById(R.id.textView_loading_wait);
	LoadingData();
	return rootView;
}
 
Example #27
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
public void onCurrentRootChanged() {
    if (mAdapter == null || mList == null) return;

    final RootInfo root = ((BaseActivity) getActivity()).getCurrentRoot();
    for (int i = 0; i < mAdapter.getGroupCount(); i++) {
        for (int j = 0; j < mAdapter.getChildrenCount(i); j++) {
            final Object item = mAdapter.getChild(i,j);
            if (item instanceof RootItem) {
                final RootInfo testRoot = ((RootItem) item).root;
                if (Objects.equal(testRoot, root)) {
                    try {
                        long id = ExpandableListView.getPackedPositionForChild(i, j);
                        int index = mList.getFlatListPosition(id);
                        //mList.setSelection(index);
                        mList.setItemChecked(index, true);
                    } catch (Exception e){
                        Crashlytics.logException(e);
                    }

                    return;
                }
            }
        }
    }
}
 
Example #28
Source File: PinnedHeaderExpandableListView.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
	super.onLayout(changed, l, t, r, b);
	final long flatPostion = getExpandableListPosition(getFirstVisiblePosition());
	final int groupPos = ExpandableListView
			.getPackedPositionGroup(flatPostion);
	final int childPos = ExpandableListView
			.getPackedPositionChild(flatPostion);
	int state = mAdapter.getPinnedHeaderState(groupPos, childPos);
	
	if (mHeaderView != null && mAdapter != null && state != mOldState) {
		mOldState = state;
		mHeaderView.layout(0, 0, mHeaderViewWidth, mHeaderViewHeight);
	}

	configureHeaderView(groupPos, childPos);
}
 
Example #29
Source File: DetailFragment.java    From Android-Applications-Info with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mLayoutInflater = inflater;

    ExpandableListView listView = new ExpandableListView(getActivity());
    listView.setGroupIndicator(null);

    if (mPackageInfo == null) {
        Toast.makeText(getActivity(), R.string.app_not_installed, Toast.LENGTH_LONG).show();
    } else {
        listView.setAdapter(new Adapter());
    }

    return listView;
}
 
Example #30
Source File: PullToRefreshExpandableListView.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
	final ExpandableListView lv;
	if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
		lv = new InternalExpandableListViewSDK9(context, attrs);
	} else {
		lv = new InternalExpandableListView(context, attrs);
	}

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}