Tabnine Logo
OptionListDialog
Code IndexAdd Tabnine to your IDE (free)

How to use
OptionListDialog
in
cc.duduhuo.dialog.smartisan

Best Java code snippets using cc.duduhuo.dialog.smartisan.OptionListDialog (Showing top 7 results out of 315)

origin: liying2008/SmartisanDialog

  @Override
  public void onClick(View v) {
    dismiss();
  }
});
origin: liying2008/SmartisanDialog

/**
 * Create an Options List dialog
 *
 * @param context
 * @return
 */
public static OptionListDialog createOptionListDialog(Context context) {
  return new OptionListDialog(context);
}
origin: liying2008/SmartisanDialog

private void findViews() {
  mTvTitle = (TextView) findViewById(R.id.tvTitle);
  mTvCancel = (TextView) findViewById(R.id.tvCancel);
  mRvOptions = (RecyclerView) findViewById(R.id.rvOptions);
  mRvOptions.setLayoutManager(new LinearLayoutManager(mContext));
}
origin: liying2008/SmartisanDialog

/**
 * 选项列表Dialog
 *
 * @param view
 */
public void optionListDialog(View view) {
  String[] options = new String[]{"选项1", "选项2", "选项3", "选项4", "选项5", "选项6"};
  final OptionListDialog dialog = SmartisanDialog.createOptionListDialog(this);
  dialog.setTitle("请选择一个选项")
    .setOptionList(options)
    .setLastOption("选项5")   // 上次选择的选项
    .setItemGravity(Gravity.CENTER) // Item是居左、居中还是居右
    .setLastColor(0xFF40B64A)   // 上次选择的选项显示的颜色,用于区分
    .show();
  // setOnOptionItemSelectListener()方法必须在show()方法之后调用,否则无效
  dialog.setOnOptionItemSelectListener(new OnOptionItemSelectListener() {
    @Override
    public void onSelect(int position, CharSequence option) {
      Toast.makeText(MainActivity.this, "position = " + position + ", option = " + option, Toast.LENGTH_SHORT).show();
      dialog.dismiss();
    }
  });
}
origin: liying2008/SmartisanDialog

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ddh_sm_dialog_option_list);
  findViews();
  Window window = getWindow();
  window.setBackgroundDrawableResource(android.R.color.transparent);
  window.setGravity(Gravity.BOTTOM);
  window.setWindowAnimations(R.style.ddh_sm_BottomDialogStyle);
}
origin: liying2008/SmartisanDialog

@Override
public void show() {
  super.show();
  if (!TextUtils.isEmpty(mTitle)) {
    mTvTitle.setText(mTitle);
  }
  if (!TextUtils.isEmpty(mCancel)) {
    mTvCancel.setText(mCancel);
  }
  mOptionListAdapter = new OptionListAdapter(mOptions, mLastSelect, mLastColor);
  mOptionListAdapter.setItemGravity(mItemGravity);
  mRvOptions.setAdapter(mOptionListAdapter);
  mTvCancel.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      dismiss();
    }
  });
  getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
}
origin: liying2008/SmartisanDialog

  @Override
  public void onSelect(int position, CharSequence option) {
    Toast.makeText(MainActivity.this, "position = " + position + ", option = " + option, Toast.LENGTH_SHORT).show();
    dialog.dismiss();
  }
});
cc.duduhuo.dialog.smartisanOptionListDialog

Javadoc

=======================================================
Author: liying - liruoer2008@yeah.net
Date: 2017/5/13 16:15
Version: 1.0
Description: TwoOptionsDialog
Remark:
=======================================================

Most used methods

  • dismiss
  • <init>
  • findViewById
  • findViews
  • getWindow
  • setContentView
  • setItemGravity
    Set the gravity of every item
  • setLastColor
    Set the color of the last selected option
  • setLastOption
    Set the last selected option
  • setOnOptionItemSelectListener
    Set the listener This method must be called after the show() method
  • setOptionList
    Set the list of options
  • setTitle
    Set the dialog title
  • setOptionList,
  • setTitle,
  • show

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JFileChooser (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now