android.view.ViewStub Java Examples

The following examples show how to use android.view.ViewStub. 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: GraphObjectAdapter.java    From KlyphMessenger with MIT License 6 votes vote down vote up
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
Example #2
Source File: GraphObjectAdapter.java    From Klyph with MIT License 6 votes vote down vote up
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
Example #3
Source File: ViewHelper.java    From Common with Apache License 2.0 6 votes vote down vote up
/**
 * @param parentView
 * @param viewStubId
 * @param inflatedViewId
 * @param inflateLayoutResId
 * @return
 */
@SuppressLint("ResourceType")
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId, int inflateLayoutResId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        if (vs.getLayoutResource() < 1 && inflateLayoutResId > 0) {
            vs.setLayoutResource(inflateLayoutResId);
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
Example #4
Source File: X8MainCameraSettingController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void initViews(View rootView) {
    this.handleView = rootView.findViewById(R.id.x8_camera_setting_layout);
    this.rlCameraSetting = rootView.findViewById(R.id.x8_rl_main_camera_setting);
    this.cameraSettingblank = rootView.findViewById(R.id.x8_rl_main_camera_setting_blank);
    this.contentView = rootView.findViewById(R.id.rl_main_camera_setting_content);
    this.otherSettingStub = (ViewStub) rootView.findViewById(R.id.stub_camera_other_setting);
    this.x8ISOViewStub = (ViewStub) rootView.findViewById(R.id.stub_camera_iso_setting);
    this.modleStub = (ViewStub) rootView.findViewById(R.id.stub_camera_mode_setting);
    this.camerSetting = (ImageView) rootView.findViewById(R.id.camera_setting_btn);
    this.recordSetting = (ImageView) rootView.findViewById(R.id.record_setting_btn);
    this.otherSetting = (ImageView) rootView.findViewById(R.id.other_setting_btn);
    this.cameraSettingblank.setVisibility(0);
    View view = this.otherSettingStub.inflate();
    View isoView = this.x8ISOViewStub.inflate();
    View modeView = this.modleStub.inflate();
    if (this.otherSettingView == null) {
        this.otherSettingView = view.findViewById(R.id.rl_main_camera_otherSetting_layout);
        this.otherSettingView.setVisibility(8);
    }
    if (this.paramView == null) {
        this.paramView = isoView.findViewById(R.id.camera_params_setting);
    }
    if (this.modeSettingView == null) {
        this.modeSettingView = modeView.findViewById(R.id.x8_mode_setting_layout);
    }
}
 
Example #5
Source File: MainActivity.java    From android_tv_metro with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    mTabHost = (TabHost)findViewById(android.R.id.tabhost);
    mTabHost.setup();
    mTabs    = (TabWidget)findViewById(android.R.id.tabs);

    ViewStub vStub = (ViewStub) findViewById(R.id.new_home_menu);
    mMenuContainer = (FrameLayout) vStub.inflate();
    mViewPager = (ViewPager)findViewById(R.id.pager);

    mLoadingView = makeEmptyLoadingView(this, (RelativeLayout)findViewById(R.id.tabs_content));

    setScrollerTime(800);

    albumItem = (DisplayItem) getIntent().getSerializableExtra("item");
    setUserFragmentClass();
    getSupportLoaderManager().initLoader(TabsGsonLoader.LOADER_ID, null, this);

    if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
    }
}
 
Example #6
Source File: BaseInnerPage.java    From Paginize with MIT License 6 votes vote down vote up
private void showLoadingViewInternal(CharSequence text) {
  if (mLayoutLoading == null) {
    mLayoutLoading = ((ViewStub) findViewById(R.id.paginize_contrib_stub_loading_layout)).inflate();
  }

  if (mLayoutContainer != null && mLayoutContainer.getVisibility() != View.GONE) {
    mLayoutContainer.setVisibility(View.GONE);
  }

  if (mLayoutError != null && mLayoutError.getVisibility() != View.GONE) {
    mLayoutError.setVisibility(View.GONE);
    mLayoutError.startAnimation(getAminFadeOut());
  }

  TextView tvLoading = (TextView)mLayoutLoading.findViewById(R.id.paginize_contrib_tv_loading_text);
  if (text != null) {
    tvLoading.setVisibility(View.VISIBLE);
    tvLoading.setText(text);
  } else {
    tvLoading.setVisibility(View.GONE);
  }

  mLayoutLoading.setVisibility(View.VISIBLE);
}
 
