Java Code Examples for android.widget.ExpandableListView.setAdapter()

The following are Jave code examples for showing how to use setAdapter() of the android.widget.ExpandableListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: RecentTabsPage.java   Source Code and License Vote up 7 votes
/**
 * 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 2
Project: TimeTrix   File: FragmentTagNotes.java   Source Code and License Vote up 6 votes
@Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated (savedInstanceState);
        ImageButton btnAddNotes = (ImageButton) getActivity ().findViewById (R.id.buttonAddNotesTags);
        btnAddNotes.setOnClickListener (this);
        btnAddNotes.setVisibility (View.INVISIBLE);
//        ListView mListViewTag = (ListView) getActivity().findViewById(R.id.listNotesAll);

        mExpandableListViewTag = (ExpandableListView) getActivity ().findViewById (R.id.expandableListNotesTags);

        mArrayListTagNotes = new ArrayList<> ();
//        customAdapterTagNotes = new CustomAdapter(mArrayListTagNotes, getActivity(),tempString , mHandler);
        mCustomAdapterTags = new CustomAdapterTags (getActivity (), Integer.parseInt (mSectionIndex) + 1);
        mExpandableListViewTag.setTag (R.string.filename, mSectionIndex);
        mExpandableListViewTag.setTag (R.string.list_object, mArrayListTagNotes);
        mExpandableListViewTag.setAdapter (mCustomAdapterTags);
        mExpandableListViewTag.setItemsCanFocus (true);
        registerForContextMenu (mExpandableListViewTag);
        mSectionIndex = String.valueOf (mOnFragmentInteractionListener.getSectionIndex());
        populateListView ();

    }
 
Example 3
Project: ywApplication   File: SearchFragment.java   Source Code and License Vote up 6 votes
private void initView(View view) {
    expandableListView = (ExpandableListView) view.findViewById(R.id.search_listview);
    heardView = inflater.inflate(R.layout.search_item_heard_view, expandableListView, false);
    setclickListener(heardView);
    contantsAdapter = new ContantsAdapter(getActivity(), groupImgId, text, datas,numId);
    expandableListView.setAdapter(contantsAdapter);
    expandableListView.addHeaderView(heardView);
    expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            for (int i = 0; i <groupImgId.size() ; i++) {
                if (groupPosition !=i) {
                    expandableListView.collapseGroup(i);
                }
            }
        }
    });
}
 
Example 4
Project: Huochexing12306   File: A6OrderAty.java   Source Code and License Vote up 6 votes
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 5
Project: cat-is-a-dog   File: FollowingHabitsFragment.java   Source Code and License Vote up 6 votes
/**
 * Instantiate our data sources with firebase and our list adapters / view bindings
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return
 */
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_following_habits, container, false);

    ExpandableListView followingHabitsView =
            (ExpandableListView) view.findViewById(R.id.following_habits_list);

    String userId = CurrentUser.getInstance().getUserId();

    followingDataSource = new SocialDataSource(userId, SocialDataSource.UserType.FOLLOWING);
    followingDataSource.addObserver(this);
    following = followingDataSource.getSource();

    followingHabitsAdapter = new FollowingHabitsListAdapter(
            getActivity(),
            following,
            followingHabitMap
            );

    followingHabitsView.setAdapter(followingHabitsAdapter);

    return view;
}
 
Example 6
Project: linkedout_procon   File: Profile.java   Source Code and License Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    prefs = getContext().getSharedPreferences(STUDENT_PREFS, 0);

    View view =  inflater.inflate(R.layout.fragment_profile, container, false);

    fillInData(view);

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

    prepareListData();
    listAdapter = new ExpandableListAdapter(view.getContext(), listDataHeader, listDataChild);

    // setting list adapter
    expListView.setAdapter(listAdapter);

    return view;
}
 
Example 7
Project: expandableListviewDemo   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listView = (ExpandableListView) findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    /**
     * 初始化数据
     */
    initData();
    adapter = new ExAdapter(this, lines);
    listView.setAdapter(adapter);
    //遍历所有group,将所有项设置成默认展开
    int groupCount = listView.getCount();
    for (int i = 0; i < groupCount; i++) {
        listView.expandGroup(i);
    }
}
 
Example 8
Project: homebank_android   File: BudgetSummaryFragment.java   Source Code and License Vote up 5 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.category_list, container, false);
    expandableListView = (ExpandableListView) rootView.findViewById(R.id.expandable_category_list);
    addOnClickListeners();
    listAdapter = new ExpandableCategoryAdapter(
            getActivity(),
            HomeActivity.xhb.getTopCategoriesForMonthlyBudget(HomeActivity.CURRENT_MONTH),
            HomeActivity.CURRENT_MONTH
    );
    expandableListView.setAdapter(listAdapter);
    return rootView;
}
 
Example 9
Project: Veggietizer   File: Popup.java   Source Code and License Vote up 5 votes
/**
 * Shows the popup that is opened when the user clicks on the info action button of a details page.
 * An {@link ExpandableListView} is used as a layout.
 *
 * @param context The context to show the popup in.
 * @param title The popup's title.
 * @param groups The expandable categories.
 * @param entries Each category in <code>groups</code> shows one entry when expanded.
 * @return The dialog.
 */
