Java Code Examples for android.widget.FrameLayout

The following are top voted examples for showing how to use android.widget.FrameLayout. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ChromeLikeTabSwitcher   File: PhoneArithmetics.java   View source code 7 votes vote down vote up
@Override
public final void setPosition(@NonNull final Axis axis, @NonNull final AbstractItem item,
                              final float position) {
    ensureNotNull(axis, "The axis may not be null");
    ensureNotNull(item, "The item may not be null");
    View view = item.getView();

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        Toolbar[] toolbars = getTabSwitcher().getToolbars();
        view.setY((getTabSwitcher().areToolbarsShown() && getTabSwitcher().isSwitcherShown() &&
                toolbars != null ?
                toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getHeight() - tabInset : 0) +
                getTabSwitcherPadding(axis, Gravity.START) + position);
    } else {
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) view.getLayoutParams();
        view.setX(position + layoutParams.leftMargin + getTabSwitcher().getPaddingLeft() / 2f -
                getTabSwitcher().getPaddingRight() / 2f -
                (getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE &&
                        getTabSwitcher().isSwitcherShown() ?
                        stackedTabCount * stackedTabSpacing / 2f : 0));
    }
}
 
Example 2
Project: SScheduleView-Android   File: SScheduleView.java   View source code 6 votes vote down vote up
/**
     * 绘制其他行其他列,即每个课程背景格子
     */
    private void drawOtherRowOtherCol(LinearLayout scrollContentView) {
        contentView = new FrameLayout(getContext());
        contentView.setClickable(true);

        LinearLayout.LayoutParams contentViewLP = new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                android.view.ViewGroup.LayoutParams.MATCH_PARENT);
        contentView.setLayoutParams(contentViewLP);
        scrollContentView.addView(contentView);

        for (int i = 0; i < showDaysNum * showJiesNum; i++) {
            final int row = i / showDaysNum;
            final int col = i % showDaysNum;
            // 课程背景格子
            View courseBackView=mAdapter.getCourseBackView();
//            FrameLayout courseBackView = new FrameLayout(getContext());
            FrameLayout.LayoutParams courseBackViewLP = new FrameLayout.LayoutParams(notFirstEveryColumnsWidth,
                    notFirstEveryRowHeight);
//            courseBackView.setBackgroundResource(R.drawable.course_back);
            courseBackViewLP.setMargins(col * notFirstEveryColumnsWidth, row * notFirstEveryRowHeight, 0, 0);
            courseBackView.setLayoutParams(courseBackViewLP);
            contentView.addView(courseBackView);
        }
    }
 
Example 3
Project: TestChat   File: DragLayout.java   View source code 6 votes vote down vote up
@Override
protected void onFinishInflate() {
        super.onFinishInflate();
        menu = (ViewGroup) getChildAt(0);
        View view = getChildAt(getChildCount() - 1);
        if (view instanceof ContentView) {
                content = (ContentView) view;
                LogUtil.e("range" + range);
                LogUtil.e("range1" + getWidth() * 0.8);
                content.setRange((int) (getWidth() * 0.8));
        }
        if (SHADOW) {
                ivShadow = new ImageView(getContext());
                LogUtil.e("这里执行了吗");
                FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                ivShadow.setImageResource(R.drawable.shadow);
                addView(ivShadow, 1, layoutParams);
        }
        menu.setClickable(true);
        content.setClickable(true);
}
 
Example 4
Project: Coder   File: StateActivity.java   View source code 6 votes vote down vote up
/**
 * 加载中
 */
@DoMain
public void onLoadingState() {
    FrameLayout contains = (FrameLayout) findViewById(R.id.state_contains);
    contains.removeAllViews();
    View loading = View.inflate(this, R.layout.view_loading, null);
    contains.addView(loading);
    ImageView loading_img = (ImageView) loading.findViewById(R.id.loading_icon);
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(500);
    rotateAnimation.setRepeatMode(RotateAnimation.RESTART);
    rotateAnimation.setRepeatCount(-1);
    loading_img.setAnimation(rotateAnimation);
}
 