Example #7
Source File: ScleraSheet.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View sheet = super.onCreateView(inflater, container, savedInstanceState);

    this.closeBox = (ImageView) sheet.findViewById(R.id.close);
    this.arcusIconTitle = (ImageView) sheet.findViewById(R.id.arcus_icon_title);
    this.textTitle = (ScleraTextView) sheet.findViewById(R.id.text_title);

    // Inflate the sheet's contents
    ViewStub sheetContents = (ViewStub) sheet.findViewById(R.id.sclera_sheet_contents);
    sheetContents.setLayoutResource(getSheetLayoutId());
    sheetContents.inflate();

    return sheet;
}
 
Example #8
Source File: SecondActivity.java    From custom-typeface with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    getLayoutInflater().setFactory(new CustomTypefaceFactory(
            this, CustomTypeface.getInstance()));

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);

    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            v.setEnabled(false);
            ViewStub viewStub = (ViewStub) findViewById(R.id.view_stub);
            viewStub.inflate();
        }
    });
}
 
Example #9
Source File: ScannerActivity.java    From Tesseract-OCR-Scanner with Apache License 2.0 6 votes vote down vote up
private void initView() {
    mQrCodeFinderView = (ScannerFinderView) findViewById(R.id.qr_code_view_finder);
    mSurfaceViewStub = (ViewStub) findViewById(R.id.qr_code_view_stub);
    switch1 = (Switch) findViewById(R.id.switch1);
    mHasSurface = false;

    bt = (Button) findViewById(R.id.bt);

    bt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            bt.setEnabled(false);
            buildProgressDialog();
            CameraManager.get().takeShot(ScannerActivity.this, ScannerActivity.this, ScannerActivity.this);
        }
    });

    Switch switch2 = (Switch) findViewById(R.id.switch2);
    switch2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            CameraManager.get().setFlashLight(isChecked);
        }
    });
}
 
Example #10
Source File: ViewHelper.java    From Common with Apache License 2.0 6 votes vote down vote up
/**
 * 把 ViewStub inflate 之后在其中根据 id 找 View
 *
 * @param parentView     包含 ViewStub 的 View
 * @param viewStubId     要从哪个 ViewStub 来 inflate
 * @param inflatedViewId 最终要找到的 View 的 id
 * @return id 为 inflatedViewId 的 View
 */
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
Example #11
Source File: ConversationItem.java    From Silence with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onFinishInflate() {
  super.onFinishInflate();

  initializeAttributes();

  this.bodyText                = (TextView)           findViewById(R.id.conversation_item_body);
  this.dateText                = (TextView)           findViewById(R.id.conversation_item_date);
  this.simInfoText             = (TextView)           findViewById(R.id.sim_info);
  this.indicatorText           = (TextView)           findViewById(R.id.indicator_text);
  this.groupStatusText         = (TextView)           findViewById(R.id.group_message_status);
  this.secureImage             = (ImageView)          findViewById(R.id.secure_indicator);
  this.deliveryStatusIndicator = (DeliveryStatusView) findViewById(R.id.delivery_status);
  this.alertView               = (AlertView)          findViewById(R.id.indicators_parent);
  this.contactPhoto            = (AvatarImageView)    findViewById(R.id.contact_photo);
  this.bodyBubble              =                      findViewById(R.id.body_bubble);
  this.mediaThumbnailStub      = new Stub<>((ViewStub) findViewById(R.id.image_view_stub));
  this.audioViewStub           = new Stub<>((ViewStub) findViewById(R.id.audio_view_stub));

  setOnClickListener(new ClickListener(null));

  bodyText.setOnLongClickListener(passthroughClickListener);
  bodyText.setOnClickListener(passthroughClickListener);
}
 
Example #12
Source File: GraphObjectAdapter.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
Example #13
Source File: BookmarkFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_bookmark_list, container, false);

    // Set the adapter
    RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
    ViewStub zeroView = view.findViewById(R.id.zero_bookmarks);


    if (bookmarks.size() != 0) {
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
        recyclerView.setAdapter(bookmarkRecyclerViewAdapter);

    } else {
        recyclerView.setVisibility(View.GONE);
        zeroView.setVisibility(View.VISIBLE);
    }

    return view;
}
 
Example #14
Source File: ViewHelper.java    From DMusic with Apache License 2.0 6 votes vote down vote up
/**
 * 把 ViewStub inflate 之后在其中根据 id 找 View
 *
 * @param parentView     包含 ViewStub 的 View
 * @param viewStubId     要从哪个 ViewStub 来 inflate
 * @param inflatedViewId 最终要找到的 View 的 id
 * @return id 为 inflatedViewId 的 View
 */
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
Example #15
Source File: NewsDetailsFragment.java    From ForPDA with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    baseInflateFragment(inflater, R.layout.fragment_article);
    ViewStub viewStub = (ViewStub) findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_news_details);
    viewStub.inflate();
    fragmentsPager = (ViewPager) findViewById(R.id.view_pager);
    webViewContainer = (FrameLayout) findViewById(R.id.swipe_refresh_list);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    detailsImage = (ImageView) findViewById(R.id.article_image);
    detailsTitle = (TextView) findViewById(R.id.article_title);
    detailsNick = (TextView) findViewById(R.id.article_nick);
    detailsCount = (TextView) findViewById(R.id.article_comments_count);
    detailsDate = (TextView) findViewById(R.id.article_date);
    imageProgressBar = (ProgressBar) findViewById(R.id.article_progress_bar);

    detailsImage.setMaxHeight(App.px24 * 10);

    AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarLayout.getLayoutParams();
    params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
    toolbarLayout.setLayoutParams(params);

    return view;
}
 