private static AlertDialog showDetailsInfo(Context context, String title,
                                           String[] groups, String[] entries,
                                           DialogInterface.OnClickListener onSubmitListener) {
    if (groups.length != entries.length) {
        throw new IllegalArgumentException();
    }

    // Custom title
    TextView customTitle = (TextView) LayoutInflater.from(context).inflate(R.layout.popup_title, null);
    customTitle.setText(title);

    View popupDetailsInfo = LayoutInflater.from(context)
            .inflate(R.layout.popup_details_info, null);
    ExpandableListView listViewDetailsInfo = (ExpandableListView)
            popupDetailsInfo.findViewById(R.id.expandablelistview_popup_details_info);
    ExpandableListAdapter adapter = createDetailsInfoAdapter(context, groups, entries);
    listViewDetailsInfo.setAdapter(adapter);

    AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context);
    popupBuilder.setView(popupDetailsInfo)
            .setNeutralButton(R.string.ok, onSubmitListener)
            .setCustomTitle(customTitle);

    AlertDialog dialog = popupBuilder.create();
    dialog.show();

    Utility.setFont(FontManager.Font.ROBOTO_LIGHT, new TextView[]{
            customTitle
    });

    return dialog;
}
 
Example 10
Project: CIA   File: HabitsFragment.java   Source Code and License Vote up 4 votes
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    user = (Profile) getArguments().getSerializable(ID_PROFILE);
    noHabits = (TextView) view.findViewById(R.id.noHabits);
    if (user.hasValidId())
        user.load();

    if (user.getHabits().size() > 0) {
        noHabits.setVisibility(View.GONE);
    }

    user.synchronize();

    // handle any habits that may have been missed since the user's last login
    Date currentDate = new Date();
    if (user.getLastLogin() != null && !DateUtilities.isSameDay(user.getLastLogin(), currentDate)) {
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(user.getLastLogin());

        // go through each date between the user's last login and the current date
        while (!DateUtilities.isSameDay(calendar.getTime(), currentDate)){
            // update all events at the end of that date, to make sure they are marked as missed if they weren't completed
            // on that day
            user.onDayEnd(calendar.getTime());
            calendar.add(Calendar.DATE, 1);
        }
    }

    user.setLastLogin(currentDate);
    user.save();

    // initialize the list displaying all habits the user has
    expandableListView = (ExpandableListView) view.findViewById(R.id.HabitTypeExpandableListView);
    adapter = new ExpandableListViewAdapter(getContext(), user);
    expandableListView.setAdapter(adapter);

    expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int group, int child, long childRowId) {

            String category = SetUtilities.getItemAtIndex(user.getHabitCategories(), group);
            Habit habit = user.getHabitsInCategory(category).get(child);

            ArrayList<String> types = new ArrayList<>();
            types.addAll(user.getHabitCategories());

            startDetailsActivity(habit, types);

            return false;
        }
    });

}
 
Example 11
Project: Three-Level-Expandable-Listview   File: MainActivity.java   Source Code and License Vote up 4 votes
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        // second level category names (genres)
        secondLevel.add(movies);
        secondLevel.add(games);
        // secondLevel.add(serials);

        // movies category all data
        thirdLevelMovies.put(movies[0], horror);
        thirdLevelMovies.put(movies[1], action);
        thirdLevelMovies.put(movies[2], thriller);


        // games category all data
        thirdLevelGames.put(games[0], fps);
        thirdLevelGames.put(games[1], moba);
        thirdLevelGames.put(games[2], rpg);
        thirdLevelGames.put(games[3], racing);


        // serials category all data
      /*  thirdLevelSerials.put(serials[0], crime);
        thirdLevelSerials.put(serials[1], family);
        thirdLevelSerials.put(serials[2], comedy);
*/


        // all data
        data.add(thirdLevelMovies);
        data.add(thirdLevelGames);
        //data.add(thirdLevelSerials);


        // expandable listview
        expandableListView = (ExpandableListView) findViewById(R.id.expandible_listview);

        // parent adapter
        ThreeLevelListAdapter threeLevelListAdapterAdapter = new ThreeLevelListAdapter(this, parent, secondLevel, data);


        // set adapter
        expandableListView.setAdapter( threeLevelListAdapterAdapter );


        // OPTIONAL : Show one list at a time
        expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
            int previousGroup = -1;

            @Override
            public void onGroupExpand(int groupPosition) {
                if (groupPosition != previousGroup)
                    expandableListView.collapseGroup(previousGroup);
                previousGroup = groupPosition;
            }
        });


    }
 
Example 12
Project: Chorus-RF-Laptimer   File: RaceResultFragment.java   Source Code and License Vote up 4 votes
public void useNewAdapter() {
    ExpandableListView listView = (ExpandableListView)mRootView.findViewById(R.id.elvResults);
    mAdapter = new RaceResultsListAdapter(getContext(), AppState.getInstance().raceResults);
    listView.setAdapter(mAdapter);
}
 
Example 13
Project: DoApp   File: ExceptionListActivity.java   Source Code and License Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_exception_list);
    componentName = getIntent().getStringExtra("componentName");

    tvName = (TextView) findViewById(R.id.textViewComponentName);
    tvName.setText(componentName);

    List<ExceptionReport> reportsFiltered = filterByComponentName(GlobalClass.reports);
    List<String> exceptionTypes = getExceptionTypesFromReports(reportsFiltered);

    mapIntent = organizeMalIntentssByExceptionType(exceptionTypes, reportsFiltered);


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

    ExpandableListAdapter listAdapter = new MalIntentExpandableListAdapter(this, exceptionTypes, mapIntent);

    // setting list adapter
    expListView.setAdapter(listAdapter);

}