Example 5
Project: MyRepository   File: PageIndicator.java   View source code 6 votes vote down vote up
public PageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PageIndicator);
    normalIndicator = a.getResourceId(R.styleable.PageIndicator_normal_indicator,
            R.drawable.shape_point_white_alpha);
    selectedIndicator = a.getResourceId(R.styleable.PageIndicator_selected_indicator,
            R.drawable.shape_point_black);
    a.recycle();

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    llIndicators = new LinearLayout(context);
    llIndicators.setLayoutParams(params);
    llIndicators.setOrientation(LinearLayout.HORIZONTAL);

    indicator = new ImageView(context);
    FrameLayout.LayoutParams params1 = new FrameLayout.LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    indicator.setLayoutParams(params1);
    indicator.setImageResource(selectedIndicator);//默认使用白色实心点

    this.addView(llIndicators);
    this.addView(indicator);


}
 
Example 6
Project: andcoachmark   File: DismissOnTouchNoButtonRenderer.java   View source code 6 votes vote down vote up
@Override
public View render(final CoachmarkViewLayout layout) {

    if (inflated == null) {
        LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflated = inflater.inflate(R.layout.dismiss_no_button_view, null);
        layout.addView(inflated);
    }


    inflated.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener == null || mListener.onClicked()) {
                layout.dismiss();
            }
        }
    });

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    inflated.setLayoutParams(params);
    inflated.setVisibility(View.VISIBLE);

    return inflated;

}
 
Example 7
Project: weex-uikit   File: WXScroller.java   View source code 6 votes vote down vote up
@Override
protected MeasureOutput measure(int width, int height) {
  MeasureOutput measureOutput = new MeasureOutput();
  if (this.mOrientation == Constants.Orientation.HORIZONTAL) {
    int screenW = WXViewUtils.getScreenWidth(WXEnvironment.sApplication);
    int weexW = WXViewUtils.getWeexWidth(getInstanceId());
    measureOutput.width = width > (weexW >= screenW ? screenW : weexW) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                       : width;
    measureOutput.height = height;
  } else {
    int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
    int weexH = WXViewUtils.getWeexHeight(getInstanceId());
    measureOutput.height = height > (weexH >= screenH ? screenH : weexH) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                         : height;
    measureOutput.width = width;
  }
  return measureOutput;
}
 
Example 8
Project: mobile-store   File: CategoryController.java   View source code 6 votes vote down vote up
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) {
    super(itemView);

    this.activity = activity;
    this.loaderManager = loaderManager;

    appCardsAdapter = new AppPreviewAdapter(activity);

    viewAll = (Button) itemView.findViewById(R.id.button);
    viewAll.setOnClickListener(onViewAll);

    heading = (TextView) itemView.findViewById(R.id.name);
    image = (FeatureImage) itemView.findViewById(R.id.category_image);
    background = (FrameLayout) itemView.findViewById(R.id.category_background);

    RecyclerView appCards = (RecyclerView) itemView.findViewById(R.id.app_cards);
    appCards.setAdapter(appCardsAdapter);
    appCards.addItemDecoration(new ItemDecorator(activity));

    displayImageOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .imageScaleType(ImageScaleType.NONE)
            .displayer(new FadeInBitmapDisplayer(100, true, true, false))
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
}
 
