/** * 初始化默认的HeaderView 与 FooterView * * @param context */ private void init(Context context) { // inflate得到的view需要代码设置LayoutParams // HeaderView mHeaderView = LinearLayoutCompat.inflate(context, R.layout.recyclerview_refresh_headerview, null); mHeaderViewStateIcon = mHeaderView.findViewById(R.id.refresh_headerview_stateIcon); mHeaderViewHint = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_hint); mHeaderViewLastRefreshTime = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_lastRefreshTime); // 直接从布局中获取高度即可 mHeaderViewHeight = getResources().getDimensionPixelOffset(R.dimen.recyclerview_refresh_headerview_height); // 这里需要手动设置LayoutParams,否则getLayoutParams为空 // 并且,在使用inflate得到的布局,没有设置手动设置LayoutParams的情况下,有些布局会出问题,特别是使用LinearLayout时。 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mHeaderViewHeight); lp.setMargins(0, -mHeaderViewHeight, 0, 0); mHeaderView.setLayoutParams(lp); mHeaderView.requestLayout(); // FooterView mFooterView = LinearLayoutCompat.inflate(context, R.layout.recyclerview_refresh_footerview, null); mFooterViewStateIcon = mFooterView.findViewById(R.id.refresh_footerview_stateIcon); mFooterViewHint = (TextView) mFooterView.findViewById(R.id.refresh_footerview_hint); }
@Override public void showEvents(List<DetailEvent> events) { int headerHeight = getResources().getDimensionPixelSize(R.dimen.header_bg_height); rvDetailEvents.setLayoutManager(new LinearLayoutManager(getActivity())); mAdapter = new DetailEventAdapter(events, headerHeight); View view = new View(getActivity()); view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1, headerHeight)); mAdapter.addHeaderView(view); rvDetailEvents.setAdapter(mAdapter); // final StickyRecyclerHeadersDecoration header = new StickyRecyclerHeadersDecoration(mAdapter); // rvDetailEvents.addItemDecoration(header); rvDetailEvents.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); rvDetailEvents.setItemAnimator(new SlideInLeftAnimator()); rvDetailEvents.getItemAnimator().setAddDuration(500); rvDetailEvents.getItemAnimator().setRemoveDuration(500); }
private void initBottomSheetItem() { LinearLayoutCompat takePhoto = mView.findViewById(R.id.bottom_sheet_item_take_photo); LinearLayoutCompat chooseImage = mView.findViewById(R.id.bottom_sheet_item_choose_image); LinearLayoutCompat recording = mView.findViewById(R.id.bottom_sheet_item_recording); LinearLayoutCompat moveToTrash = mView.findViewById(R.id.bottom_sheet_item_move_to_trash); LinearLayoutCompat permanentDelete = mView.findViewById(R.id.bottom_sheet_item_permanent_delete); LinearLayoutCompat makeACopy = mView.findViewById(R.id.bottom_sheet_item_make_a_copy); LinearLayoutCompat send = mView.findViewById(R.id.bottom_sheet_item_send); takePhoto.setOnClickListener(this); chooseImage.setOnClickListener(this); recording.setOnClickListener(this); moveToTrash.setOnClickListener(this); permanentDelete.setOnClickListener(this); makeACopy.setOnClickListener(this); send.setOnClickListener(this); }
private void initMenuItems() { for (int i = 0; i < getChildCount() - 1; i++) { View item = getChildAt(i); item.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if(null !=mOnMenuItemClickListener) { mOnMenuItemClickListener.onMenuItemClick((FloatingActionButton) view,view.getId()); } collapse(); } }); LayoutParams params = (LinearLayoutCompat.LayoutParams) item.getLayoutParams(); params.topMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin); } }
public oaDialog(Context context, final Tools.oaCallBack callBack) { super(context); super.requestWindowFeature(Window.FEATURE_NO_TITLE); super.setContentView(R.layout.custom_dialog); DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int width = metrics.widthPixels; super.getWindow().setLayout(width - 10, LinearLayoutCompat.LayoutParams.WRAP_CONTENT); relativeLayout = find(R.id.layout_actionbar); imageTitle = find(R.id.imagetitle); text = find(R.id.contenttext); inputlayout = find(R.id.textinputlayout); ((Button) find(R.id.button_ok)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { callBack.returnString(text.getText().toString()); oaDialog.super.dismiss(); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_episode, container, false); img_thmb = (ImageView) view.findViewById(R.id.img_thumb); txt_name = (TextView) view.findViewById(R.id.txt_name); txt_date = (TextView) view.findViewById(R.id.txt_date); txt_plot = (TextView) view.findViewById(R.id.txt_plot); txt_subs = (TextView) view.findViewById(R.id.txt_subs); box_gues = (LinearLayoutCompat) view.findViewById(R.id.box_gues); txt_gues = (TextView) view.findViewById(R.id.txt_guests); box_writ = (LinearLayoutCompat) view.findViewById(R.id.box_writ); txt_writ = (TextView) view.findViewById(R.id.txt_writers); box_dire = (LinearLayoutCompat) view.findViewById(R.id.box_dire); txt_dire = (TextView) view.findViewById(R.id.txt_director); return view; }
private void init(Context context, int childCount) { LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER_VERTICAL; this.setLayoutParams(layoutParams); this.childCount = childCount; this.setOrientation(LinearLayoutCompat.VERTICAL); if (this.childCount > 0) { LinearLayout.LayoutParams childParams = new LinearLayout.LayoutParams((CircleAppConstants.viewHeight)/ 5, (CircleAppConstants.viewHeight) / 5); childParams.gravity = Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL; for(int i = 0; i< this.childCount; i++){ ChildCircleContainer childCircleContainer = new ChildCircleContainer(getContext(), (CircleAppConstants.viewHeight),onChildClick); childCircleContainer.setPadding(10,10,10,10); childCircleContainer.setLayoutParams(childParams); this.addView(childCircleContainer); } } }
public void addTab(android.support.v7.app.ActionBar.Tab tab, int i, boolean flag) { tab = createTabView(tab, false); mTabLayout.addView(tab, i, new android.support.v7.widget.LinearLayoutCompat.LayoutParams(0, -1, 1.0F)); if (mTabSpinner != null) { ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (flag) { tab.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }
public void addTab(android.support.v7.app.ActionBar.Tab tab, boolean flag) { tab = createTabView(tab, false); mTabLayout.addView(tab, new android.support.v7.widget.LinearLayoutCompat.LayoutParams(0, -1, 1.0F)); if (mTabSpinner != null) { ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (flag) { tab.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }
/** * transform to ViewPager * * @param recyclerView {@link RecyclerView} * @param orientation the orientation of Linearlayout */ public static void toViewPager(RecyclerView recyclerView , @LinearLayoutCompat.OrientationMode int orientation) { recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext() , orientation, false)); new PagerSnapHelper().attachToRecyclerView(recyclerView); }
private void init(Context context, AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BackgroundProgress); try { showTxt = typedArray.getString(R.styleable.BackgroundProgress_showTxt); isGradient = typedArray.getBoolean(R.styleable.BackgroundProgress_isGradient, true); } catch (Exception e) { showTxt = null; isGradient = true; } typedArray.recycle(); View view = LayoutInflater.from(context).inflate(R.layout.bp, null); backgroundProgressView = (BackgroundProgressView) view.findViewById(R.id.progress); tv = (TextView) view.findViewById(R.id.tv); if (TextUtils.isEmpty(showTxt)) { tv.setVisibility(GONE); } else { tv.setText(showTxt); } backgroundProgressView.set_isGradient(isGradient); ViewGroup.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); addView(view, layoutParams); }
@Override public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent) { View view = new View(parent.getContext()); view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1, headerHeight)); return new RecyclerView.ViewHolder(view) { }; }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_right_sample); sv = (StretchView) findViewById(R.id.sv); sv.setDrawHelper(new ArcDrawHelper(sv, ContextCompat.getColor(RightSampleActivity.this, R.color.colorPrimary), 40)); rcv = (RecyclerView) findViewById(R.id.rcv); rcv.setLayoutManager(new LinearLayoutManager(RightSampleActivity.this, LinearLayoutManager.HORIZONTAL, false)); rcv.addItemDecoration(new RcvDecoration(0, (int) getResources().getDimension(R.dimen.divider_horzontal), LinearLayoutCompat.HORIZONTAL)); rcv.setAdapter(new RecyclerView.Adapter() { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new VH(LayoutInflater.from(RightSampleActivity.this).inflate(R.layout.item_horizontal, parent, false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } @Override public int getItemCount() { return 10; } }); }
/** * get the item_vertical top spacing * * @param itemPosition itemPosition * @return int */ private int getItemTopSpacing(int itemPosition) { if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.VERTICAL) { return verticalItemSpacingInPx; } return verticalItemSpacingInPx >> 1; }
@SuppressWarnings("unchecked") private void onChage() { removeAllViews(); for (int i = 0; i < mTAdapter.getCount(); ++i) { View tabView = mTAdapter.getView(i, this, mTAdapter.getItem(i)); LinearLayoutCompat.LayoutParams layoutParams = new LayoutParams(0, -1); layoutParams.weight = 1; addView(tabView, i, layoutParams); } invalidate(); }
public ReviewLabelsView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOrientation(HORIZONTAL); mAccount = Preferences.getAccount(context); // Separate labels and scores mLabelsLayout = new LinearLayout(context); mLabelsLayout.setOrientation(LinearLayout.VERTICAL); addView(mLabelsLayout, new LinearLayoutCompat.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); mScoresLayout = new LinearLayout(context); mScoresLayout.setOrientation(LinearLayout.VERTICAL); addView(mScoresLayout, new LinearLayoutCompat.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); }
/** * Called to create the ViewHolder at the given position. * * @param parent parent to assign the newly created view to * @param viewType ignored */ @Override public CategoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_category, parent, false); v.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT)); return new CategoryViewHolder(v, mListener); }
/** * Called to create the ViewHolder at the given position. * * @param parent parent to assign the newly created view to * @param viewType ignored */ @Override public StatisticViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v; int layout; Context parentContext = parent.getContext(); if (viewType == StatisticViewHolder.TYPE_LARGE) { layout = R.layout.list_item_statistic_most_played; } else if (viewType == StatisticViewHolder.TYPE_SMALL) { layout = R.layout.list_item_statistic_pie_chart; } else { throw new RuntimeException("Invalid view type!"); } v = LayoutInflater.from(parentContext).inflate(layout, parent, false); LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams( LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT); v.setLayoutParams(layoutParams); return new StatisticViewHolder(v, mUserLogicFactory, mChallengeDataSource, mApplication, mUser, mCategoryId); }
public FooterViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); LinearLayoutCompat.LayoutParams params = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ScreenUtil.instance(mContext).dip2px(40)); itemView.setLayoutParams(params); }
public static SubjectFactory<LinearLayoutCompatSubject, LinearLayoutCompat> type() { return new SubjectFactory<LinearLayoutCompatSubject, LinearLayoutCompat>() { @Override public LinearLayoutCompatSubject getSubject(FailureStrategy fs, LinearLayoutCompat that) { return new LinearLayoutCompatSubject(fs, that); } }; }
private void setupControlPanel() { controlPanel = (LinearLayoutCompat) findViewById(R.id.control); bulletButton = (StatusImageButton) findViewById(R.id.bullet); quoteButton = (StatusImageButton) findViewById(R.id.quote); attachmentButton = (AppCompatImageButton) findViewById(R.id.attachment); dotsButton = (AppCompatImageButton) findViewById(R.id.dots); playButton = (AppCompatImageButton) findViewById(R.id.play); bulletButton.setOnClickListener(this); quoteButton.setOnClickListener(this); attachmentButton.setOnClickListener(this); dotsButton.setOnClickListener(this); playButton.setOnClickListener(this); bulletButton.setOnLongClickListener(this); quoteButton.setOnLongClickListener(this); attachmentButton.setOnLongClickListener(this); dotsButton.setOnLongClickListener(this); playButton.setOnLongClickListener(this); RxBus.getInstance().toObservable(BlockEvent.class) .subscribe(new Action1<BlockEvent>() { @Override public void call(BlockEvent event) { bulletButton.setActivated(event.isBullet()); quoteButton.setActivated(event.isQuote()); } }); }
private void setupStylePanel() { stylePanel = (LinearLayoutCompat) findViewById(R.id.style); boldButton = (StatusImageButton) findViewById(R.id.bold); italicButton = (StatusImageButton) findViewById(R.id.italic); underlineButton = (StatusImageButton) findViewById(R.id.underline); strikethroughButton = (StatusImageButton) findViewById(R.id.strikethrough); linkButton = (StatusImageButton) findViewById(R.id.link); boldButton.setOnClickListener(this); italicButton.setOnClickListener(this); underlineButton.setOnClickListener(this); strikethroughButton.setOnClickListener(this); linkButton.setOnClickListener(this); boldButton.setOnLongClickListener(this); italicButton.setOnLongClickListener(this); underlineButton.setOnLongClickListener(this); strikethroughButton.setOnLongClickListener(this); linkButton.setOnLongClickListener(this); RxBus.getInstance().toObservable(FormatEvent.class) .subscribe(new Action1<FormatEvent>() { @Override public void call(FormatEvent event) { boldButton.setActivated(event.isBold()); italicButton.setActivated(event.isItalic()); underlineButton.setActivated(event.isUnderline()); strikethroughButton.setActivated(event.isStrikethrough()); linkButton.setActivated(event.isLink()); } }); }
private void setTopLayoutData() { if (mMzituTopModelList == null || mMzituTopModelList.size() < 4 || topView != null) { return; } topView = LayoutInflater.from(mContext).inflate(R.layout.mzitu_header_top, null, false); mTopLayout = (LinearLayout) topView.findViewById(R.id.mTopLayout); for (final MzituModel item : mMzituTopModelList) { ImageView mImage = new ImageView(mContext); mImage.setLayoutParams(new LinearLayoutCompat.LayoutParams(UtilsDynamicSize.defaultDisplayWidth / 4, UtilsDynamicSize.defaultDisplayWidth / 4)); mImage.setPadding(4, 4, 4, 0); Glide.with(mContext) .load(item.imagePath)//目标URL .placeholder(R.drawable.load_image_ing) .error(R.drawable.load_image_fail) //图片获取失败时默认显示的图片 .diskCacheStrategy(DiskCacheStrategy.ALL) //缓存全尺寸图片,也缓存其他尺寸图片 .centerCrop() .crossFade().into(mImage); mImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!UtilsViewEvent.isFastDoubleClick()) { getDetailData(item.link); } } }); mTopLayout.addView(mImage); } mRecyclerView.addHeaderView(topView); mRefreshAdapter.setHeaderViewsNumber(mRecyclerView.getTopViewCount()); }
private void createMenuLayout() { mMenuLayout = new LinearLayoutCompat(getContext()); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mMenuLayout.setId(genViewId()); addView(mMenuLayout, layoutParams); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { mMenuLayout.setPaddingRelative(0, 0, 0, 0); } else { mMenuLayout.setPadding(0, 0, 0, 0); } }
protected final void onMeasure(int paramInt1, int paramInt2) { LinearLayoutCompat localLinearLayoutCompat = this.mActivityChooserContent; if (this.mDefaultActivityButton.getVisibility() != 0) { paramInt2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(paramInt2), 1073741824); } measureChild(localLinearLayoutCompat, paramInt1, paramInt2); setMeasuredDimension(localLinearLayoutCompat.getMeasuredWidth(), localLinearLayoutCompat.getMeasuredHeight()); }
private void generateThumbnail(String url, final int position, int size) { ImageView imageView = new ImageView(this); imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(size, size)); imageView.setBackgroundResource(R.drawable.thumbnail_bg); Picasso.with(this).load(url).fit().centerInside().into(imageView); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imagesPager.setCurrentItem(position, true); } }); thumbnails.addView(imageView); }
private void init(Context context, int width) { LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams((int)(width) , (int)(width)); layoutParams.gravity = Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL; this.setLayoutParams(layoutParams); LeftOuterCircleView leftOuterCircleView1 = new LeftOuterCircleView(context, width , false); LeftOuterCircleView leftOuterCircleView2 = new LeftOuterCircleView(context, (width - 40 ), true); circleTitleView = new CircleTitleView(context, (int) (width)); circleTitleView.setTextColor(getContext().getResources().getColor(android.R.color.white)); circleTitleView.setTextSize(20); circleTitleView.setTypeface(Typeface.DEFAULT, Typeface.BOLD_ITALIC); circleTitleView.setText("App Name"); this.addView(leftOuterCircleView1); this.addView(leftOuterCircleView2); addCircle(1, width - 78, (float) 0.0, 0.85); addCircle(2,width - 150, (float) 0.0, 0.97); addCircle(3, width - 170, (float) 0.0, 0.97); addCircle(4, width - 190, (float) 0.0, 0.98); addCircle(5, width - 210, (float) 0.0, 0.98); addCircle(6, width - 230, (float) 0.0, 0.85); addCircle(7, width - 280, (float) 0.0, 0.85); addCircle(0,width - 35, (float) 0.0, 0.9); addCircle(0,width - 92, (float)0.1, 0.9); this.addView(circleTitleView); animateClockWise(leftOuterCircleView1); animateAntiClockWise(leftOuterCircleView2); }
public HorizontalPicker(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOrientation(VERTICAL); header = new LinearLayout(context); header.setOrientation(LinearLayout.HORIZONTAL); float density = getResources().getDisplayMetrics().density; addView(header, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (density * 56))); mDetailContainer = new FrameLayout(context); addView(mDetailContainer, new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); }
public void onResume() { super.onResume(); Window window = getDialog().getWindow(); window.setLayout(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, getResources().getDimensionPixelSize(R.dimen.dialog_height)); }
private Spinner createSpinner() { AppCompatSpinner appcompatspinner = new AppCompatSpinner(getContext(), null, android.support.v7.appcompat.R.attr.actionDropDownStyle); appcompatspinner.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2, -1)); appcompatspinner.setOnItemSelectedListener(this); return appcompatspinner; }
private LinearLayoutCompat createTabLayout() { LinearLayoutCompat linearlayoutcompat = new LinearLayoutCompat(getContext(), null, android.support.v7.appcompat.R.attr.actionBarTabBarStyle); linearlayoutcompat.setMeasureWithLargestChildEnabled(true); linearlayoutcompat.setGravity(17); linearlayoutcompat.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2, -1)); return linearlayoutcompat; }
protected void onMeasure(int i, int j) { LinearLayoutCompat linearlayoutcompat = mActivityChooserContent; int k = j; if (mDefaultActivityButton.getVisibility() != 0) { k = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(j), 0x40000000); } measureChild(linearlayoutcompat, i, k); setMeasuredDimension(linearlayoutcompat.getMeasuredWidth(), linearlayoutcompat.getMeasuredHeight()); }
public static void chatsExplorationTutorial(final Activity activity, final LinearLayoutCompat hueLayout) { PreferencesManager manager = new PreferencesManager(activity); if (!manager.isDisplayed(SE_ROOMS_TAB)) { ChatroomsExplorationActivity.touchesBlocked = true; } if (mCategoryConfig == null) { setCategoryConfig(activity); } ArrayList<View> seTxtView = new ArrayList<>(); final ArrayList<View> soTxtView = new ArrayList<>(); hueLayout.getChildAt(0).findViewsWithText(seTxtView, "SE", View.FIND_VIEWS_WITH_TEXT); hueLayout.getChildAt(1).findViewsWithText(soTxtView, "SO", View.FIND_VIEWS_WITH_TEXT); SpotlightView SErooms = new SpotlightView.Builder(activity) .target(seTxtView.get(0)) .usageId(SE_ROOMS_TAB) .setConfiguration(mCategoryConfig) .headingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_heading)) .subHeadingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_text)) .show(); final SpotlightView.Builder SOrooms = new SpotlightView.Builder(activity) .setConfiguration(mCategoryConfig) .headingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_heading)) .subHeadingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_text)) .usageId(SO_ROOMS_TAB); SpotlightListener listener = new SpotlightListener() { @Override public void onUserClicked(String s) { switch (s) { case SE_ROOMS_TAB: ChatroomsExplorationActivity.touchesBlocked = true; SOrooms.target(soTxtView.get(0)).show(); break; case SO_ROOMS_TAB: ChatroomsExplorationActivity.touchesBlocked = false; break; } } @Override public void onFinishedDrawingSpotlight() { ChatroomsExplorationActivity.touchesBlocked = false; } @Override public void onStartedDrawingSpotlight() { ChatroomsExplorationActivity.touchesBlocked = false; } }; SErooms.setListener(listener); SOrooms.setListener(listener); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_linear_layout_compat); mLlc = (LinearLayoutCompat) findViewById(R.id.llc); }
public void beginning(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_BEGINNING); }
public void middle(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_MIDDLE); }
public void end(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_END); }
private int getItemLeftSpace(int itemPosition) { if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.HORIZONTAL) { return horizontalItemSpacingInPx; } return horizontalItemSpacingInPx >> 1; }
private int getItemRightSpace(int itemPosition, int childCount) { if (isLastItem(itemPosition, childCount) && orientation == LinearLayoutCompat.HORIZONTAL) { return horizontalItemSpacingInPx; } return horizontalItemSpacingInPx >> 1; }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setTitle("All Slot Information"); alertDialogBuilder.setMessage("Following slots have been configured in the beacon"); final View alertDialogView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_all_slot_info, null); final LinearLayout slotTitleContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_title_container); final LinearLayout slotInfoContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_info_container); LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); for(int i = 0; i < mAllSlotInfo.size(); i++) { TextView slotTitle = new TextView(getActivity()); slotTitle.setLayoutParams(lParams); slotTitle.setText("Slot " + i + ":"); slotTitleContainer.addView(slotTitle); TextView slotInfo = new TextView(getActivity()); slotInfo.setLayoutParams(lParams); slotInfo.setText(mAllSlotInfo.get(i)); slotInfoContainer.addView(slotInfo); if(i > 0){ lParams.setMargins(0, 10, 0, 0); } } final AlertDialog alertDialog = alertDialogBuilder.setView(alertDialogView).setPositiveButton(getString(R.string.ok), null).show(); alertDialog.setCanceledOnTouchOutside(false); alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return alertDialog; }