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 Project: arcusandroid   Author: arcus-smart-home   File: ScleraSheet.java    License: 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 #2
Source Project: Klyph   Author: jonathangerbaud   File: GraphObjectAdapter.java    License: 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 Project: FimiX8-RE   Author: wladimir-computin   File: X8MainCameraSettingController.java    License: 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 #4
Source Project: android_tv_metro   Author: XiaoMi   File: MainActivity.java    License: 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 #5
Source Project: Paginize   Author: neevek   File: BaseInnerPage.java    License: 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 #6
Source Project: Silence   Author: SilenceIM   File: ConversationItem.java    License: 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 #7
Source Project: CloudReader   Author: youlookwhat   File: BaseFragment.java    License: 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 #8
Source Project: facebook-api-android-maven   Author: avianey   File: GraphObjectAdapter.java    License: 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 #9
Source Project: android-skeleton-project   Author: AAverin   File: GraphObjectAdapter.java    License: 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 #10
Source Project: ForPDA   Author: RadiationX   File: NewsDetailsFragment.java    License: 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 #11
Source Project: Common   Author: Dsiner   File: ViewHelper.java    License: 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 #12
Source Project: Common   Author: Dsiner   File: ViewHelper.java    License: 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 #13
Source Project: Tesseract-OCR-Scanner   Author: simplezhli   File: ScannerActivity.java    License: 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 #14
Source Project: custom-typeface   Author: ppicas   File: SecondActivity.java    License: 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 #15
Source Project: KlyphMessenger   Author: jonathangerbaud   File: GraphObjectAdapter.java    License: 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 #16
Source Project: Paginize   Author: neevek   File: FramePage.java    License: 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 #17
Source Project: Speculum-Android   Author: NielsMasdorp   File: MainActivity.java    License: 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 #18
Source Project: DMusic   Author: Dsiner   File: ViewHelper.java    License: 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 #19
Source Project: IslamicLibraryAndroid   Author: fekracomputers   File: BookmarkFragment.java    License: 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 #20
Source Project: Abelana-Android   Author: googlearchive   File: GraphObjectAdapter.java    License: 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 Project: arcusandroid   Author: arcus-smart-home   File: ArcusProductFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    decimalFormat.setMaximumFractionDigits(1);
    decimalFormat.setRoundingMode(RoundingMode.HALF_UP);

    mView = view;
    deviceImage = (GlowableImageView) view.findViewById(R.id.fragment_device_info_image);
    seekArc = (DeviceSeekArc) view.findViewById(R.id.seekArc);
    topViewStub = (ViewStub) view.findViewById(R.id.top_part);
    justAMoment = view.findViewById(R.id.loading_label);
    waitingLabel = (Version1TextView) view.findViewById(R.id.waiting_on_label_device_details);

    deviceImageViewStub = (ViewStub) view.findViewById(R.id.device_image_part);

    statusViewStub = (ViewStub) view.findViewById(R.id.device_status_part);

    bottomView = view.findViewById(R.id.device_bottom_part);

    cloudIcon = (ImageView) view.findViewById(R.id.cloud_icon);
    productIcon = (ImageView) view.findViewById(R.id.product_icon);
    productBrandName = (TextView) view.findViewById(R.id.product_brand_name);

    leftNav = (ImageView) view.findViewById(R.id.left_nav);
    rightNav = (ImageView) view.findViewById(R.id.right_nav);

    viewPager = (ViewPager) getActivity().findViewById(R.id.fragment_device_detail_child_view_pager);

    return view;
}
 
Example #22
Source Project: arcusandroid   Author: arcus-smart-home   File: HeaderContentPopup.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public final void doContentSection() {
    ViewStub headerBlock = (ViewStub) contentView.findViewById(R.id.header_block);
    ViewStub contentDivider = (ViewStub) contentView.findViewById(R.id.header_content_divider);
    ViewStub contentBlock = (ViewStub) contentView.findViewById(R.id.content_block);

    Integer headerLayout = headerSectionLayout();
    if (headerLayout != null) {
        headerBlock.setLayoutResource(headerLayout);
        headerBlockView = headerBlock.inflate();
        setupHeaderSection(headerBlockView);
    }

    Integer dividerLayout = contentDividerLayout();
    if (dividerLayout != null) {
        contentDivider.setLayoutResource(dividerLayout);
        contentDividerView = contentDivider.inflate();
        setupDividerSection(contentDividerView);
    }

    Integer subContentLayout = subContentSectionLayout();
    if (subContentLayout != null) {
        contentBlock.setLayoutResource(subContentLayout);
        contentBlockView = contentBlock.inflate();
        setupSubContentSection(contentBlockView);
    }
}
 
Example #23
Source Project: UltimateRecyclerView   Author: cymcsg   File: CustomUltimateRecyclerview.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void initViews() {
    //super.initViews();
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.custom_recycler_view_layout, this);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
    mSwipeRefreshLayout = null;

    if (mRecyclerView != null) {

        mRecyclerView.setClipToPadding(mClipToPadding);
        if (mPadding != -1.1f) {
            mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }
    }

    defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
    setDefaultScrollListener();

    mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
    mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);

    mEmpty.setLayoutResource(mEmptyId);

    mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);

    if (mEmptyId != 0)
        mEmptyView = mEmpty.inflate();
    mEmpty.setVisibility(View.GONE);

    if (mFloatingButtonId != 0) {
        mFloatingButtonView = mFloatingButtonViewStub.inflate();
        mFloatingButtonView.setVisibility(View.VISIBLE);
    }

}
 
Example #24
Source Project: SimpleSmsRemote   Author: tranquvis   File: ModuleActivity.java    License: MIT License 5 votes vote down vote up
protected void setSettingsContentLayout(int layoutId) {
    findViewById(R.id.card_module_settings).setVisibility(View.VISIBLE);
    findViewById(R.id.textView_module_settings_title).setVisibility(View.VISIBLE);

    ViewStub settingsViewStub = (ViewStub) findViewById(R.id.viewStub_settings_content);
    settingsViewStub.setLayoutResource(layoutId);
    settingsViewStub.inflate();
}
 
Example #25
Source Project: materialup   Author: goodev   File: SearchActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void setNoResultsVisibility(int visibility) {
    if (visibility == View.VISIBLE) {
        if (noResults == null) {
            noResults = (BaselineGridTextView) ((ViewStub)
                    findViewById(R.id.stub_no_search_results)).inflate();
            noResults.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    searchView.setQuery("", false);
                    searchView.requestFocus();
                    ImeUtils.showIme(searchView);
                }
            });
        }
        String message = String.format(getString(R
                .string.no_search_results), searchView.getQuery().toString());
        SpannableStringBuilder ssb = new SpannableStringBuilder(message);
        ssb.setSpan(new StyleSpan(Typeface.ITALIC),
                message.indexOf('“') + 1,
                message.length() - 1,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        noResults.setText(ssb);
    }
    if (noResults != null) {
        noResults.setVisibility(visibility);
    }
}
 
Example #26
Source Project: android   Author: tvportal   File: RecentFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onInflate(ViewStub viewStub, View view) {
    TextView textView = (TextView) view.findViewById(R.id.text1);
    textView.setText(R.string.empty_recents);

    //Don't show the proxy option in an empty recent fragment
    RobotoCheckBox checkBox = (RobotoCheckBox) view.findViewById(R.id.checkBox1);
    checkBox.setVisibility(View.GONE);
}
 
Example #27
Source Project: v9porn   Author: ForLovelj   File: ExoVideoView.java    License: MIT License 5 votes vote down vote up
/**
 * Inflates the video view layout, replacing the {@link ViewStub} with the
 * correct backing implementation.
 *
 * @param context            The context to use for inflating the correct video view
 * @param attributeContainer The attributes for retrieving custom backing implementations.
 */
protected void inflateVideoView(@NonNull Context context, @NonNull AttributeContainer attributeContainer) {
    View.inflate(context, R.layout.exomedia_video_view_layout, this);
    ViewStub videoViewStub = findViewById(R.id.video_view_api_impl_stub);

    videoViewStub.setLayoutResource(getVideoViewApiImplementation(context, attributeContainer));
    videoViewStub.inflate();
}
 
Example #28
Source Project: RunMap   Author: skyinu   File: MovementTrackActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void inflateDataUiLayout(){
    ViewStub viewStub = (ViewStub) findViewById(R.id.vs_data_ui_layout);
    if(viewStub == null){
        //already inflate
        return;
    }
    View dataUiRoot = viewStub.inflate();
    //初始化数据UI相关
    mViewGpsPower = dataUiRoot.findViewById(R.id.view_gps_power);
    mBtnChangeMapUi = (Button) dataUiRoot.findViewById(R.id.btn_change_to_map_ui);
    mTvDataMoveDistance = (TextView) dataUiRoot.findViewById(R.id.tv_data_ui_distance);
    mTvDataMoveTime = (TextView) dataUiRoot.findViewById(R.id.tv_data_ui_time);
    mBtnChangeMapUi.setOnClickListener(this);
}
 
Example #29
Source Project: RvHelper   Author: chenzj-king   File: OptimumRecyclerView.java    License: 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 #30
Source Project: android-Stupid-Adapter   Author: comcp   File: MsgViewHodlerMap.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Context c) {
	viewStub_send = (ViewStub) findViewById(R.id.viewStub_send);
	viewStub_receive = (ViewStub) findViewById(R.id.viewStub_receive);
	system_msg = (TextView) findViewById(R.id.system_msg);
	getView().setOnClickListener(this);
}