Example 9
Project: OSchina_resources_android   File: EventViewPagerFragment.java   View source code 6 votes vote down vote up
@Override
protected void onSetupTabAdapter(ViewPageFragmentAdapter adapter) {

    FrameLayout generalActionBar = (FrameLayout) mRoot.findViewById(R.id.general_actionbar);
    generalActionBar.setVisibility(View.GONE);

    String[] title = getResources().getStringArray(R.array.events);
    if (position == 0) {
        adapter.addTab(title[0], "new_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_NEW_EVENT));
        adapter.addTab(title[1], "my_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_MY_EVENT));
        mTabStrip.setVisibility(View.VISIBLE);
    } else {
        adapter.addTab(title[1], "my_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_MY_EVENT));
        mTabStrip.setVisibility(View.GONE);
    }
    mViewPager.setCurrentItem(position, true);
}
 
Example 10
Project: YCCardView   File: CardViewLayout.java   View source code 6 votes vote down vote up
/**
 * 数据更新通知
 */
public void notifyDataSetChanged() {
    int num = getChildCount();
    for (int i = 0; i < num; i++) {
        FrameLayout frameLayout = (FrameLayout) getChildAt(i);
        int tag = Integer.parseInt(frameLayout.getTag().toString());
        if (tag > 0 && tag < adapter.getItemCount()) {
            frameLayout.setVisibility(View.VISIBLE);
            adapter.bindView(frameLayout.getChildAt(0), tag);
        } else {
            frameLayout.setVisibility(View.INVISIBLE);
        }

        if (i == 3 && tag == 0) {
            adapter.displaying(0);
        }
    }
}
 
Example 11
Project: Coder   File: ImmersionBar.java   View source code 6 votes vote down vote up
/**
 * 设置一个可以自定义颜色的状态栏
 */
private void setupStatusBarView() {
    if (mBarParams.statusBarView == null) {
        mBarParams.statusBarView = new View(mActivity);
    }
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarHeight(mActivity));
    params.gravity = Gravity.TOP;
    if (!isNavigationAtBottom(mActivity)) {
        params.rightMargin = getNavigationBarWidth(mActivity);
    }
    mBarParams.statusBarView.setLayoutParams(params);
    mBarParams.statusBarView.setBackgroundColor(ColorUtils.blendARGB(mBarParams.statusBarColor,
            mBarParams.statusBarColorTransform, mBarParams.statusBarAlpha));
    mBarParams.statusBarView.setVisibility(View.VISIBLE);
    ViewGroup viewGroup = (ViewGroup) mBarParams.statusBarView.getParent();
    if (viewGroup != null)
        viewGroup.removeView(mBarParams.statusBarView);
    mViewGroup.addView(mBarParams.statusBarView);
}
 
Example 12
Project: revolution-irc   File: RecyclerViewScrollbar.java   View source code 6 votes vote down vote up
public RecyclerViewScrollbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RecyclerViewScrollbar, defStyleAttr, 0);
    mRecyclerViewId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_recyclerView, 0);
    mScrollbarDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_scrollbarDrawable);
    mLetterDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_letterDrawable);
    int letterTextResId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_letterTextAppearance, 0);
    mMinScrollbarHeight = ta.getDimensionPixelOffset(R.styleable.RecyclerViewScrollbar_minScrollbarHeight, 0);
    ta.recycle();

    mLetterView = new TextView(getContext());
    mLetterView.setBackgroundDrawable(mLetterDrawable);
    TextViewCompat.setTextAppearance(mLetterView, letterTextResId);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = GravityCompat.END;
    mLetterView.setLayoutParams(params);
    mLetterView.setGravity(Gravity.CENTER);
}
 
Example 13
Project: IslamicLibraryAndroid   File: DownloadProgressActivity.java   View source code 6 votes vote down vote up
void showAlternativeView(int viewType) {
    FrameLayout recyclerFrame = findViewById(R.id.recycler_frame);
    recyclerFrame.setVisibility(View.GONE);
    mShowCancelAll = false;

    switch (viewType) {
        case ZERO_DOWNLOAD_TYPE:
            ViewStub zeroView = findViewById(R.id.zero_downloads);
            zeroView.setVisibility(View.VISIBLE);
            break;
        case FINISHED_DOWNLOAD_TYPE:
            ViewStub finishedView = findViewById(R.id.finished_downloads);
            finishedView.setVisibility(View.VISIBLE);


            break;
        case CANCELLED_DOWNLOAD_TYPE:
            ViewStub cancelledView = findViewById(R.id.cancelled_downloads);
            cancelledView.setVisibility(View.VISIBLE);
            break;

    }
    new Handler().postDelayed(this::finish, 10000);
}
 
Example 14
Project: localcloud_fe   File: CordovaActivity.java   View source code 6 votes vote down vote up
@SuppressWarnings({"deprecation", "ResourceType"})
protected void createViews() {
    //Why are we setting a constant as the ID? This should be investigated
    appView.getView().setId(100);
    appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(appView.getView());

    if (preferences.contains("BackgroundColor")) {
        try {
            int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
            // Background of activity:
            appView.getView().setBackgroundColor(backgroundColor);
        }
        catch (NumberFormatException e){
            e.printStackTrace();
        }
    }

    appView.getView().requestFocusFromTouch();
}
 
Example 15
Project: show-case-card-view   File: ShowCaseView.java   View source code 6 votes vote down vote up
private void configureCard(ViewGroup card) {
    cardContent.setMaxWidth(getCardWidth());
    cardContent.setPadding(
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL,
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL
    );
    cardContent.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT
    ));

    card.setBackgroundResource(getCardBackgroundDrawable());
    card.addView(cardContent);

    FrameLayout.LayoutParams cardLayoutParams = generateDefaultLayoutParams();
    cardLayoutParams.width = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.height = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.gravity = getCardGravity();
    cardLayoutParams.leftMargin = getCardMarginLeft();
    cardLayoutParams.topMargin = getCardMarginTop();
    cardLayoutParams.rightMargin = getCardMarginRight();
    cardLayoutParams.bottomMargin = getCardMarginBottom();
    card.setLayoutParams(cardLayoutParams);
}
 
