本文整理汇总了Java中com.yarolegovich.lovelydialog.LovelyCustomDialog类的典型用法代码示例。如果您正苦于以下问题:Java LovelyCustomDialog类的具体用法?Java LovelyCustomDialog怎么用?Java LovelyCustomDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LovelyCustomDialog类属于com.yarolegovich.lovelydialog包,在下文中一共展示了LovelyCustomDialog类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newProjectDialog
import com.yarolegovich.lovelydialog.LovelyCustomDialog; //导入依赖的package包/类
private void newProjectDialog() {
mProjectDialog = new LovelyCustomDialog(this, mDarkTheme ? R.style.EditTextTintThemeDark : R.style.EditTextTintTheme)
.setView(R.layout.project_form)
.setTopColor(mPrimaryColor)
.setIcon(R.drawable.ic_notepad)
.setListener(R.id.projectDoneButton, new View.OnClickListener() {
@Override
public void onClick(View v) {
createProjectFromDialog();
}
})
.show();
//get the views
mProjectError = (TextView) mProjectDialog.findViewById(R.id.project_error_message);
mProjectField = (EditText) mProjectDialog.findViewById(R.id.editProjectName);
//hide error when text change
mProjectField.addTextChangedListener(this);
mProjectField.setHighlightColor(Color.LTGRAY);
mProjectField.setOnFocusChangeListener(this);
//request focus on the edit text
if (mProjectField.requestFocus()) {
mProjectDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
示例2: setupDialogs
import com.yarolegovich.lovelydialog.LovelyCustomDialog; //导入依赖的package包/类
private void setupDialogs() {
AnimatedRecyclerView movesList = new AnimatedRecyclerView(context);
movesList.setLayoutManager(new LinearLayoutManager(context));
movesList.setHasFixedSize(true);
movesList.setAdapter(new MoveListAdapter(context, profile.getMoves()));
movesDialog = new LovelyCustomDialog(context)
.setTopColorRes(R.color.colorPrimary)
.setTitle(R.string.moveset)
.setIcon(R.drawable.ic_book_white_24dp)
.setView(movesList)
.setCancelable(true);
PokemonListItem[] evolutions = profile.getEvolutions();
AnimatedRecyclerView evolutionsList = new AnimatedRecyclerView(context);
evolutionsList.setLayoutManager(new LinearLayoutManager(context));
evolutionsList.setHasFixedSize(true);
evolutionsList.setAdapter(new PokemonListAdapter(context, evolutions, true));
evolutionsDialog = new LovelyCustomDialog(context)
.setTopColorRes(R.color.colorPrimary)
.setView(evolutionsList)
.setIcon(R.drawable.ic_group_work_white_24dp)
.setCancelable(true);
if (evolutions.length == 0) {
evolutionsDialog.setTitle(context.getString(R.string.no_evolutions));
evolutionsDialog.setMessage(String.format(context.getString(R.string.no_evolutions_message),
profile.getName()));
}
else {
evolutionsDialog.setTitle(context.getString(R.string.evolutions));
}
}
示例3: showItemDialog
import com.yarolegovich.lovelydialog.LovelyCustomDialog; //导入依赖的package包/类
private void showItemDialog() {
Context context = view.getContext();
DatabaseOpenHelper databaseHelper = DatabaseOpenHelper.getInstance(context);
int imageResourceId = context.getResources().getIdentifier(item.getIdentifier(),
DRAWABLE, context.getPackageName());
String cost = String.valueOf(item.getCost());
String description;
if (item.getDescription() == null) {
description = databaseHelper.queryItemDescription(item.getId());
item.setDescription(description);
}
else {
description = item.getDescription();
}
if (cost.equals(NONE)) {
cost = NA;
}
ItemInfoView infoView = new ItemInfoView(context);
infoView.setFields(cost, imageResourceId, description);
new LovelyCustomDialog(view.getContext())
.setCancelable(true)
.setTopColorRes(R.color.colorPrimary)
.setIcon(R.drawable.ic_business_center_white_24dp)
.setTitle(item.getName())
.setView(infoView)
.show();
}
示例4: showFontDetailsDialog
import com.yarolegovich.lovelydialog.LovelyCustomDialog; //导入依赖的package包/类
public void showFontDetailsDialog(Context context, String title, String message, double rating,
int ratingCount) {
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View viewFontDetails = inflater.inflate(R.layout.dialog_font_details, null);
//To make sure Font FileName doesn't end up as a clickable url because it is automatically
//turned into a url
final SpannableString content = new SpannableString(message);
Linkify.addLinks(content, Patterns.WEB_URL, null, new Linkify.MatchFilter() {
@Override
public boolean acceptMatch(CharSequence seq, int start, int end) {
String url = seq.subSequence(start, end).toString();
//Apply the default matcher too. This will remove filenames that matched.
return !url.contains(".ttf") && Linkify.sUrlMatchFilter
.acceptMatch(seq, start, end);
}
}, null);
TextView tvMessage = (TextView) viewFontDetails
.findViewById(R.id.text_font_details_message);
if (tvMessage != null) {
tvMessage.setText(content);
tvMessage.setMovementMethod(LinkMovementMethod.getInstance()); //Making link clickable
tvMessage.setLinkTextColor(ContextCompat.getColor(context, R.color.blue));
}
final Dialog dialog = new LovelyCustomDialog(context)
.setView(viewFontDetails)
.setTopColorRes(R.color.colorPrimaryLight)
.setTitle(title)
.setIcon(R.drawable.ic_info_outline)
.show();
TextView btnGotIt = (TextView) viewFontDetails.findViewById(R.id.button_font_details_got_it);
btnGotIt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
}
});
TextView tvRating = (TextView) viewFontDetails.findViewById(R.id.tv_rating);
Resources res = getResources();
String text = res.getQuantityString(R.plurals.dialog_font_rating, ratingCount,
formatToOneDecimalPlace(rating),
formatToOneDecimalPlace(res.getInteger(R.integer.rating_max_possible_value)),
ratingCount);
tvRating.setText(text);
}