当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar类代码示例

本文整理汇总了Java中org.telegram.ui.ActionBar.ActionBar的典型用法代码示例。如果您正苦于以下问题:Java ActionBar类的具体用法?Java ActionBar怎么用?Java ActionBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActionBar类属于org.telegram.ui.ActionBar包,在下文中一共展示了ActionBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createView

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的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;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:about.java

示例2: createActionBar

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
protected ActionBar createActionBar(Context context) {
    ActionBar actionBar = new ActionBar(context) {
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            return super.onTouchEvent(event); //TODO
        }
    };
    actionBar.setItemsBackgroundColor(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
    //actionBar.setBackButtonDrawable(new BackDrawable(false));
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
    //actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
    Drawable back = new BackDrawable(false);
    ((BackDrawable) back).setColor(themePrefs.getInt("profileHeaderIconsColor", 0xffffffff));
    actionBar.setBackButtonDrawable(back);
    actionBar.setCastShadows(false);
    actionBar.setAddToContainer(false);
    actionBar.setOccupyStatusBar(!AndroidUtilities.isTablet());
    return actionBar;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:22,代码来源:ProfileActivity.java

示例3: onLayout

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    int actionBarHeight = ActionBar.getCurrentActionBarHeight("CHAT");
    int viewTop = (actionBarHeight - AndroidUtilities.dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
    avatarImageView.layout(AndroidUtilities.dp(8), viewTop, AndroidUtilities.dp(42 + 8), viewTop + AndroidUtilities.dp(42));
    titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(1.3f), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(1.3f));
    if (timeItem != null) {
        timeItem.layout(AndroidUtilities.dp(8 + 16), viewTop + AndroidUtilities.dp(15), AndroidUtilities.dp(8 + 16 + 34), viewTop + AndroidUtilities.dp(15 + 34));
    }
    if (radioButton != null && radioButton.getVisibility() == VISIBLE) {
        subtitleTextView.layout(AndroidUtilities.dp(8 + 54 + 20), viewTop + AndroidUtilities.dp(24), AndroidUtilities.dp(8 + 54 + 20) + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24));
        viewTop = viewTop + subtitleTextView.getTextHeight() / 2 + AndroidUtilities.dp(12);
        radioButton.layout(AndroidUtilities.dp(8 + 50), viewTop, AndroidUtilities.dp(8 + 50 + 24), viewTop + AndroidUtilities.dp(24));
    } else {
        subtitleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(24), AndroidUtilities.dp(8 + 54) + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24));
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:ChatAvatarContainer.java

示例4: createActionBar

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
protected ActionBar createActionBar(Context context) {
    ActionBar actionBar = new ActionBar(context) {
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            return super.onTouchEvent(event);
        }
    };
    actionBar.setItemsBackgroundColor(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id), false);
    actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarDefaultIcon), false);
    actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), true);
    actionBar.setBackButtonDrawable(new BackDrawable(false));
    actionBar.setCastShadows(false);
    actionBar.setAddToContainer(false);
    actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet());
    return actionBar;
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:18,代码来源:ProfileActivity.java

示例5: getSideCoord

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private static int getSideCoord(boolean isX, int side, float p, int sideSize) {
    int total;
    if (isX) {
        total = AndroidUtilities.displaySize.x - sideSize;
    } else {
        total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight();
    }
    int result;
    if (side == 0) {
        result = AndroidUtilities.dp(10);
    } else if (side == 1) {
        result = total - AndroidUtilities.dp(10);
    } else {
        result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10);
    }
    if (!isX) {
        result += ActionBar.getCurrentActionBarHeight();
    }
    return result;
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:21,代码来源:PipVideoView.java