Example 16
Project: prebid-mobile-android   File: MoPubBannerFragment.java   View source code 6 votes vote down vote up
private void setupBannerWithWait(final int waitTime) {
    FrameLayout adFrame = (FrameLayout) root.findViewById(R.id.adFrame2);
    adFrame.removeAllViews();
    adView2 = new MoPubView(this.getActivity());
    adView2.setAdUnitId(Constants.MOPUB_BANNER_ADUNIT_ID_300x250);
    adView2.setBannerAdListener(this);
    adView2.setAutorefreshEnabled(true);
    adView2.setMinimumWidth(300);
    adView2.setMinimumHeight(250);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER;
    adView2.setLayoutParams(lp);
    adFrame.addView(adView2);
    //region Prebid API usage
    Prebid.attachBidsWhenReady(adView2, Constants.BANNER_300x250, this, waitTime, this.getActivity());
    //endregion

}
 
Example 17
Project: KrGallery   File: BaseDialog.java   View source code 6 votes vote down vote up
private void initView() {
    Window window = getWindow();
    window.setGravity(Gravity.CENTER); // 此处可以设置dialog显示的位置为居中
    window.setWindowAnimations(R.style.bottom_menu_animation); // 添加动画效果
    View child = getLayoutInflater().inflate(R.layout.layout_dialog_base, null, false);
    setContentView(child);
    mContainer = (FrameLayout) findViewById(R.id.fl_container);
    mBtnPanel = (FrameLayout) findViewById(R.id.fl_btn_panel);
    closeIV = (ImageView) findViewById(R.id.iv_close);
    closeIV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dismiss();
        }
    });
    Window dialogWindow = getWindow();
    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
    DisplayMetrics d = mContext.getResources().getDisplayMetrics(); // 获取屏幕宽、高用
    lp.width = (int) (d.widthPixels * 0.8); // 宽度设置为屏幕的0.9
    dialogWindow.setAttributes(lp);
    setIsCancelable(true);

    setOnDismissListener(this);
}
 
Example 18
Project: encdroidMC   File: EDFileChooserActivity.java   View source code 6 votes vote down vote up
protected void onPostExecute(Boolean result) {
	super.onPostExecute(result);

	// Restore the layout parameters
	mLayout.setLayoutParams(new FrameLayout.LayoutParams(
			LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
	mLayout.setGravity(Gravity.TOP);

	// Remove the progress bar and replace it with the list view
	mLayout.removeView(mProgBar);
	mLayout.addView(mListView);

	if (result == true) {
		if (mPrefs.getBoolean("auto_import", true)) {
			showDialog(DIALOG_AUTO_IMPORT);
		}
	}
}
 
Example 19
Project: MyWidgetSample   File: ViewAttachment.java   View source code 5 votes vote down vote up
private void attachTo(View view) {
    ViewParent viewParent = view.getParent();
    ViewGroup parent = (ViewGroup) viewParent;
    int index = parent.indexOfChild(view);
    parent.removeView(view);
    attachmentRoot = new FrameLayout(view.getContext());
    attachmentRoot.setLayoutParams(view.getLayoutParams());
    view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    attachmentRoot.addView(view);
    if (child != null) {
        attachmentRoot.addView(child);
    }
    parent.addView(attachmentRoot, index);
}
 
Example 20
Project: YCSlideView   File: FirstActivity.java   View source code 5 votes vote down vote up
private void initViewId() {
    ll_title_menu = (FrameLayout) findViewById(R.id.ll_title_menu);
    toolbar_title = (TextView) findViewById(R.id.toolbar_title);
    tv_title_right = (TextView) findViewById(R.id.tv_title_right);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
}
 
Example 21
Project: Hotspot-master-devp   File: CustomAlertPPtDialog.java   View source code 5 votes vote down vote up
public CustomAlertPPtDialog builder() {
    view = LayoutInflater.from(context).inflate(R.layout.view_alertdialog, null);

    lLayout_bg = (LinearLayout) view.findViewById(R.id.layout_bg);
    txt_title = (TextView) view.findViewById(R.id.txt_title);
    txt_title.setVisibility(View.GONE);
    txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    txt_msg.setVisibility(View.GONE);
    et_input = (EditText) view.findViewById(R.id.et_input);
    et_input.setVisibility(View.GONE);
    btn_neg = (Button) view.findViewById(R.id.btn_neg);
    btn_neg.setVisibility(View.GONE);
    btn_pos = (Button) view.findViewById(R.id.btn_pos);
    btn_pos.setVisibility(View.GONE);
    btn_mid = (Button) view.findViewById(R.id.btn_mid);
    btn_mid.setVisibility(View.GONE);
    line1 = (ImageView) view.findViewById(R.id.line1);
    line1.setVisibility(View.GONE);
    line2 = (ImageView) view.findViewById(R.id.line2);
    line2.setVisibility(View.GONE);

    dialog = new Dialog(context, R.style.AlertDialogStyle);
    dialog.setContentView(view);

    lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (
            display.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));

    return this;
}
 
Example 22
Project: MyFire   File: WrapperAdapter.java   View source code 5 votes vote down vote up
public WrapperAdapter(RecyclerView.Adapter adapter, RefreshHeaderLayout refreshHeaderContainer, LinearLayout headerContainer, LinearLayout footerContainer, FrameLayout loadMoreFooterContainer) {
    this.mAdapter = adapter;
    this.mRefreshHeaderContainer = refreshHeaderContainer;
    this.mHeaderContainer = headerContainer;
    this.mFooterContainer = footerContainer;
    this.mLoadMoreFooterContainer = loadMoreFooterContainer;
    mAdapter.registerAdapterDataObserver(mObserver);
}
 
Example 23
Project: OSchina_resources_android   File: CommonDialog.java   View source code 5 votes vote down vote up
public void setItems(CharSequence[] items, int index,
                     AdapterView.OnItemClickListener onItemClickListener) {
    ListView listview = new ListView(content.getContext());
    listview.setCacheColorHint(0);
    listview.setDivider(null);
    listview.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    listview.setAdapter(new DialogAdapter(items, index));
    listview.setOnItemClickListener(onItemClickListener);
    setContent(listview, 0);
}
 
Example 24
Project: sctalk   File: PullToRefreshBase.java   View source code 5 votes vote down vote up
private void addRefreshableView(Context context, T refreshableView) {
	mRefreshableViewWrapper = new FrameLayout(context);
	mRefreshableViewWrapper.addView(refreshableView, ViewGroup.LayoutParams.MATCH_PARENT,
			ViewGroup.LayoutParams.MATCH_PARENT);

	addViewInternal(mRefreshableViewWrapper, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT));
}
 
Example 25
Project: OpenLive-Android   File: VideoViewAdapter.java   View source code 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    VideoUserStatusHolder myHolder = ((VideoUserStatusHolder) holder);

    final VideoStatusData user = mUsers.get(position);

    Log.d("VideoViewAdapter", "onBindViewHolder " + position + " " + user + " " + myHolder + " " + myHolder.itemView);

    log.debug("onBindViewHolder " + position + " " + user + " " + myHolder + " " + myHolder.itemView);

    FrameLayout holderView = (FrameLayout) myHolder.itemView;

    if (holderView.getChildCount() == 0) {
        SurfaceView target = user.mView;
        stripSurfaceView(target);
        holderView.addView(target, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    }

    holderView.setOnTouchListener(new OnDoubleTapListener(mContext) {
        @Override
        public void onDoubleTap(View view, MotionEvent e) {
            if (mListener != null) {
                mListener.onItemDoubleClick(view, user);
            }
        }

        @Override
        public void onSingleTapUp() {
        }
    });

}
 
Example 26
Project: pagopa-android-example   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MainFragment fragment = new MainFragment();
    FrameLayout flFrameContainer = findViewById(R.id.fl_fragment_container);
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();

    ft.replace(flFrameContainer.getId(), fragment, "main");
    ft.commit();

    PagoPaCore.init();
}
 
Example 27
Project: leanback-extensions   File: LoadingFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_loading, container, false);

	FrameLayout loadingContainer = (FrameLayout) view.findViewById(R.id.fragment_loading_container);
	loadingContainer.setBackgroundColor(backgroundColor);

	progressBar = new ProgressBar(container.getContext());
	if (container instanceof FrameLayout) {
		FrameLayout.LayoutParams layoutParams =
				new FrameLayout.LayoutParams(progressWidth, progressHeight, Gravity.CENTER);
		progressBar.setLayoutParams(layoutParams);
	}

	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
		if (progressBar.getIndeterminateDrawable() != null) {
			progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(progressColor),
					PorterDuff.Mode.SRC_IN);
		}
	} else {
		ColorStateList stateList = ColorStateList.valueOf(progressColor);
		progressBar.setIndeterminateTintMode(PorterDuff.Mode.SRC_IN);
		progressBar.setIndeterminateTintList(stateList);
		progressBar.setProgressBackgroundTintMode(PorterDuff.Mode.SRC_IN);
		progressBar.setProgressBackgroundTintList(stateList);
		progressBar.setIndeterminate(true);
	}

	loadingContainer.addView(progressBar);

	return view;
}
 
Example 28
Project: youkes_browser   File: BrowserActivity.java   View source code 5 votes vote down vote up
@Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
	if (view == null) {
		return;
	}
	if (mCustomView != null && callback != null) {
		callback.onCustomViewHidden();
		return;
	}
	try {
		view.setKeepScreenOn(true);
	} catch (SecurityException e) {
		Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
	}
	mOriginalOrientation = getRequestedOrientation();
	FrameLayout decor = (FrameLayout) getWindow().getDecorView();
	mFullscreenContainer = new FullscreenHolder(this);
	mCustomView = view;
	mFullscreenContainer.addView(mCustomView, COVER_SCREEN_PARAMS);
	decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
	setFullscreen(true);
	getCurrentWebView().setVisibility(View.GONE);
	if (view instanceof FrameLayout) {
		if (((FrameLayout) view).getFocusedChild() instanceof VideoView) {
			mVideoView = (VideoView) ((FrameLayout) view).getFocusedChild();
			mVideoView.setOnErrorListener(new VideoCompletionListener());
			mVideoView.setOnCompletionListener(new VideoCompletionListener());
		}
	}
	mCustomViewCallback = callback;
}
 
Example 29
Project: trascendentAR   File: ARLauncher.java   View source code 5 votes vote down vote up
@Override
protected void onResume() {
	super.onResume();
	//Crea la view de la camara
	preview = new CaptureCameraPreview(this, this);

	FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
	//Añade las views al layout
	mainLayout.addView(gameView,layoutParams);
	mainLayout.addView(preview,layoutParams);

}
 
Example 30
Project: TextReader   File: RecyclerArrayAdapter.java   View source code 5 votes vote down vote up
public View setMore(final int res, final OnLoadMoreListener listener) {
    FrameLayout container = new FrameLayout(getContext());
    container.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LayoutInflater.from(getContext()).inflate(res, container);
    getEventDelegate().setMore(container, listener);
    return container;
}
 
Example 31
Project: PlusGram   File: ChatAttachAlert.java   View source code 5 votes vote down vote up
@TargetApi(16)
public void showCamera() {
    if (cameraView == null) {
        cameraView = new CameraView(baseFragment.getParentActivity());
        container.addView(cameraView, 1, LayoutHelper.createFrame(80, 80));
        cameraView.setDelegate(new CameraView.CameraViewDelegate() {
            @Override
            public void onCameraInit() {
                int count = attachPhotoRecyclerView.getChildCount();
                for (int a = 0; a < count; a++) {
                    View child = attachPhotoRecyclerView.getChildAt(a);
                    if (child instanceof PhotoAttachCameraCell) {
                        child.setVisibility(View.INVISIBLE);
                        break;
                    }
                }

                String current = cameraView.getCameraSession().getCurrentFlashMode();
                String next = cameraView.getCameraSession().getNextFlashMode();
                if (current.equals(next)) {
                    for (int a = 0; a < 2; a++) {
                        flashModeButton[a].setVisibility(View.INVISIBLE);
                        flashModeButton[a].setAlpha(0.0f);
                        flashModeButton[a].setTranslationY(0.0f);
                    }
                } else {
                    setCameraFlashModeIcon(flashModeButton[0], cameraView.getCameraSession().getCurrentFlashMode());
                    for (int a = 0; a < 2; a++) {
                        flashModeButton[a].setVisibility(a == 0 ? View.VISIBLE : View.INVISIBLE);
                        flashModeButton[a].setAlpha(a == 0 && cameraOpened ? 1.0f : 0.0f);
                        flashModeButton[a].setTranslationY(0.0f);
                    }
                }
                switchCameraButton.setImageResource(cameraView.isFrontface() ? R.drawable.camera_revert1 : R.drawable.camera_revert2);
                switchCameraButton.setVisibility(cameraView.hasFrontFaceCamera() ? View.VISIBLE : View.INVISIBLE);
            }
        });

        cameraIcon = new FrameLayout(baseFragment.getParentActivity());
        container.addView(cameraIcon, 2, LayoutHelper.createFrame(80, 80));

        ImageView cameraImageView = new ImageView(baseFragment.getParentActivity());
        cameraImageView.setScaleType(ImageView.ScaleType.CENTER);
        cameraImageView.setImageResource(R.drawable.instant_camera);
        cameraIcon.addView(cameraImageView, LayoutHelper.createFrame(80, 80, Gravity.RIGHT | Gravity.BOTTOM));
    }
    cameraView.setTranslationX(cameraViewLocation[0]);
    cameraView.setTranslationY(cameraViewLocation[1]);
    cameraIcon.setTranslationX(cameraViewLocation[0]);
    cameraIcon.setTranslationY(cameraViewLocation[1]);
}
 
Example 32
Project: CipherSharedPrefs   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public void onInitialized(MainPresenter presenter, MainViewState viewState) {
    if (!presenter.isInitialized()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.enter_key);
        builder.setMessage(R.string.key_requirments_message);

        EditText editText = new EditText(this);
        editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(16)});
        builder.setView(editText);

        builder.setPositiveButton(R.string.apply, null);

        AlertDialog dialog = builder.create();
        dialog.setCancelable(false);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();

        dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(v -> {
            if (editText.getText().length() == 16) {
                String key = editText.getText().toString();
                presenter.initializeWithKey(key);
                presenter.getValues();
                dialog.dismiss();
            } else {
                Toast.makeText(this, R.string.bad_key, Toast.LENGTH_LONG).show();
            }
        });

        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) editText.getLayoutParams();
        int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16f, getResources().getDisplayMetrics());
        layoutParams.setMargins(margin, margin, margin, margin);
        editText.requestLayout();
    } else {
        if (!viewState.isPrefsLoaded() && !presenter.isTaskRunning(MainPresenter.TASK_GET_RUNNING)) {
            presenter.getValues();
        }
    }
}
 
Example 33
Project: leoapp-sources   File: NumberPickerPreference.java   View source code 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;
    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);
    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(picker);
    return dialogView;
}
 
Example 34
Project: KokoWalk   File: CharaView.java   View source code 5 votes vote down vote up
public void create(float winX, float winY,FrameLayout field, ArrayList<CharaView> charaViews,CharaView chara, int walkSec) {
    try {
        if (charaViews.size() >= MAX_CHARA) {
            //Toast.makeText(field.getContext(), "同時に呼び出せるのは"+ MAX_CHARA +"人までです",Toast.LENGTH_SHORT).show();
            field.removeView(charaViews.get(0));
            charaViews.remove(0);
            return;
        }
        mWindowSizeX = winX;
        mWindowSizeY = winY;
        charaViews.add(chara);
        CharaView c = charaViews.get(charaViews.size() - 1);
        field.addView(c);
        int r = (int) (Math.random() * 3);
        switch (r) {
            case 0:
            case 1:
            case 2:
                c.randomAnimation(MainActivity.walkSec);
                break;
        }
        PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", 0, 0);
        PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", 0, winY * 0.7f);
        PropertyValuesHolder holderRotaion = PropertyValuesHolder.ofFloat("rotation", 0, 0);
        c.setXY(0, winY * 0.7f);

        // targetに対してholderX, holderY, holderRotationを同時に実行させます
        ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(c, holderX, holderY, holderRotaion);
        objectAnimator.setDuration(MainActivity.walkSec);
        objectAnimator.start();
        //button.setText("納沙幸子 * " + charaViews.size());
    } catch (OutOfMemoryError e){
        Toast.makeText(field.getContext(), "メモリがいっぱいです : " + charaViews.size() + "人",Toast.LENGTH_SHORT).show();
    }
}
 
