本文整理汇总了Java中com.dou361.dialogui.DialogUIUtils类的典型用法代码示例。如果您正苦于以下问题:Java DialogUIUtils类的具体用法?Java DialogUIUtils怎么用?Java DialogUIUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DialogUIUtils类属于com.dou361.dialogui包,在下文中一共展示了DialogUIUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSingleChoose
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
protected BuildBean buildSingleChoose(final BuildBean bean) {
AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
singleChosen = bean.defaultChosen;
builder.setTitle(bean.title)
.setSingleChoiceItems(bean.wordsMd, bean.defaultChosen, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
singleChosen = i;
if (bean.itemListener != null) {
bean.itemListener.onItemClick(bean.wordsMd[i], i);
}
if (bean.listener == null) {
DialogUIUtils.dismiss(dialogInterface);
}
}
});
AlertDialog dialog = builder.create();
bean.alertDialog = dialog;
return bean;
}
示例2: btn_custom_click
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
public void btn_custom_click(View v) {
DialogUIUtils.showAlert(this, "自定义", "", "请输入网站名称", "请输入网站链接", "确认添加", "", false, false, true, new DialogUIListener() {
@Override
public void onPositive() {
}
@Override
public void onNegative() {
}
@Override
public void onGetInput(CharSequence input1, CharSequence input2) {
super.onGetInput(input1, input2);
//调用接口添加
}
}).show();
}
示例3: initData
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
private void initData() {
buildBean = DialogUIUtils.showMdLoading(this, "加载中...", true, true, false, true);
buildBean.show();
new Thread(new Runnable() {
@Override
public void run() {
SearchResult search = SearchSong.Search(getIntent().getExtras().getString(Constants.TYPE), getIntent().getExtras().getString(Constants.KEY), 1, 15);
if (search.getStatus() == 200) {
result = search.getSongs();
handler.sendEmptyMessage(REQUEST_SUCCESS);
} else {
handler.sendEmptyMessage(REQUEST_ERROR);
}
}
}).start();
}
示例4: handleMessage
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case REQUEST_SUCCESS:
DialogUIUtils.dismiss(buildBean);
if (result == null) {
handler.sendEmptyMessage(REQUEST_ERROR);
return true;
}
SongDetailAdapter searchResultAdapter = new SongDetailAdapter(SearchActivity.this, result);
searchResultAdapter.setOnMusicClickListener(SearchActivity.this);
search_list.setAdapter(searchResultAdapter);
break;
case REQUEST_ERROR:
DialogUIUtils.dismiss(buildBean);
Toast.makeText(SearchActivity.this, "获取信息失败", Toast.LENGTH_SHORT).show();
break;
}
return false;
}
示例5: onCreate
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mActivity = this;
mContext = getApplication();
DialogUIUtils.init(mContext);
}
示例6: fixContext
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
/**
* 混合上下文
*/
public static BuildBean fixContext(BuildBean bean) {
if (bean.mContext == null) {
bean.mContext = DialogUIUtils.appContext;
} else if (bean.mContext instanceof Activity) {
Activity activity = (Activity) bean.mContext;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (activity.isDestroyed()) {
bean.mContext = DialogUIUtils.appContext;
}
}
}
return bean;
}
示例7: setDialogStyle
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
public static void setDialogStyle(Context context, Dialog dialog, int measuredHeight, BuildBean bean) {
if (dialog == null) {
return;
}
Window window = dialog.getWindow();
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.setGravity(bean.gravity);
WindowManager.LayoutParams wl = window.getAttributes();
// 以下这两句是为了保证按钮可以水平满屏
int width = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
int height = (int) (((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight() * 0.9);
if (bean.type != DialogConfig.TYPE_MD_LOADING) {
wl.width = (int) (width * 0.94); // todo keycode to keep gap
} else {
wl.width = ViewGroup.LayoutParams.WRAP_CONTENT;
}
wl.height = ViewGroup.LayoutParams.WRAP_CONTENT; //TODO 一般情况下为wrapcontent,最大值为height*0.9
if (measuredHeight > height) {
wl.height = height;
}
if (context instanceof Activity) {
Activity activity1 = (Activity) context;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (activity1.isDestroyed()) {
context = DialogUIUtils.appContext;
}
}
} else {
wl.type = WindowManager.LayoutParams.TYPE_TOAST;
//todo keycode to improve window level,同时要让它的后面半透明背景也拦截事件,不要传递到下面去
//todo 单例化,不然连续弹出两次,只能关掉第二次的
}
dialog.onWindowAttributesChanged(wl);
}
示例8: getColor
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
/**
* 获取资源颜色
*/
public static int getColor(Context context, int colorRes) {
if (context == null) {
context = DialogUIUtils.appContext;
}
return context.getResources().getColor(colorRes);
}
示例9: initData
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
private void initData() {
buildBean = DialogUIUtils.showMdLoading(this, "加载中...", true, true, false, true);
KeyWord = getIntent().getStringExtra(Constants.YinyueTai);
if (KeyWord.isEmpty()) {
return;
}
requestData(KeyWord);
}
示例10: showToast
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
public void showToast(CharSequence msg) {
DialogUIUtils.showToastLong(msg.toString());
}
示例11: assingDatasAndEvents
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
@Override
public void assingDatasAndEvents(final Context context, final BuildBean bean) {
if (TextUtils.isEmpty(bean.bottomTxt)) {
btnBottom.setVisibility(View.GONE);
} else {
btnBottom.setVisibility(View.VISIBLE);
btnBottom.setText(bean.bottomTxt);
btnBottom.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DialogUIUtils.dismiss(bean.dialog, bean.alertDialog);
bean.itemListener.onBottomBtnClick();
}
});
}
if (TextUtils.isEmpty(bean.title)) {
tvTitle.setVisibility(View.GONE);
} else {
tvTitle.setVisibility(View.VISIBLE);
tvTitle.setText(bean.title);
}
if (bean.isVertical) {
rView.setLayoutManager(new LinearLayoutManager(bean.mContext));
rView.addItemDecoration(new DialogUIDividerItemDecoration(bean.mContext));
} else {
rView.setLayoutManager(new GridLayoutManager(bean.mContext, bean.gridColumns));// 布局管理器。
}
rView.setHasFixedSize(true);// 如果Item够简单,高度是确定的,打开FixSize将提高性能。
rView.setItemAnimator(new DefaultItemAnimator());// 设置Item默认动画,加也行,不加也行。
if (bean.mAdapter == null) {
TieAdapter adapter = new TieAdapter(bean.mContext, bean.mLists, isItemType);
bean.mAdapter = adapter;
}
rView.setAdapter(bean.mAdapter);
bean.mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
DialogUIUtils.dismiss(bean.dialog, bean.alertDialog);
bean.itemListener.onItemClick(bean.mLists.get(position).getTitle(), position);
}
});
}
示例12: handleMessage
import com.dou361.dialogui.DialogUIUtils; //导入依赖的package包/类
@Override
public boolean handleMessage(Message message) {
switch (message.what) {
case 0:
DialogUIUtils.dismiss(buildBean);
dataBean = JSON.parseObject(message.obj.toString(), MvBean.class).getData();
if (dataBean == null) {
Toast.makeText(SearchMvActivity.this, "获取数据失败", Toast.LENGTH_SHORT).show();
return false;
}
mAdapter = new MvDetailAdatper(SearchMvActivity.this, dataBean);
mAdapter.setOnVideoClickListener(SearchMvActivity.this);
recyclerView.setAdapter(mAdapter);
break;
case 1:
DialogUIUtils.dismiss(buildBean);
Toast.makeText(SearchMvActivity.this, "获取数据失败", Toast.LENGTH_SHORT).show();
break;
case 2:
MvPlayBean mv = JSON.parseObject(message.getData().getString("response"), MvPlayBean.class);
String mvUrl;
String ShdUrl = mv.getData().getShdUrl();
String uhdUrl = mv.getData().getUhdUrl();
String hdUrl = mv.getData().getHdUrl();
String mdUrl = mv.getData().getUrl();
if (!TextUtils.isEmpty(ShdUrl)) {
mvUrl = ShdUrl;
} else if (!TextUtils.isEmpty(uhdUrl)) {
mvUrl = uhdUrl;
} else if (!TextUtils.isEmpty(hdUrl)) {
mvUrl = hdUrl;
} else if (!TextUtils.isEmpty(mdUrl)) {
mvUrl = mdUrl;
} else {
Toast.makeText(SearchMvActivity.this, "获取播放链接失败!", Toast.LENGTH_SHORT).show();
return false;
}
String songName = message.getData().getString("name");
Intent i = new Intent(SearchMvActivity.this, VideoActivity.class);
Bundle bundle = new Bundle();
bundle.putString(Constants.NAME, songName);
bundle.putString(Constants.URL, mvUrl);
i.putExtras(bundle);
startActivity(i);
break;
}
return false;
}