• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MaterialSimpleListItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem的典型用法代码示例。如果您正苦于以下问题:Java MaterialSimpleListItem类的具体用法?Java MaterialSimpleListItem怎么用?Java MaterialSimpleListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MaterialSimpleListItem类属于com.afollestad.materialdialogs.simplelist包,在下文中一共展示了MaterialSimpleListItem类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: showSimpleList

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@OnClick(R.id.simpleList) public void showSimpleList() {
    final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter((dialog, index1, item) -> showToast(item.getContent().toString()));
    adapter.add(new MaterialSimpleListItem.Builder(this)
            .content("[email protected]")
            .icon(R.drawable.ic_account_circle)
            .backgroundColor(Color.WHITE)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(this)
            .content("[email protected]")
            .icon(R.drawable.ic_account_circle)
            .backgroundColor(Color.WHITE)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(this)
            .content(R.string.add_account)
            .icon(R.drawable.ic_content_add)
            .iconPaddingDp(8)
            .build());

    new MaterialDialog.Builder(this)
            .title(R.string.set_backup)
            .adapter(adapter, null)
            .show();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:MainActivity.java


示例2: onBindViewHolder

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@Override
public void onBindViewHolder(SimpleListVH holder, int position) {
    if (dialog != null) {
        final MaterialSimpleListItem item = mItems.get(position);
        if (item.getIcon() != null) {
            holder.icon.setImageDrawable(item.getIcon());
            holder.icon.setPadding(item.getIconPadding(), item.getIconPadding(),
                    item.getIconPadding(), item.getIconPadding());
            holder.icon.getBackground().setColorFilter(item.getBackgroundColor(),
                    PorterDuff.Mode.SRC_ATOP);
        } else {
            holder.icon.setVisibility(View.GONE);
        }
        holder.title.setTextColor(dialog.getBuilder().getItemColor());
        holder.title.setText(item.getContent());
        dialog.setTypeface(holder.title, dialog.getBuilder().getRegularFont());
    }
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:19,代码来源:DialogAdapter.java


示例3: showSimpleList

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@OnClick(R.id.simpleList)
public void showSimpleList() {
  final MaterialSimpleListAdapter adapter =
      new MaterialSimpleListAdapter(
          (dialog, index1, item) -> showToast(item.getContent().toString()));
  adapter.add(
      new MaterialSimpleListItem.Builder(this)
          .content("[email protected]")
          .icon(R.drawable.ic_account_circle)
          .backgroundColor(Color.WHITE)
          .build());
  adapter.add(
      new MaterialSimpleListItem.Builder(this)
          .content("[email protected]")
          .icon(R.drawable.ic_account_circle)
          .backgroundColor(Color.WHITE)
          .build());
  adapter.add(
      new MaterialSimpleListItem.Builder(this)
          .content(R.string.add_account)
          .icon(R.drawable.ic_content_add)
          .iconPaddingDp(8)
          .build());

  new MaterialDialog.Builder(this).title(R.string.set_backup).adapter(adapter, null).show();
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:27,代码来源:MainActivity.java


示例4: getThemeDialogAdapterItem

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
private static MaterialSimpleListItem getThemeDialogAdapterItem(@StringRes int title, @DrawableRes int icon, String currentTheme, Activity activity) {
	MaterialSimpleListItem.Builder builder = new MaterialSimpleListItem.Builder(activity)
			.content(title)
			.icon(icon);

	return builder.build();
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:8,代码来源:DialogService.java


示例5: onBuildLongClicked

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@Override
public void onBuildLongClicked(final BuildViewHolder buildViewHolder) {
    Context context = getActivity();
    final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(new MaterialSimpleListAdapter.Callback() {
        @Override
        public void onMaterialListItemSelected(MaterialDialog dialog, int index, MaterialSimpleListItem item) {
            long buildId = buildViewHolder.viewModel.getBuildId();
            switch (index) {
                case 0:
                    editBuild(buildId);
                    break;
                case 1:
                    confirmDeleteBuild(buildId);
                    break;
                case 2:
                    exportBuild(buildId);
                    break;
                default:
                    Timber.e("Unknown context menu item selected, index = " + index);
                    break;
            }
            dialog.dismiss();
        }
    });
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(R.string.menu_edit_build)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(R.string.menu_delete_build)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(R.string.menu_export_build)
            .build());

    new MaterialDialog.Builder(context)
            .title(buildViewHolder.viewModel.getName())
            .adapter(adapter, null)
            .show();
}
 
开发者ID:kiwiandroiddev,项目名称:starcraft-2-build-player,代码行数:40,代码来源:RaceFragment.java


示例6: list

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@ReactMethod
public void list(ReadableMap options, final Callback callback) {
    final MaterialSimpleListAdapter simpleListAdapter = new MaterialSimpleListAdapter(getCurrentActivity());

    ReadableArray arr = options.getArray("items");
    for(int i = 0; i < arr.size(); i++){
        simpleListAdapter.add(new MaterialSimpleListItem.Builder(getCurrentActivity())
                .content(arr.getString(i))
                .build());
    }

    final MaterialDialog.Builder adapter = new MaterialDialog.Builder(getCurrentActivity())
            .title(options.hasKey("title") ? options.getString("title") : "")
            .adapter(simpleListAdapter, new MaterialDialog.ListCallback() {
                @Override
                public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
                    callback.invoke(which, text);
                    if (simple != null) {
                        simple.dismiss();
                    }
                }
            })
            .autoDismiss(true);

    UiThreadUtil.runOnUiThread(new Runnable() {
        public void run() {
            if (simple != null) {
                simple.dismiss();
            }
            simple = adapter.build();
            simple.show();
        }
    });
}
 
开发者ID:aakashns,项目名称:react-native-dialogs,代码行数:35,代码来源:DialogAndroid.java


示例7: showProFeatures

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
public static MaterialDialog showProFeatures(final Context context) {
    final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(context);
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(context.getResources().getString(R.string.pro_feature_1))
            .icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_visibility_off).color(Color.GRAY).sizeDp(18))
            .backgroundColor(Color.WHITE)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(context.getResources().getString(R.string.pro_feature_2))
            .icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_list).color(Color.GRAY).sizeDp(18))
            .backgroundColor(Color.WHITE)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(context.getResources().getString(R.string.pro_feature_3))
            .icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_phonelink_erase).color(Color.GRAY).sizeDp(18))
            .backgroundColor(Color.WHITE)
            .build());
    adapter.add(new MaterialSimpleListItem.Builder(context)
            .content(context.getResources().getString(R.string.pro_feature_4))
            .icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_delete).color(Color.GRAY).sizeDp(18))
            .backgroundColor(Color.WHITE)
            .build());

    MaterialDialog.Builder materialBuilder = new MaterialDialog.Builder(context)
            .title(context.getResources().getString(R.string.action_buy) + " (" + context.getResources().getString(R.string.action_buy_description) + ")")
            .icon(ContextCompat.getDrawable(context, R.mipmap.ic_launcher_pro))
            .adapter(adapter, new MaterialDialog.ListCallback() {
                @Override
                public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence charSequence) {}
            })
            .positiveText(context.getResources().getString(R.string.action_buy) + " ($1.43)")
            .negativeText(context.getResources().getString(R.string.button_later))
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    UtilsApp.goToGooglePlay(context, MLManagerApplication.getProPackage());
                }
            });

    return materialBuilder.show();
}
 