Example 35
Project: qmui   File: QDLoopViewPagerFragment.java   View source code 5 votes vote down vote up
public ItemView(Context context) {
    super(context);
    mTextView = new TextView(context);
    mTextView.setTextSize(20);
    mTextView.setTextColor(ContextCompat.getColor(context, R.color.app_color_theme_5));
    mTextView.setGravity(Gravity.CENTER);
    mTextView.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_white));
    int size = QMUIDisplayHelper.dp2px(context, 300);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(size, size);
    lp.gravity = Gravity.CENTER;
    addView(mTextView, lp);
}
 
Example 36
Project: MyEyepetizer   File: EndAreaBinder.java   View source code 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);
    text = (TextView) itemView.findViewById(R.id.end_text);
    background = (FrameLayout) itemView.findViewById(R.id.end_layout);
    if (mFlag == FLAG_TEXT_COLOR_BLACK) {
        text.setTextColor(ContextCompat.getColor(text.getContext(), R.color.colorBlack));
        background.setBackgroundColor(ContextCompat.getColor(background.getContext(), R.color.colorWhite));
    }
}
 
Example 37
Project: PlusGram   File: ScrollSlidingTabStrip.java   View source code 5 votes vote down vote up
public TextView addIconTabWithCounter(int resId) {
    final int position = tabCount++;
    FrameLayout tab = new FrameLayout(getContext());
    tab.setFocusable(true);
    tabsContainer.addView(tab);

    ImageView imageView = new ImageView(getContext());
    imageView.setImageResource(resId);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            delegate.onPageSelected(position);
        }
    });
    tab.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    tab.setSelected(position == currentPosition);

    TextView textView = new TextView(getContext());
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    textView.setTextColor(0xffffffff);
    textView.setGravity(Gravity.CENTER);
    textView.setBackgroundResource(R.drawable.sticker_badge);
    textView.setMinWidth(AndroidUtilities.dp(18));
    textView.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), AndroidUtilities.dp(1));
    tab.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 18, Gravity.TOP | Gravity.LEFT, 26, 6, 0, 0));

    return textView;
}
 
Example 38
Project: LaunchEnr   File: FolderIcon.java   View source code 5 votes vote down vote up
public static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
        FolderInfo folderInfo) {
    @SuppressWarnings("all") // suppress dead code warning
    final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
    if (error) {
        throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
                "INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
                "is dependent on this");
    }

    DeviceProfile grid = launcher.getDeviceProfile();
    FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);

    icon.setClipToPadding(false);
    icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
    icon.mFolderName.setText(folderInfo.title);
    icon.mFolderName.setCompoundDrawablePadding(0);
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams();
    lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx;

    icon.setTag(folderInfo);
    icon.setOnClickListener(launcher);
    icon.mInfo = folderInfo;
    icon.mLauncher = launcher;
    icon.mBadgeRenderer = launcher.getDeviceProfile().mBadgeRenderer;
    icon.setContentDescription(launcher.getString(R.string.folder_name_format, folderInfo.title));
    Folder folder = Folder.fromXml(launcher);
    folder.setDragController(launcher.getDragController());
    folder.setFolderIcon(icon);
    folder.bind(folderInfo);
    icon.setFolder(folder);
    icon.setAccessibilityDelegate(launcher.getAccessibilityDelegate());

    folderInfo.addListener(icon);

    icon.setOnFocusChangeListener(launcher.mFocusHandler);
    return icon;
}
 
Example 39
Project: MVPtemplate   File: WrapperAdapter.java   View source code 5 votes vote down vote up
public WrapperAdapter(RecyclerView.Adapter adapter, RefreshHeaderLayout refreshHeaderContainer, LinearLayout headerContainer, LinearLayout footerContainer, FrameLayout loadMoreFooterContainer) {
    this.mAdapter = adapter;
    this.mRefreshHeaderContainer = refreshHeaderContainer;
    this.mHeaderContainer = headerContainer;
    this.mFooterContainer = footerContainer;
    this.mLoadMoreFooterContainer = loadMoreFooterContainer;
    mAdapter.registerAdapterDataObserver(mObserver);
}
 
Example 40
Project: ShaddockVideoPlayer   File: EyesKitKat.java   View source code 5 votes vote down vote up
private static void removeMarginTopOfContentChild(View mContentChild, int statusBarHeight) {
    if (mContentChild == null) {
        return;
    }
    if (TAG_MARGIN_ADDED.equals(mContentChild.getTag())) {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mContentChild.getLayoutParams();
        lp.topMargin -= statusBarHeight;
        mContentChild.setLayoutParams(lp);
        mContentChild.setTag(null);
    }
}