本文整理汇总了Java中org.telegram.messenger.LocaleController类的典型用法代码示例。如果您正苦于以下问题:Java LocaleController类的具体用法?Java LocaleController怎么用?Java LocaleController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocaleController类属于org.telegram.messenger包,在下文中一共展示了LocaleController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchDraw
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mAdapter == null || headers.isEmpty()) {
return;
}
for (View header : headers) {
int saveCount = canvas.save();
int top = (Integer)header.getTag();
canvas.translate(LocaleController.isRTL ? getWidth() - header.getWidth() : 0, top);
canvas.clipRect(0, 0, getWidth(), header.getMeasuredHeight());
if (top < 0) {
canvas.saveLayerAlpha(0, top, header.getWidth(), top + canvas.getHeight(), (int)(255 * (1.0f + (float)top / (float)header.getMeasuredHeight())), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
}
header.draw(canvas);
canvas.restoreToCount(saveCount);
}
}
示例2: getHeaderTitle
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private String getHeaderTitle() {
SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
int value = themePrefs.getInt("chatsHeaderTitle", 0);
String title = LocaleController.getString("AppName", R.string.AppName);
TLRPC.User user = UserConfig.getCurrentUser();
if (value == 1) {
title = LocaleController.getString("ShortAppName", R.string.ShortAppName);
} else if (value == 2) {
if (user != null && (user.first_name != null || user.last_name != null)) {
title = ContactsController.formatName(user.first_name, user.last_name);
}
} else if (value == 3) {
if (user != null && user.username != null && user.username.length() != 0) {
title = "@" + user.username;
}
} else if (value == 4) {
title = "";
}
return title;
}
示例3: updateSelectedCount
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public void updateSelectedCount() {
SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
int textColor = themePrefs.getInt("chatAttachTextColor", 0xff3ec1f9);
if (selectedDialogs.isEmpty()) {
doneButtonBadgeTextView.setVisibility(View.GONE);
if (!isPublicChannel) {
doneButtonTextView.setTextColor(Theme.SHARE_SHEET_SEND_DISABLED_TEXT_COLOR);
doneButton.setEnabled(false);
doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
} else {
doneButtonTextView.setTextColor(Theme.SHARE_SHEET_COPY_TEXT_COLOR);
doneButton.setEnabled(true);
doneButtonTextView.setText(LocaleController.getString("CopyLink", R.string.CopyLink).toUpperCase());
}
} else {
doneButtonTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
doneButtonBadgeTextView.setVisibility(View.VISIBLE);
doneButtonBadgeTextView.setText(String.format("%d", selectedDialogs.size()));
doneButtonTextView.setTextColor(Theme.SHARE_SHEET_SEND_TEXT_COLOR);
doneButton.setEnabled(true);
doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
}
doneButtonTextView.setTextColor(textColor);
}
示例4: generateLink
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void generateLink() {
if (loadingInvite || invite != null) {
return;
}
loadingInvite = true;
TLRPC.TL_channels_exportInvite req = new TLRPC.TL_channels_exportInvite();
req.channel = MessagesController.getInputChannel(chatId);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (error == null) {
invite = (TLRPC.ExportedChatInvite) response;
}
loadingInvite = false;
privateContainer.setText(invite != null ? invite.link : LocaleController.getString("Loading", R.string.Loading), false);
}
});
}
});
}
示例5: shareMyContact
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public void shareMyContact(final MessageObject messageObject) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("ShareYouPhoneNumberTitle", R.string.ShareYouPhoneNumberTitle));
if (currentUser != null) {
if (currentUser.bot) {
builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfoBot", R.string.AreYouSureShareMyContactInfoBot));
} else {
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureShareMyContactInfoUser", R.string.AreYouSureShareMyContactInfoUser, PhoneFormat.getInstance().format("+" + UserConfig.getCurrentUser().phone), ContactsController.formatName(currentUser.first_name, currentUser.last_name))));
}
} else {
builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfo", R.string.AreYouSureShareMyContactInfo));
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SendMessagesHelper.getInstance().sendMessage(UserConfig.getCurrentUser(), dialog_id, messageObject, null, null);
moveScrollToLastMessage();
showReplyPanel(false, null, null, null, false, true);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
示例6: processSearch
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void processSearch(final String query) {
Utilities.searchQueue.postRunnable(new Runnable() {
@Override
public void run() {
String q = query.trim().toLowerCase();
if (q.length() == 0) {
updateSearchResults(new ArrayList<LocaleController.LocaleInfo>());
return;
}
long time = System.currentTimeMillis();
ArrayList<LocaleController.LocaleInfo> resultArray = new ArrayList<>();
for (LocaleController.LocaleInfo c : LocaleController.getInstance().sortedLanguages) {
if (c.name.toLowerCase().startsWith(query) || c.nameEnglish.toLowerCase().startsWith(query)) {
resultArray.add(c);
}
}
updateSearchResults(resultArray);
}
});
}
示例7: needRemoveHint
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public void needRemoveHint(final int did, BaseFragment fragment) {
if (fragment.getParentActivity() == null) {
return;
}
TLRPC.User user = MessagesController.getInstance().getUser(did);
if (user == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.formatString("ChatHintsDelete", R.string.ChatHintsDelete, ContactsController.formatName(user.first_name, user.last_name)));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SearchQuery.removePeer(did);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.show();
}
示例8: showErrorAlert
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void showErrorAlert(String error) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
switch (error) {
case "USERNAME_INVALID":
builder.setMessage(LocaleController.getString("LinkInvalid", R.string.LinkInvalid));
break;
case "USERNAME_OCCUPIED":
builder.setMessage(LocaleController.getString("LinkInUse", R.string.LinkInUse));
break;
case "USERNAMES_UNAVAILABLE":
builder.setMessage(LocaleController.getString("FeatureUnavailable", R.string.FeatureUnavailable));
break;
default:
builder.setMessage(LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred));
break;
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
示例9: CustomUserCell
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public CustomUserCell(Context context) {
super(context);
avatarDrawable = new AvatarDrawable();
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER);
imageView.setVisibility(GONE);
addView(imageView, LayoutHelper.createFrame(LayoutParams.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,(Gravity.CENTER | Gravity.TOP),5, 5,5, 5));
avatarImageView = new BackupImageView(context);
avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
addView(avatarImageView, LayoutHelper.createFrame(48, 48, Gravity.CENTER | Gravity.TOP, 5, 5,5, 5));
nameTextView = new SimpleTextView(context);
nameTextView.setTextColor(0xff212121);
nameTextView.setTextSize(15);
nameTextView.setGravity(Gravity.CENTER | Gravity.BOTTOM);
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 3,3,3,3));
}
示例10: setMultilineText
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public void setMultilineText(boolean value) {
multiline = value;
if (value) {
textView.setLines(0);
textView.setMaxLines(0);
textView.setSingleLine(false);
textView.setPadding(0, 0, 0, AndroidUtilities.dp(35));
removeView(valueTextView);
addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM, 17, 0, 17, 12));
} else {
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setPadding(0, 0, 0, 0);
}
}
示例11: updateUserData
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void updateUserData() {
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
TLRPC.FileLocation photo = null;
TLRPC.FileLocation photoBig = null;
if (user.photo != null) {
photo = user.photo.photo_small;
photoBig = user.photo.photo_big;
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
//avatarDrawable.setColor(Theme.ACTION_BAR_MAIN_AVATAR_COLOR);
avatarDrawable.setColor(AndroidUtilities.getIntDef("prefAvatarColor", AndroidUtilities.getIntDarkerColor("themeColor", 0x10)));
int radius = AndroidUtilities.dp(AndroidUtilities.getIntDef("prefAvatarRadius", 32));
avatarImage.getImageReceiver().setRoundRadius(radius);
avatarDrawable.setRadius(radius);
if (avatarImage != null) {
avatarImage.setImage(photo, "50_50", avatarDrawable);
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
nameTextView.setText(UserObject.getUserName(user));
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
}
}
示例12: updatePhotosButton
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
public void updatePhotosButton() {
int count = photoAttachAdapter.getSelectedPhotos().size();
if (count == 0) {
sendPhotosButton.imageView.setPadding(0, AndroidUtilities.dp(4), 0, 0);
sendPhotosButton.imageView.setBackgroundResource(R.drawable.attach_hide_states);
sendPhotosButton.imageView.setImageResource(R.drawable.attach_hide2);
sendPhotosButton.textView.setText("");
} else {
sendPhotosButton.imageView.setPadding(AndroidUtilities.dp(2), 0, 0, 0);
//sendPhotosButton.imageView.setBackgroundResource(R.drawable.attach_send_states);
SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
Drawable send = getResources().getDrawable(R.drawable.attach_send1);
send.setColorFilter(themePrefs.getInt("themeColor", AndroidUtilities.defColor), PorterDuff.Mode.SRC_IN);
sendPhotosButton.imageView.setBackgroundDrawable(getResources().getDrawable(R.drawable.attach_send_states));
sendPhotosButton.imageView.setImageResource(R.drawable.attach_send2);
sendPhotosButton.textView.setText(LocaleController.formatString("SendItems", R.string.SendItems, String.format("(%d)", count)));
}
if (Build.VERSION.SDK_INT >= 23 && getContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
progressView.setText(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
progressView.setTextSize(16);
} else {
progressView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
progressView.setTextSize(20);
}
}
示例13: showErrorAlert
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void showErrorAlert(String error) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
switch (error) {
case "USERNAME_INVALID":
builder.setMessage(LocaleController.getString("UsernameInvalid", R.string.UsernameInvalid));
break;
case "USERNAME_OCCUPIED":
builder.setMessage(LocaleController.getString("UsernameInUse", R.string.UsernameInUse));
break;
case "USERNAMES_UNAVAILABLE":
builder.setMessage(LocaleController.getString("FeatureUnavailable", R.string.FeatureUnavailable));
break;
default:
builder.setMessage(LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred));
break;
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
示例14: updateUserData
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
private void updateUserData() {
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
TLRPC.FileLocation photo = null;
TLRPC.FileLocation photoBig = null;
if (user.photo != null) {
photo = user.photo.photo_small;
photoBig = user.photo.photo_big;
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
avatarDrawable.setColor(Theme.ACTION_BAR_MAIN_AVATAR_COLOR);
if (avatarImage != null) {
avatarImage.setImage(photo, "50_50", avatarDrawable);
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
nameTextView.setText(UserObject.getUserName(user));
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false);
}
}
示例15: createView
import org.telegram.messenger.LocaleController; //导入依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("AboutUs", R.string.AboutUs));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
finishFragment();
}
});
fragmentView = getParentActivity().getLayoutInflater().inflate(R.layout.about, null, false);
TextView tv1 = (TextView) fragmentView.findViewById(R.id.text_);
TextView tv2 = (TextView) fragmentView.findViewById(R.id.name_);
TextView tv4 = (TextView) fragmentView.findViewById(R.id.nazar_);
TextView tv5 = (TextView) fragmentView.findViewById(R.id.apps_);
CardView c1 = (CardView) fragmentView.findViewById(R.id.about_1);
CardView c3 = (CardView) fragmentView.findViewById(R.id.about_3);
CardView c4 = (CardView) fragmentView.findViewById(R.id.about_4);
c1.setOnClickListener(this);
c3.setOnClickListener(this);
c4.setOnClickListener(this);
FontManager.instance().setTypefaceImmediate(fragmentView);
return fragmentView;
}