Example #16
Source File: MainActivity.java    From Speculum-Android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ((SpeculumApplication) getApplication()).createMainComponent(this).inject(this);
    Assent.setActivity(this, this);

    Configuration configuration = objectStore.get();
    boolean didLoadOldConfig = getIntent().getBooleanExtra(Constants.SAVED_CONFIGURATION_IDENTIFIER, false);

    ViewStub viewStub = configuration.isSimpleLayout() ?
            (ViewStub) findViewById(R.id.stub_simple) :
            (ViewStub) findViewById(R.id.stub_verbose);
    if (null != viewStub) viewStub.inflate();

    ButterKnife.bind(this);

    //never sleep
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    if (didLoadOldConfig)
        showConfigurationSnackbar();

    presenter.setConfiguration(configuration);
}
 
Example #17
Source File: GraphObjectAdapter.java    From android-skeleton-project with MIT License 6 votes vote down vote up
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
Example #18
Source File: FramePage.java    From Paginize with MIT License 6 votes vote down vote up
private void showLoadingUIInternal(CharSequence text) {
  if (mLayoutLoading == null) {
    mLayoutLoading = ((ViewStub) findViewById(R.id.stub_loading_layout)).inflate();
  }

  if (mLayoutError != null && mLayoutError.getVisibility() != View.GONE) {
    mLayoutError.setVisibility(View.GONE);
    mLayoutError.startAnimation(getAminFadeOut());
  }

  if (text != null) {
    ((TextView)mLayoutLoading.findViewById(R.id.tv_loading_text)).setText(text);
  }

  mLayoutContainer.setVisibility(View.GONE);
  mLayoutContainer.startAnimation(getAminFadeOut());

  mLayoutLoading.setVisibility(View.VISIBLE);
}
 
Example #19
Source File: BaseFragment.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
protected void showEmptyView(String text) {
    // 需要这样处理,否则二次显示会失败
    ViewStub viewStub = getView(R.id.vs_empty);
    if (viewStub != null) {
        emptyView = viewStub.inflate();
        ((TextView) emptyView.findViewById(R.id.tv_tip_empty)).setText(text);
    }
    if (emptyView != null) {
        emptyView.setVisibility(View.VISIBLE);
    }

    if (loadingView != null && loadingView.getVisibility() != View.GONE) {
        loadingView.setVisibility(View.GONE);
    }
    // 停止动画
    if (mAnimationDrawable != null && mAnimationDrawable.isRunning()) {
        mAnimationDrawable.stop();
    }
    if (errorView != null) {
        errorView.setVisibility(View.GONE);
    }
    if (bindingView != null && bindingView.getRoot().getVisibility() != View.GONE) {
        bindingView.getRoot().setVisibility(View.GONE);
    }
}
 
Example #20
Source File: GraphObjectAdapter.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
Example #21
Source File: OptimumRecyclerView.java    From RvHelper with Apache License 2.0 5 votes vote down vote up
private void initView() {
    if (isInEditMode()) {
        return;
    }
    View v = LayoutInflater.from(getContext()).inflate(R.layout.layout_rvhelper, this);

    //初始化加载中界面
    mLoadingViewStub = (ViewStub) v.findViewById(R.id.loading_view_stub);
    mLoadingViewStub.setLayoutResource(mLoadingId);
    if (0 != mLoadingId) {
        View loadingView = mLoadingViewStub.inflate();
        if (loadingView instanceof LoadingLayout) {
            mLoadingLayout = (LoadingLayout) loadingView;
        }
    }

    //初始化空白页面界面
    mEmptyViewStub = (ViewStub) v.findViewById(R.id.empty_view_stub);
    mEmptyViewStub.setLayoutResource(mEmptyId);
    if (0 != mEmptyId) {
        View emptyView = mEmptyViewStub.inflate();
        if (emptyView instanceof EmptyLayout) {
            mEmptyLayout = (EmptyLayout) emptyView;
        }
    }

    initPtrView(v);
    initRecyclerView(v);
    initLoadMoreView(v);

    //默认先显示加载中界面
    if (mLoadingSwitch) {
        showLoadingView();
    }
}
 