开发者ID:javiersantos,项目名称:MLManager,代码行数:42,代码来源:UtilsDialog.java


示例8: add

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
public void add(MaterialSimpleListItem item) {
    mItems.add(item);
    notifyItemInserted(mItems.size() - 1);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:5,代码来源:DialogAdapter.java


示例9: getItem

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
public MaterialSimpleListItem getItem(int index) {
    return mItems.get(index);
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:4,代码来源:DialogAdapter.java


示例10: onClick

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
public void onClick() {
    TextContentView textContent = mBalloonTheme.getTextContentView();

    if (textContent == null)
        return;

    // Check for links. If none, do nothing; if 1, open it; if >1, ask user to pick one
    final URLSpan[] spans = textContent.getUrls();

    if (spans.length == 0) {
        // show the message details dialog
        MessageUtils.showMessageDetails(getContext(), mMessage, mPeer, mDisplayName);
    }
    else if (spans.length == 1) {
        // show link opener
        spans[0].onClick(textContent);
    }
    else {
        // complex stuff (media)
        URLSpanAdapterCallback click = new URLSpanAdapterCallback(textContent);
        final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(click);
        for (URLSpan span : spans) {
            MaterialSimpleListItem.Builder builder = new MaterialSimpleListItem.Builder(getContext())
                .tag(span);
            try {
                String url = span.getURL();
                Uri uri = Uri.parse(url);

                final String telPrefix = "tel:";
                if (url.startsWith(telPrefix)) {
                    // TODO handle country code
                    url = url.substring(telPrefix.length());
                }

                builder.content(url);

                Drawable d = getContext().getPackageManager().getActivityIcon(
                    new Intent(Intent.ACTION_VIEW, uri));
                if (d != null) {
                    builder.icon(d).iconPadding(10);
                }

            }
            catch (android.content.pm.PackageManager.NameNotFoundException ex) {
                // it's ok if we're unable to set the drawable for this view - the user
                // can still use it
            }

            adapter.add(builder.build());
        }

        new MaterialDialog.Builder(getContext())
            .title(R.string.chooser_select_link)
            .cancelable(true)
            .adapter(adapter, null)
            .negativeText(android.R.string.cancel)
            .onNegative(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                }
            })
            .show();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:66,代码来源:MessageListItem.java


示例11: onMaterialListItemSelected

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
@Override
public void onMaterialListItemSelected(MaterialDialog dialog, int index, MaterialSimpleListItem item) {
    if (item != null && item.getTag() != null)
        ((URLSpan) item.getTag()).onClick(mParent);
    dialog.dismiss();
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:7,代码来源:MessageListItem.java


示例12: onListItemSelected

import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem; //导入依赖的package包/类
void onListItemSelected(int index, MaterialSimpleListItem item, boolean longClick); 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:2,代码来源:DialogAdapter.java



注:本文中的com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DebuggerException类代码示例发布时间:2022-05-22
下一篇:
Java PhpPsiUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap