Java Code Examples for android.widget.FrameLayout#setClickable()

The following examples show how to use android.widget.FrameLayout#setClickable() . 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: Plugin.java    From JianshuApp with GNU General Public License v3.0 6 votes vote down vote up
protected void init(ViewGroup parent, int width, int height) {
    if (!isDebug && (width <= 0 || height <= 0)) {
        width = height = 1;
    }
    visible = (width != 1 && height != 1);

    // 用于显示遮罩
    mRootLayout = new FrameLayout(parent.getContext());
    mRootLayout.setClickable(true);
    parent.addView(mRootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    // 用于加载网页
    mWebView = new SafeWebView(parent.getContext());
    mRootLayout.addView(mWebView, new FrameLayout.LayoutParams(width, height, Gravity.CENTER));

    // 初始化
    onInit();
}
 
Example 2
Source File: CBrowserMainFrame7.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onShowCustomView(View view, int requestedOrientation, final CustomViewCallback callback) {
    FrameLayout container = new FrameLayout(mContext);
    container.setBackgroundColor(0xff000000);
    FrameLayout.LayoutParams parm = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    container.setLayoutParams(parm);
    container.setClickable(true);
    container.addView(view);
    //	((EBrowserActivity)mContext).requestWindowFeature()
    WebViewSdkCompat.CustomViewCallback compatCallback=new WebViewSdkCompat.CustomViewCallback() {
        @Override
        public void onCustomViewHidden() {
            callback.onCustomViewHidden();
        }
    };
    ((EBrowserActivity) mContext).showCustomView(container, compatCallback);

}
 
Example 3
Source File: CBrowserMainFrame7.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void onShowCustomView(View view, int requestedOrientation, final CustomViewCallback callback) {
    FrameLayout container = new FrameLayout(mContext);
    container.setBackgroundColor(0xff000000);
    FrameLayout.LayoutParams parm = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    container.setLayoutParams(parm);
    container.setClickable(true);
    container.addView(view);
    //	((EBrowserActivity)mContext).requestWindowFeature()
    WebViewSdkCompat.CustomViewCallback compatCallback=new WebViewSdkCompat.CustomViewCallback() {
        @Override
        public void onCustomViewHidden() {
            callback.onCustomViewHidden();
        }
    };
    ((EBrowserActivity) mContext).showCustomView(container, compatCallback);

}
 
Example 4
Source File: MoDialogHUD.java    From a with GNU General Public License v3.0 5 votes vote down vote up
private void initViews() {
    decorView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = new FrameLayout(context);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    rootView.setLayoutParams(layoutParams);
    rootView.setClickable(true);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.btn_bg_press_tp));

    mSharedView = new MoDialogView(context);

}
 
Example 5
Source File: MoDialogHUD.java    From MyBookshelf with GNU General Public License v3.0 5 votes vote down vote up
private void initViews() {
    decorView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = new FrameLayout(context);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    rootView.setLayoutParams(layoutParams);
    rootView.setClickable(true);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.btn_bg_press_tp));

    mSharedView = new MoDialogView(context);

}
 
Example 6
Source File: ViewHelper.java    From FABRevealMenu-master with Apache License 2.0 5 votes vote down vote up
public FrameLayout generateOverlayView() {
    //Overlay view
    FrameLayout mOverlayLayout = new FrameLayout(mContext);
    mOverlayLayout.setLayoutParams(matchParams);
    mOverlayLayout.animate().alpha(0);
    mOverlayLayout.setVisibility(View.GONE);
    mOverlayLayout.setClickable(true);
    return mOverlayLayout;
}
 
Example 7
Source File: SplitCombobox.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void addToLayout(ViewGroup layout)
{
    LinearLayout container = new LinearLayout(getContext());
    container.setOrientation(VERTICAL);
    container.addView(mTitles);
    container.addView(mSpinners);
    addView(container);

    if (!AccountUtil.isProUser(getContext())) {
        FrameLayout splash = new FrameLayout(getContext());
        splash.setClickable(true);
        splash.setBackgroundColor(Color.argb(128, 128, 128, 128));
        ImageView sign = new ImageView(getContext());
        sign.setImageResource(R.drawable.ic_lock_black_24dp);
        sign.setScaleType(ImageView.ScaleType.FIT_CENTER);
        sign.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                ControlHelper.showProDialog(getContext());
            }
        });

        splash.addView(sign);
        addView(splash);
    }

    layout.addView(this);
}
 
Example 8
Source File: VideoChromeClient.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
    super.onShowCustomView(view, callback);
    if (owner == null) {
        Clog.w(Clog.baseLogTag, Clog.getString(R.string.fullscreen_video_show_error));
        return;
    }
    ViewGroup root = null;
    if (owner != null) {
        root = owner.getVideoAdView();
    }

    if (root == null) {
        Clog.w(Clog.baseLogTag, Clog.getString(R.string.fullscreen_video_show_error));
        return;
    }

    customViewCallback = callback;
    if (view instanceof FrameLayout) {
        frame = (FrameLayout) view;
        frame.setClickable(true);
        frame.setBackgroundColor(Color.BLACK);
        try {
            root.addView(frame);
        } catch (Exception e) {
            Clog.d(Clog.baseLogTag, e.toString());
        }
    } else {
        frame = null;
    }
}
 
Example 9
Source File: ChartProgressBar.java    From ChartProgressBar-Android with Apache License 2.0 4 votes vote down vote up
public void disableBar(int index) {

		final int barsCount = ((LinearLayout) this.getChildAt(0)).getChildCount();

		for (int i = 0; i < barsCount; i++) {

			FrameLayout rootFrame = (FrameLayout) ((LinearLayout) this.getChildAt(0)).getChildAt(i);

			int rootChildCount = rootFrame.getChildCount();

			for (int j = 0; j < rootChildCount; j++) {

				if ((int) rootFrame.getTag() != index)
					continue;

				rootFrame.setEnabled(false);
				rootFrame.setClickable(false);

				View childView = rootFrame.getChildAt(j);
				if (childView instanceof LinearLayout) {
					//bar
					LinearLayout barContainerLinear = ((LinearLayout) childView);
					int barContainerCount = barContainerLinear.getChildCount();

					for (int k = 0; k < barContainerCount; k++) {

						View view = barContainerLinear.getChildAt(k);

						if (view instanceof Bar) {

							Bar bar = (Bar) view;

							LayerDrawable layerDrawable = (LayerDrawable) bar.getProgressDrawable();
							layerDrawable.mutate();

							ScaleDrawable scaleDrawable = (ScaleDrawable) layerDrawable.getDrawable(1);

							GradientDrawable progressLayer = (GradientDrawable) scaleDrawable.getDrawable();

							if (progressLayer != null) {

								if (mProgressDisableColor > 0)
									progressLayer.setColor(ContextCompat.getColor(mContext, mProgressDisableColor));
								else
									progressLayer.setColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
							}
						} else {
							TextView titleTxtView = (TextView) view;
							if (mProgressDisableColor > 0)
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, mProgressDisableColor));
							else
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
						}
					}
				}
			}
		}
	}
 
