Search in sources :

Example 1 with DialogMenuItem

use of com.flyco.dialog.entity.DialogMenuItem in project FlycoDialog_Master by H07000223.

the class DialogHomeActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_dialog_home);
    ButterKnife.bind(this);
    mMenuItems.add(new DialogMenuItem("收藏", R.mipmap.ic_winstyle_favor));
    mMenuItems.add(new DialogMenuItem("下载", R.mipmap.ic_winstyle_download));
    mMenuItems.add(new DialogMenuItem("分享", R.mipmap.ic_winstyle_share));
    mMenuItems.add(new DialogMenuItem("删除", R.mipmap.ic_winstyle_delete));
    mMenuItems.add(new DialogMenuItem("歌手", R.mipmap.ic_winstyle_artist));
    mMenuItems.add(new DialogMenuItem("专辑", R.mipmap.ic_winstyle_album));
    mBasIn = new BounceTopEnter();
    mBasOut = new SlideBottomExit();
    View decorView = getWindow().getDecorView();
    HomeAdapter adapter = new HomeAdapter(mContext);
    mElv.setAdapter(adapter);
    // extend all group
    for (int i = 0; i < mGroups.length; i++) {
        mElv.expandGroup(i);
    }
    mElv.setOnChildClickListener(this);
    mElv.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return true;
        }
    });
}
Also used : DialogMenuItem(com.flyco.dialog.entity.DialogMenuItem) BounceTopEnter(com.flyco.animation.BounceEnter.BounceTopEnter) SlideBottomExit(com.flyco.animation.SlideExit.SlideBottomExit) HomeAdapter(com.flyco.dialogsamples.adapter.HomeAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 2 with DialogMenuItem

use of com.flyco.dialog.entity.DialogMenuItem in project FlycoDialog_Master by H07000223.

the class TestAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final DialogMenuItem item = mMenuItems.get(position);
    LinearLayout ll_item = new LinearLayout(mContext);
    ll_item.setOrientation(LinearLayout.HORIZONTAL);
    ll_item.setGravity(Gravity.CENTER_VERTICAL);
    ImageView iv_item = new ImageView(mContext);
    iv_item.setPadding(0, 0, (int) (15 * mDisplayMetrics.density), 0);
    ll_item.addView(iv_item);
    TextView tv_item = new TextView(mContext);
    tv_item.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    tv_item.setSingleLine(true);
    tv_item.setTextColor(Color.parseColor("#303030"));
    tv_item.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
    ll_item.addView(tv_item);
    ll_item.setPadding(item.mResId == 0 ? (int) (18 * mDisplayMetrics.density) : (int) (16 * mDisplayMetrics.density), (int) (10 * mDisplayMetrics.density), 0, (int) (10 * mDisplayMetrics.density));
    iv_item.setImageResource(item.mResId);
    tv_item.setText(item.mOperName);
    iv_item.setVisibility(item.mResId == 0 ? View.GONE : View.VISIBLE);
    return ll_item;
}
Also used : DialogMenuItem(com.flyco.dialog.entity.DialogMenuItem) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

DialogMenuItem (com.flyco.dialog.entity.DialogMenuItem)2 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ExpandableListView (android.widget.ExpandableListView)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 BounceTopEnter (com.flyco.animation.BounceEnter.BounceTopEnter)1 SlideBottomExit (com.flyco.animation.SlideExit.SlideBottomExit)1 HomeAdapter (com.flyco.dialogsamples.adapter.HomeAdapter)1