本文整理汇总了Java中org.telegram.ui.ActionBar.Theme.isCustomTheme方法的典型用法代码示例。如果您正苦于以下问题:Java Theme.isCustomTheme方法的具体用法?Java Theme.isCustomTheme怎么用?Java Theme.isCustomTheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.ui.ActionBar.Theme
的用法示例。
在下文中一共展示了Theme.isCustomTheme方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import org.telegram.ui.ActionBar.Theme; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
Drawable backgroundDrawable = Theme.getCachedWallpaper();
int color;
if (Theme.hasThemeKey(Theme.key_chats_menuTopShadow)) {
color = Theme.getColor(Theme.key_chats_menuTopShadow);
} else {
color = Theme.getServiceMessageColor() | 0xff000000;
}
if (currentColor == null || currentColor != color) {
currentColor = color;
shadowView.getDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
}
nameTextView.setTextColor(Theme.getColor(Theme.key_chats_menuName));
if (Theme.isCustomTheme() && backgroundDrawable != null) {
phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhone));
shadowView.setVisibility(VISIBLE);
if (backgroundDrawable instanceof ColorDrawable) {
backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
backgroundDrawable.draw(canvas);
} else if (backgroundDrawable instanceof BitmapDrawable) {
Bitmap bitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
float scaleX = (float) getMeasuredWidth() / (float) bitmap.getWidth();
float scaleY = (float) getMeasuredHeight() / (float) bitmap.getHeight();
float scale = scaleX < scaleY ? scaleY : scaleX;
int width = (int) (getMeasuredWidth() / scale);
int height = (int) (getMeasuredHeight() / scale);
int x = (bitmap.getWidth() - width) / 2;
int y = (bitmap.getHeight() - height) / 2;
srcRect.set(x, y, x + width, y + height);
destRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
try {
canvas.drawBitmap(bitmap, srcRect, destRect, paint);
} catch (Throwable e) {
FileLog.e(e);
}
}
} else {
shadowView.setVisibility(INVISIBLE);
phoneTextView.setTextColor(Theme.getColor(Theme.key_chats_menuPhoneCats));
super.onDraw(canvas);
}
}
示例2: onShow
import org.telegram.ui.ActionBar.Theme; //导入方法依赖的package包/类
public void onShow() {
Activity parentActivity = (Activity) getContext();
if (UserConfig.passcodeType == 1) {
if (passwordEditText != null) {
passwordEditText.requestFocus();
AndroidUtilities.showKeyboard(passwordEditText);
}
} else {
if (parentActivity != null) {
View currentFocus = parentActivity.getCurrentFocus();
if (currentFocus != null) {
currentFocus.clearFocus();
AndroidUtilities.hideKeyboard(((Activity) getContext()).getCurrentFocus());
}
}
}
checkFingerprint();
if (getVisibility() == View.VISIBLE) {
return;
}
setAlpha(1.0f);
setTranslationY(0);
if (Theme.isCustomTheme()) {
backgroundDrawable = Theme.getCachedWallpaper();
backgroundFrameLayout.setBackgroundColor(0xbf000000);
} else {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
int selectedBackground = preferences.getInt("selectedBackground", 1000001);
if (selectedBackground == 1000001) {
backgroundFrameLayout.setBackgroundColor(0xff517c9e);
} else {
backgroundDrawable = Theme.getCachedWallpaper();
if (backgroundDrawable != null) {
backgroundFrameLayout.setBackgroundColor(0xbf000000);
} else {
backgroundFrameLayout.setBackgroundColor(0xff517c9e);
}
}
}
passcodeTextView.setText(LocaleController.getString("EnterYourPasscode", R.string.EnterYourPasscode));
if (UserConfig.passcodeType == 0) {
//InputFilter[] filterArray = new InputFilter[1];
//filterArray[0] = new InputFilter.LengthFilter(4);
//passwordEditText.setFilters(filterArray);
//passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
//passwordEditText.setFocusable(false);
//passwordEditText.setFocusableInTouchMode(false);
numbersFrameLayout.setVisibility(VISIBLE);
passwordEditText.setVisibility(GONE);
passwordEditText2.setVisibility(VISIBLE);
checkImage.setVisibility(GONE);
} else if (UserConfig.passcodeType == 1) {
passwordEditText.setFilters(new InputFilter[0]);
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
numbersFrameLayout.setVisibility(GONE);
passwordEditText.setFocusable(true);
passwordEditText.setFocusableInTouchMode(true);
passwordEditText.setVisibility(VISIBLE);
passwordEditText2.setVisibility(GONE);
checkImage.setVisibility(VISIBLE);
}
setVisibility(VISIBLE);
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
passwordEditText.setText("");
passwordEditText2.eraseAllCharacters(false);
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
}