本文整理汇总了Java中org.telegram.ui.ActionBar.BottomSheet类的典型用法代码示例。如果您正苦于以下问题:Java BottomSheet类的具体用法?Java BottomSheet怎么用?Java BottomSheet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BottomSheet类属于org.telegram.ui.ActionBar包,在下文中一共展示了BottomSheet类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareMessage
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
public void shareMessage(Context mContext, ArrayList<MessageObject> messages, boolean execludeName){
BottomSheet.Builder builder = new BottomSheet.Builder(mContext, true);
// check this
builder.setCustomView(new ShareFrameLayout(mContext, builder.create(), messages, execludeName));
builder.setUseFullWidth(false);
showDialog(builder.create());
}
示例2: openWebView
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
private void openWebView(TLRPC.WebPage webPage) {
BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
builder.setCustomView(new WebFrameLayout(getParentActivity(), builder.create(), webPage.site_name, webPage.description, webPage.url, webPage.embed_url, webPage.embed_width, webPage.embed_height));
builder.setUseFullWidth(true);
showDialog(builder.create());
}
示例3: createMuteAlert
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
public static Dialog createMuteAlert(Context context, final long dialog_id) {
if (context == null) {
return null;
}
BottomSheet.Builder builder = new BottomSheet.Builder(context);
builder.setTitle(LocaleController.getString("Notifications", R.string.Notifications));
CharSequence[] items = new CharSequence[]{
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 1)),
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 8)),
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Days", 2)),
LocaleController.getString("MuteDisable", R.string.MuteDisable)
};
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int untilTime = ConnectionsManager.getInstance().getCurrentTime();
if (i == 0) {
untilTime += 60 * 60;
} else if (i == 1) {
untilTime += 60 * 60 * 8;
} else if (i == 2) {
untilTime += 60 * 60 * 48;
} else if (i == 3) {
untilTime = Integer.MAX_VALUE;
}
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
long flags;
if (i == 3) {
editor.putInt("notify2_" + dialog_id, 2);
flags = 1;
} else {
editor.putInt("notify2_" + dialog_id, 3);
editor.putInt("notifyuntil_" + dialog_id, untilTime);
flags = ((long) untilTime << 32) | 1;
}
NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
MessagesStorage.getInstance().setDialogFlags(dialog_id, flags);
editor.commit();
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
dialog.notify_settings.mute_until = untilTime;
}
NotificationsController.updateServerNotificationsSettings(dialog_id);
}
}
);
return builder.create();
}
示例4: createReportAlert
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
public static Dialog createReportAlert(Context context, final long dialog_id, final BaseFragment parentFragment) {
if (context == null || parentFragment == null) {
return null;
}
BottomSheet.Builder builder = new BottomSheet.Builder(context);
builder.setTitle(LocaleController.getString("ReportChat", R.string.ReportChat));
CharSequence[] items = new CharSequence[]{
LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam),
LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence),
LocaleController.getString("ReportChatPornography", R.string.ReportChatPornography),
LocaleController.getString("ReportChatOther", R.string.ReportChatOther)
};
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == 3) {
Bundle args = new Bundle();
args.putLong("dialog_id", dialog_id);
parentFragment.presentFragment(new ReportOtherActivity(args));
return;
}
TLRPC.TL_account_reportPeer req = new TLRPC.TL_account_reportPeer();
req.peer = MessagesController.getInputPeer((int) dialog_id);
if (i == 0) {
req.reason = new TLRPC.TL_inputReportReasonSpam();
} else if (i == 1) {
req.reason = new TLRPC.TL_inputReportReasonViolence();
} else if (i == 2) {
req.reason = new TLRPC.TL_inputReportReasonPornography();
}
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
}
);
return builder.create();
}
示例5: ShareFrameLayout
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
public ShareFrameLayout(Context context, BottomSheet bottomSheet, MessageObject messageObject){
this(context, bottomSheet, new ArrayList<MessageObject>(Arrays.asList(messageObject)), false);
}
示例6: copyPortionOfText
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
private void copyPortionOfText() {
final CharSequence messageContent = getMessageContent(this.selectedObject, attach_photo, false);
final AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
EditTextCaption editTextCaption = new EditTextCaption(getParentActivity());
editTextCaption.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
editTextCaption.setImeOptions(268435456);
editTextCaption.setInputType((editTextCaption.getInputType() | MessagesController.UPDATE_MASK_CHAT_ADMINS) | AccessibilityNodeInfoCompat.ACTION_SET_SELECTION);
editTextCaption.setSingleLine(false);
editTextCaption.setTextSize(attach_gallery, 18.0f);
editTextCaption.setGravity(80);
editTextCaption.setPadding(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f));
editTextCaption.setBackgroundDrawable(null);
editTextCaption.setTextColor(Theme.MSG_TEXT_COLOR);
editTextCaption.setHintTextColor(0xff0f0000);
editTextCaption.setText(messageContent);
BottomSheet.BottomSheetCell bottomSheetCell = new BottomSheet.BottomSheetCell(getParentActivity(), attach_gallery);
bottomSheetCell.setBackgroundResource(R.drawable.list_selector);
bottomSheetCell.setTextAndIcon(LocaleController.getString("CopyAllText", R.string.CopyAllText).toUpperCase(), attach_photo);
bottomSheetCell.setTextColor(Theme.AUTODOWNLOAD_SHEET_SAVE_TEXT_COLOR);
bottomSheetCell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getParentActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", messageContent);
if (copyDialog != null) {
copyDialog.dismiss();
}
}
});
BottomSheet.BottomSheetCell bottomSheetCell2 = new BottomSheet.BottomSheetCell(getParentActivity(), attach_gallery);
bottomSheetCell2.setBackgroundResource(R.drawable.list_selector);
bottomSheetCell2.setTextAndIcon(LocaleController.getString("Close", R.string.Close).toUpperCase(), attach_photo);
bottomSheetCell2.setTextColor(Theme.AUTODOWNLOAD_SHEET_SAVE_TEXT_COLOR);
bottomSheetCell2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (copyDialog != null) {
copyDialog.dismiss();
}
}
});
LinearLayout linearLayout = new LinearLayout(getParentActivity());
linearLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout linearLayout2 = new LinearLayout(getParentActivity());
linearLayout2.setOrientation(LinearLayout.HORIZONTAL);
if (LocaleController.isRTL) {
linearLayout2.addView(bottomSheetCell2, LayoutHelper.createLinear(-2, 48, (float) DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
linearLayout2.addView(bottomSheetCell, LayoutHelper.createLinear(-2, 48, (float) DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
} else {
linearLayout2.addView(bottomSheetCell, LayoutHelper.createLinear(-2, 48, (float) DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
linearLayout2.addView(bottomSheetCell2, LayoutHelper.createLinear(-2, 48, (float) DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
}
linearLayout.addView(editTextCaption, LayoutHelper.createLinear(-1, -2, 3.0f));
linearLayout.addView(linearLayout2, LayoutHelper.createLinear(-1, 48, (float) DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
builder.setView(linearLayout);
// builder.setUseFullWidth(true);
copyDialog = builder.show();
}
示例7: run
import org.telegram.ui.ActionBar.BottomSheet; //导入依赖的package包/类
public void run() {
if (checkingForLongPress && windowView != null) {
checkingForLongPress = false;
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (pressedLink != null) {
final String urlFinal = pressedLink.getUrl();
BottomSheet.Builder builder = new BottomSheet.Builder(parentActivity);
builder.setTitle(urlFinal);
builder.setItems(new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, final int which) {
if (parentActivity == null) {
return;
}
if (which == 0) {
Browser.openUrl(parentActivity, urlFinal);
} else if (which == 1) {
String url = urlFinal;
if (url.startsWith("mailto:")) {
url = url.substring(7);
} else if (url.startsWith("tel:")) {
url = url.substring(4);
}
AndroidUtilities.addToClipboard(url);
}
}
});
showDialog(builder.create());
hideActionBar();
pressedLink = null;
pressedLinkOwnerLayout = null;
pressedLinkOwnerView.invalidate();
} else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) {
int y = pressedLinkOwnerView.getTop() - AndroidUtilities.dp(54) + pressedLayoutY;
int x;
if (y < 0) {
y *= -1;
}
pressedLinkOwnerView.invalidate();
drawBlockSelection = true;
showPopup(pressedLinkOwnerView, Gravity.TOP, 0, y);
listView.setLayoutFrozen(true);
listView.setLayoutFrozen(false);
}
}
}