示例6: createView

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("CropImage", R.string.CropImage));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (delegate != null && !doneButtonPressed) {
                    Bitmap bitmap = view.getBitmap();
                    if (bitmap == imageToCrop) {
                        sameBitmap = true;
                    }
                    delegate.didFinishEdit(bitmap);
                    doneButtonPressed = true;
                }
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = view = new PhotoCropView(context);
    ((PhotoCropView) fragmentView).freeform = getArguments().getBoolean("freeform", false);
    fragmentView.setLayoutParams(new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    FontManager.instance().setTypefaceImmediate(fragmentView);
    return fragmentView;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:36,代码来源:PhotoCropActivity.java

示例7: fixLayoutInternal

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private void fixLayoutInternal() {
    if (getParentActivity() == null) {
        return;
    }
    int position = listView.getFirstVisiblePosition();
    WindowManager manager = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Activity.WINDOW_SERVICE);
    int rotation = manager.getDefaultDisplay().getRotation();

    int columnsCount;
    if (AndroidUtilities.isTablet()) {
        columnsCount = 3;
    } else {
        if (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90) {
            columnsCount = 5;
        } else {
            columnsCount = 3;
        }
    }
    listView.setNumColumns(columnsCount);
    if (AndroidUtilities.isTablet()) {
        itemWidth = (AndroidUtilities.dp(490) - ((columnsCount + 1) * AndroidUtilities.dp(4))) / columnsCount;
    } else {
        itemWidth = (AndroidUtilities.displaySize.x - ((columnsCount + 1) * AndroidUtilities.dp(4))) / columnsCount;
    }
    listView.setColumnWidth(itemWidth);

    listAdapter.notifyDataSetChanged();
    listView.setSelection(position);

    if (selectedAlbum == null) {
        emptyView.setPadding(0, 0, 0, (int) ((AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight()) * 0.4f));
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:34,代码来源:PhotoPickerActivity.java

示例8: fixLayout

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private void fixLayout() {
    if (avatarContainer != null) {
        avatarContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                if (avatarContainer != null) {
                    avatarContainer.getViewTreeObserver().removeOnPreDrawListener(this);
                }
                int padding = (ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(48)) / 2;
                avatarContainer.setPadding(avatarContainer.getPaddingLeft(), padding, avatarContainer.getPaddingRight(), padding);
                return true;
            }
        });
    }
    if (messageContainer != null) {
        messageContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                messageContainer.getViewTreeObserver().removeOnPreDrawListener(this);
                if (!checkTransitionAnimation() && !startedMoving) {
                    ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageContainer.getLayoutParams();
                    layoutParams.topMargin = ActionBar.getCurrentActionBarHeight();
                    layoutParams.bottomMargin = AndroidUtilities.dp(48);
                    layoutParams.width = ViewGroup.MarginLayoutParams.MATCH_PARENT;
                    layoutParams.height = ViewGroup.MarginLayoutParams.MATCH_PARENT;
                    messageContainer.setLayoutParams(layoutParams);
                    applyViewsLayoutParams(0);
                }
                return true;
            }
        });
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:34,代码来源:PopupNotificationActivity.java

