Java Code Examples for org.telegram.messenger.AndroidUtilities#isSmallTablet()
The following examples show how to use
org.telegram.messenger.AndroidUtilities#isSmallTablet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setType(int value) { currentType = value; String help; if (currentType == 0) { help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } } else { help = LocaleController.getString("NoChatsContactsHelp", R.string.NoChatsContactsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } } emptyTextView2.setText(help); }
Example 2
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setType(int value) { currentType = value; String help; if (currentType == 0) { help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } } else { help = LocaleController.getString("NoChatsContactsHelp", R.string.NoChatsContactsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } } emptyTextView2.setText(help); }
Example 3
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void needLayout() { if (AndroidUtilities.isTablet()) { RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) layersActionBarLayout.getLayoutParams(); relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2; int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2; layersActionBarLayout.setLayoutParams(relativeLayoutParams); if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { int leftWidth = AndroidUtilities.displaySize.x / 100 * 35; if (leftWidth < AndroidUtilities.dp(320)) { leftWidth = AndroidUtilities.dp(320); } relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = leftWidth; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) { BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1); chatFragment.onPause(); actionBarLayout.fragmentsStack.remove(1); actionBarLayout.showLastFragment(); } } else { relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); } } }
Example 4
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DialogsEmptyCell(Context context) { super(context); setGravity(Gravity.CENTER); setOrientation(VERTICAL); setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); emptyTextView1 = new TextView(context); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); emptyTextView1.setTextColor(Theme.getColor(Theme.key_emptyListPlaceholder)); emptyTextView1.setGravity(Gravity.CENTER); emptyTextView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); addView(emptyTextView1, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20, 0, 0)); emptyTextView2 = new TextView(context); String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); emptyTextView2.setTextColor(Theme.getColor(Theme.key_emptyListPlaceholder)); emptyTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); emptyTextView2.setGravity(Gravity.CENTER); emptyTextView2.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(8), 0); emptyTextView2.setLineSpacing(AndroidUtilities.dp(2), 1); addView(emptyTextView2, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 20)); }
Example 5
Source File: ExternalActionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void needLayout() { if (AndroidUtilities.isTablet()) { RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) layersActionBarLayout.getLayoutParams(); relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2; int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2; layersActionBarLayout.setLayoutParams(relativeLayoutParams); if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { int leftWidth = AndroidUtilities.displaySize.x / 100 * 35; if (leftWidth < AndroidUtilities.dp(320)) { leftWidth = AndroidUtilities.dp(320); } relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = leftWidth; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) { BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1); chatFragment.onPause(); actionBarLayout.fragmentsStack.remove(1); actionBarLayout.showLastFragment(); } } else { relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); } } }
Example 6
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DialogsEmptyCell(Context context) { super(context); setGravity(Gravity.CENTER); setOrientation(VERTICAL); setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); emptyTextView1 = new TextView(context); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); emptyTextView1.setTextColor(Theme.getColor(Theme.key_emptyListPlaceholder)); emptyTextView1.setGravity(Gravity.CENTER); emptyTextView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); addView(emptyTextView1, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20, 0, 0)); emptyTextView2 = new TextView(context); String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); emptyTextView2.setTextColor(Theme.getColor(Theme.key_emptyListPlaceholder)); emptyTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); emptyTextView2.setGravity(Gravity.CENTER); emptyTextView2.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(8), 0); emptyTextView2.setLineSpacing(AndroidUtilities.dp(2), 1); addView(emptyTextView2, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 20)); }
Example 7
Source File: ExternalActionActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void needLayout() { if (AndroidUtilities.isTablet()) { RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) layersActionBarLayout.getLayoutParams(); relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2; int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2; layersActionBarLayout.setLayoutParams(relativeLayoutParams); if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { int leftWidth = AndroidUtilities.displaySize.x / 100 * 35; if (leftWidth < AndroidUtilities.dp(320)) { leftWidth = AndroidUtilities.dp(320); } relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = leftWidth; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) { BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1); chatFragment.onPause(); actionBarLayout.fragmentsStack.remove(1); actionBarLayout.showLastFragment(); } } else { relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); } } }
Example 8
Source File: DialogsEmptyCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public DialogsEmptyCell(Context context) { super(context); setGravity(Gravity.CENTER); setOrientation(VERTICAL); setOnTouchListener((v, event) -> true); imageView = new RLottieImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); addView(imageView, LayoutHelper.createFrame(100, 100, Gravity.CENTER, 52, 4, 52, 0)); imageView.setOnClickListener(v -> { if (!imageView.isPlaying()) { imageView.setProgress(0.0f); imageView.playAnimation(); } }); emptyTextView1 = new TextView(context); emptyTextView1.setTextColor(Theme.getColor(Theme.key_chats_nameMessage_threeLines)); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); emptyTextView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); emptyTextView1.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); emptyTextView1.setGravity(Gravity.CENTER); addView(emptyTextView1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 10, 52, 0)); emptyTextView2 = new TextView(context); String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); emptyTextView2.setTextColor(Theme.getColor(Theme.key_chats_message)); emptyTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); emptyTextView2.setGravity(Gravity.CENTER); emptyTextView2.setLineSpacing(AndroidUtilities.dp(2), 1); addView(emptyTextView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 7, 52, 0)); }
Example 9
Source File: DialogsEmptyCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setType(int value) { if (currentType == value) { return; } currentType = value; String help; int icon; if (currentType == 0) { icon = 0; help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); } else if (currentType == 1) { icon = 0; help = LocaleController.getString("NoChatsContactsHelp", R.string.NoChatsContactsHelp); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); } else if (currentType == 2) { imageView.setAutoRepeat(false); icon = R.raw.filter_no_chats; help = LocaleController.getString("FilterNoChatsToDisplayInfo", R.string.FilterNoChatsToDisplayInfo); emptyTextView1.setText(LocaleController.getString("FilterNoChatsToDisplay", R.string.FilterNoChatsToDisplay)); } else { imageView.setAutoRepeat(true); icon = R.raw.filter_new; help = LocaleController.getString("FilterAddingChatsInfo", R.string.FilterAddingChatsInfo); emptyTextView1.setText(LocaleController.getString("FilterAddingChats", R.string.FilterAddingChats)); } if (icon != 0) { imageView.setVisibility(VISIBLE); imageView.setAnimation(icon, 100, 100); imageView.playAnimation(); } else { imageView.setVisibility(GONE); } if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); }
Example 10
Source File: ExternalActionActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void needLayout() { if (AndroidUtilities.isTablet()) { RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) layersActionBarLayout.getLayoutParams(); relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2; int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2; layersActionBarLayout.setLayoutParams(relativeLayoutParams); if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { int leftWidth = AndroidUtilities.displaySize.x / 100 * 35; if (leftWidth < AndroidUtilities.dp(320)) { leftWidth = AndroidUtilities.dp(320); } relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = leftWidth; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) { BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1); chatFragment.onPause(); actionBarLayout.fragmentsStack.remove(1); actionBarLayout.showLastFragment(); } } else { relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); } } }
Example 11
Source File: DialogsEmptyCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public DialogsEmptyCell(Context context) { super(context); setGravity(Gravity.CENTER); setOrientation(VERTICAL); setOnTouchListener((v, event) -> true); imageView = new RLottieImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); addView(imageView, LayoutHelper.createFrame(100, 100, Gravity.CENTER, 52, 4, 52, 0)); imageView.setOnClickListener(v -> { if (!imageView.isPlaying()) { imageView.setProgress(0.0f); imageView.playAnimation(); } }); emptyTextView1 = new TextView(context); emptyTextView1.setTextColor(Theme.getColor(Theme.key_chats_nameMessage_threeLines)); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); emptyTextView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); emptyTextView1.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); emptyTextView1.setGravity(Gravity.CENTER); addView(emptyTextView1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 10, 52, 0)); emptyTextView2 = new TextView(context); String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); emptyTextView2.setTextColor(Theme.getColor(Theme.key_chats_message)); emptyTextView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); emptyTextView2.setGravity(Gravity.CENTER); emptyTextView2.setLineSpacing(AndroidUtilities.dp(2), 1); addView(emptyTextView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, 7, 52, 0)); }
Example 12
Source File: DialogsEmptyCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void setType(int value) { if (currentType == value) { return; } currentType = value; String help; int icon; if (currentType == 0) { icon = 0; help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); } else if (currentType == 1) { icon = 0; help = LocaleController.getString("NoChatsContactsHelp", R.string.NoChatsContactsHelp); emptyTextView1.setText(LocaleController.getString("NoChats", R.string.NoChats)); } else if (currentType == 2) { imageView.setAutoRepeat(false); icon = R.raw.filter_no_chats; help = LocaleController.getString("FilterNoChatsToDisplayInfo", R.string.FilterNoChatsToDisplayInfo); emptyTextView1.setText(LocaleController.getString("FilterNoChatsToDisplay", R.string.FilterNoChatsToDisplay)); } else { imageView.setAutoRepeat(true); icon = R.raw.filter_new; help = LocaleController.getString("FilterAddingChatsInfo", R.string.FilterAddingChatsInfo); emptyTextView1.setText(LocaleController.getString("FilterAddingChats", R.string.FilterAddingChats)); } if (icon != 0) { imageView.setVisibility(VISIBLE); imageView.setAnimation(icon, 100, 100); imageView.playAnimation(); } else { imageView.setVisibility(GONE); } if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) { help = help.replace('\n', ' '); } emptyTextView2.setText(help); }