Example #22
Source File: LinkShareViewHolder.java    From TestChat with Apache License 2.0 5 votes vote down vote up
public LinkShareViewHolder(View itemView) {
                super(itemView);
                ViewStub viewStub = (ViewStub) itemView.findViewById(R.id.vs_share_fragment_item_main);
                viewStub.setLayoutResource(R.layout.share_fragment_item_link_layout);
                viewStub.inflate();
//                display = (LinearLayout) viewStub.inflate().findViewById(R.id.ll_share_fragment_item_container);
        }
 
Example #23
Source File: BorderMenuActivity.java    From BorderMenu with Apache License 2.0 5 votes vote down vote up
@Override
public void setContentView(int layoutResID) {
	contentView = findViewById(R.id.contentView); 
	viewStub = (ViewStub) findViewById(R.id.viewStub); 
	viewStub.setLayoutResource(layoutResID);
	viewStub.inflate();
}
 
Example #24
Source File: MainActivity.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
private void showRecentlyViewed(){
    if(recentlyViewedView == null){
        ViewStub viewStub = findViewById(R.id.view_stub_recently_viewed);
        recentlyViewedView = (RecentlyViewedView) viewStub.inflate();
    }

    recentlyViewedView.show();
}
 
Example #25
Source File: DemoActivity.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
@Override
public void onTransferClick() {
    if (checkInit()) {
        return;
    }
    if (mTransferView == null) {
        ViewStub stub = findViewById(R.id.movie_menu_transfer_stub);
        mTransferView = (MovieTransferView) stub.inflate();
        mTransferView.setVisibility(View.GONE);
        mTransferView.setItemList(mTransfers);
        mTransferView.setTransferCallback(mDemoPresenter);
    }
    mBottomView.setVisibility(View.GONE);
    mTransferView.show();
}
 
Example #26
Source File: DeviceFragment.java    From ForPDA with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    baseInflateFragment(inflater, R.layout.fragment_device);
    ViewStub viewStub = (ViewStub) findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_device);
    toolbarContent = (RelativeLayout) viewStub.inflate();
    imagesPager = (PagerBullet) findViewById(R.id.images_pager);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    rating = (TextView) findViewById(R.id.item_rating);
    fragmentsPager = (ViewPager) findViewById(R.id.view_pager);

    tabLayout = new TabLayout(getContext());
    CollapsingToolbarLayout.LayoutParams tabParams = new CollapsingToolbarLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
    tabParams.setCollapseMode(CollapsingToolbarLayout.LayoutParams.COLLAPSE_MODE_PIN);
    tabLayout.setLayoutParams(tabParams);
    toolbarLayout.addView(tabLayout);

    AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarLayout.getLayoutParams();
    params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
    toolbarLayout.setLayoutParams(params);

    CollapsingToolbarLayout.LayoutParams newParams = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
    newParams.setCollapseMode(CollapsingToolbarLayout.LayoutParams.COLLAPSE_MODE_PIN);
    newParams.bottomMargin = App.px48;
    toolbar.setLayoutParams(newParams);
    toolbar.requestLayout();
    return view;
}
 
Example #27
Source File: ImageShareInfoHolder.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
public ImageShareInfoHolder(View itemView) {
    super(itemView);
    ViewStub viewStub = itemView.findViewById(R.id.vs_item_fragment_share_info_stub);
    viewStub.setLayoutResource(R.layout.item_fragment_share_info_image);
    display = (SuperRecyclerView) viewStub.inflate();
    display.setNestedScrollingEnabled(false);
}
 
Example #28
Source File: ToolbarContainer.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
private void toggleTextPanel() {
    if (mFormattedPanel == null) {
        ((ViewStub) findViewById(R.id.bottom_text_stub)).inflate();
        mFormattedPanel = findViewById(R.id.panel_super_text);
        mFormattedPanel.getLayoutParams().height = mKeyboardHeight;
        mFormattedPanel.setPresenter(mPresenter);
    }
    toggleControlPanel(mFormattedPanel);
}
 
Example #29
Source File: ToolbarContainer.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
private void toggleEmoticonPanel() {
    if (mEmoticonPanel == null) {
        ((ViewStub) findViewById(R.id.bottom_emoticon_stub)).inflate();
        mEmoticonPanel = findViewById(R.id.bottom_emoticon_panel);
        mEmoticonPanel.initialize(mKeyboardHeight);
    }
    toggleControlPanel(mEmoticonPanel);
}
 
Example #30
Source File: QPMFunctionBaseActivity.java    From QPM with Apache License 2.0 5 votes vote down vote up
private void inflateView() {
    for (IFunction function : functions) {
        ViewStub viewStub = findViewById(function.viewStubId());
        viewStub.setOnInflateListener(function.getCallback());
        function.renderer(viewStub.inflate());
    }
}