示例9: onWindowSizeChanged

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private void onWindowSizeChanged() {
    int size = sizeNotifierLayout.getHeight();
    if (!keyboardVisible) {
        size -= emojiPadding;
    }
    if (delegate != null) {
        delegate.onWindowSizeChanged(size);
    }
    if (topView != null) {
        if (size < AndroidUtilities.dp(72) + ActionBar.getCurrentActionBarHeight()) {
            if (allowShowTopView) {
                allowShowTopView = false;
                if (needShowTopView) {
                    topView.setVisibility(GONE);
                    resizeForTopView(false);
                    topView.setTranslationY(topView.getLayoutParams().height);
                }
            }
        } else {
            if (!allowShowTopView) {
                allowShowTopView = true;
                if (needShowTopView) {
                    topView.setVisibility(VISIBLE);
                    resizeForTopView(true);
                    topView.setTranslationY(0);
                }
            }
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:31,代码来源:ChatActivityEnterView.java

示例10: onLayout

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    int actionBarHeight = ActionBar.getCurrentActionBarHeight();
    int viewTop = (actionBarHeight - AndroidUtilities.dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
    avatarImageView.layout(AndroidUtilities.dp(8), viewTop, AndroidUtilities.dp(42 + 8), viewTop + AndroidUtilities.dp(42));
    titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(1.3f), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(1.3f));
    if (timeItem != null) {
        timeItem.layout(AndroidUtilities.dp(8 + 16), viewTop + AndroidUtilities.dp(15), AndroidUtilities.dp(8 + 16 + 34), viewTop + AndroidUtilities.dp(15 + 34));
    }
    subtitleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(24), AndroidUtilities.dp(8 + 54) + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:ChatAvatarContainer.java

示例11: createView

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("CropImage", R.string.CropImage));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (delegate != null && !doneButtonPressed) {
                    Bitmap bitmap = view.getBitmap();
                    if (bitmap == imageToCrop) {
                        sameBitmap = true;
                    }
                    delegate.didFinishEdit(bitmap);
                    doneButtonPressed = true;
                }
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = view = new PhotoCropView(context);
    ((PhotoCropView) fragmentView).freeform = getArguments().getBoolean("freeform", false);
    fragmentView.setLayoutParams(new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    return fragmentView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:36,代码来源:PhotoCropActivity.java

示例12: getAdditionY

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private int getAdditionY() {
    if (currentEditMode == 3) {
        return ActionBar.getCurrentActionBarHeight() + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
    } else if (currentEditMode != 0) {
        return AndroidUtilities.dp(14) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
    }
    return 0;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:9,代码来源:PhotoViewer.java

示例13: getContainerViewHeight

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
private int getContainerViewHeight(int mode) {
    int height = AndroidUtilities.displaySize.y;
    if (mode == 0 && Build.VERSION.SDK_INT >= 21) {
        height += AndroidUtilities.statusBarHeight;
    }
    if (mode == 1) {
        height -= AndroidUtilities.dp(76);
    } else if (mode == 2) {
        height -= AndroidUtilities.dp(154);
    } else if (mode == 3) {
        height -= AndroidUtilities.dp(48) + ActionBar.getCurrentActionBarHeight();
    }
    return height;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:15,代码来源:PhotoViewer.java

示例14: onMeasure

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);

    setMeasuredDimension(width, height);
    actionBar.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));

    float bitmapW;
    float bitmapH;
    int fullHeight = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight();
    int maxHeight = fullHeight - AndroidUtilities.dp(48);
    if (bitmapToEdit != null) {
        bitmapW = isSidewardOrientation() ? bitmapToEdit.getHeight() : bitmapToEdit.getWidth();
        bitmapH = isSidewardOrientation() ? bitmapToEdit.getWidth() : bitmapToEdit.getHeight();
    } else {
        bitmapW = width;
        bitmapH = height - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(48);
    }

    float renderWidth = width;
    float renderHeight = (float) Math.floor(renderWidth * bitmapH / bitmapW);
    if (renderHeight > maxHeight) {
        renderHeight = maxHeight;
        renderWidth = (float) Math.floor(renderHeight * bitmapW / bitmapH);
    }

    renderView.measure(MeasureSpec.makeMeasureSpec((int) renderWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) renderHeight, MeasureSpec.EXACTLY));
    entitiesView.measure(MeasureSpec.makeMeasureSpec((int) paintingSize.width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) paintingSize.height, MeasureSpec.EXACTLY));
    dimView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST));
    selectionContainerView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY));
    colorPicker.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY));
    toolsView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY));
    if (stickersView != null) {
        stickersView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(fullHeight, MeasureSpec.EXACTLY));
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:38,代码来源:PhotoPaintView.java

示例15: createView

import org.telegram.ui.ActionBar.ActionBar; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false);
    actionBar.setTitleColor(0xffffffff);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("CropImage", R.string.CropImage));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (delegate != null && !doneButtonPressed) {
                    Bitmap bitmap = view.getBitmap();
                    if (bitmap == imageToCrop) {
                        sameBitmap = true;
                    }
                    delegate.didFinishEdit(bitmap);
                    doneButtonPressed = true;
                }
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = view = new PhotoCropView(context);
    ((PhotoCropView) fragmentView).freeform = getArguments().getBoolean("freeform", false);
    fragmentView.setLayoutParams(new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    return fragmentView;
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:37,代码来源:PhotoCropActivity.java


注:本文中的org.telegram.ui.ActionBar.ActionBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。