Example 10
Source File: ChartProgressBar.java    From ChartProgressBar-Android with Apache License 2.0 4 votes vote down vote up
public void enableBar(int index) {

		final int barsCount = ((LinearLayout) this.getChildAt(0)).getChildCount();

		for (int i = 0; i < barsCount; i++) {

			FrameLayout rootFrame = (FrameLayout) ((LinearLayout) this.getChildAt(0)).getChildAt(i);

			int rootChildCount = rootFrame.getChildCount();

			for (int j = 0; j < rootChildCount; j++) {

				if ((int) rootFrame.getTag() != index)
					continue;

				rootFrame.setEnabled(true);
				rootFrame.setClickable(true);

				View childView = rootFrame.getChildAt(j);
				if (childView instanceof LinearLayout) {
					//bar
					LinearLayout barContainerLinear = ((LinearLayout) childView);
					int barContainerCount = barContainerLinear.getChildCount();

					for (int k = 0; k < barContainerCount; k++) {

						View view = barContainerLinear.getChildAt(k);

						if (view instanceof Bar) {

							Bar bar = (Bar) view;

							LayerDrawable layerDrawable = (LayerDrawable) bar.getProgressDrawable();
							layerDrawable.mutate();

							ScaleDrawable scaleDrawable = (ScaleDrawable) layerDrawable.getDrawable(1);

							GradientDrawable progressLayer = (GradientDrawable) scaleDrawable.getDrawable();

							if (progressLayer != null) {

								if (mProgressColor > 0)
									progressLayer.setColor(ContextCompat.getColor(mContext, mProgressColor));
								else
									progressLayer.setColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
							}
						} else {
							TextView titleTxtView = (TextView) view;
							if (mProgressDisableColor > 0)
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, mBarTitleColor));
							else
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
						}
					}
				}
			}
		}
	}
 
Example 11
Source File: SettingButton.java    From SettingView with Apache License 2.0 4 votes vote down vote up
private void initItemView(SettingViewItemData data) {
	FrameLayout itemView = data.getItemView();

	if (itemView instanceof SwitchItemView) {
		((SwitchItemView) itemView).fillData(data.getData());
		itemView.setClickable(false);
		((SwitchItemView) itemView).setOnSwitchItemChangedListener(new onSwitchItemChangedListener() {

			@Override
			public void onSwitchItemChanged(boolean isChecked) {
				// TODO Auto-generated method stub
				if (null != mSettingButtonSwitchListener) {
					mSettingButtonSwitchListener.onSwitchChanged(isChecked);
				}
			}
		});

	} else {
		itemView.setClickable(data.isClickable());
		itemView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (null != mSettingButtonClickListener) {
					mSettingButtonClickListener.onSettingButtonClick();
				}
			}
		});

		if (itemView instanceof BasicItemViewH) {
			((BasicItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof BasicItemViewV) {
			((BasicItemViewV) itemView).fillData(data.getData());
		} else if (itemView instanceof ImageItemView) {
			((ImageItemView) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewH) {
			((CheckItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewV) {
			((CheckItemViewV) itemView).fillData(data.getData());
		}
	}

	int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.setting_view_min_height), getResources().getDisplayMetrics());
	LinearLayout.LayoutParams lps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);

	addView(itemView, lps);
}
 
Example 12
Source File: SettingView.java    From SettingView with Apache License 2.0 4 votes vote down vote up
private void initItemView(SettingViewItemData data, final int index) {
	FrameLayout itemView = data.getItemView();

	if (itemView instanceof SwitchItemView) {
		((SwitchItemView) itemView).fillData(data.getData());
		((SwitchItemView) itemView).setOnSwitchItemChangedListener(new onSwitchItemChangedListener() {

			@Override
			public void onSwitchItemChanged(boolean isChecked) {
				// TODO Auto-generated method stub
				if (null != mItemSwitchListener) {
					mItemSwitchListener.onSwitchChanged(index, isChecked);
				}
			}
		});
		itemView.setClickable(false);
	} else {
		itemView.setClickable(data.isClickable());
		itemView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (null != mItemClickListener) {
					mItemClickListener.onItemClick(index);
				}
			}
		});

		if (itemView instanceof BasicItemViewH) {
			((BasicItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof BasicItemViewV) {
			((BasicItemViewV) itemView).fillData(data.getData());
		} else if (itemView instanceof ImageItemView) {
			((ImageItemView) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewH) {
			((CheckItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewV) {
			((CheckItemViewV) itemView).fillData(data.getData());
		}
	}

	int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.setting_view_min_height), getResources().getDisplayMetrics());
	LinearLayout.LayoutParams lps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);

	addView(itemView, lps);
}