android.support.annotation.LayoutRes Java Examples

The following examples show how to use android.support.annotation.LayoutRes. 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: Common   Author: Dsiner   File: AbstractPopup.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a new popup window
 *
 * @param context        Context
 * @param resource       The popup's layout resource
 * @param width          The popup's width
 * @param height         The popup's height
 * @param focusable      True if the popup can be focused, false otherwise
 * @param animationStyle Animation style to use when the popup appears
 *                       and disappears.  Set to -1 for the default animation, 0 for no
 *                       animation, or a resource identifier for an explicit animation.
 */
public AbstractPopup(Context context, @LayoutRes int resource, int width, int height, boolean focusable, int animationStyle) {
    /*
     * LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     */
    super(LayoutInflater.from(context).inflate(resource, null), width, height, focusable);
    this.mContext = context;
    this.mRootView = getContentView();
    if (animationStyle != -1) {
        setAnimationStyle(animationStyle);
    }
    setOutsideTouchable(true);
    setFocusable(true);
    setClippingEnabled(true);
    setBackgroundDrawable(new BitmapDrawable());
    init();
}
 
Example #2
Source Project: youqu_master   Author: wangfeng19930909   File: IRecyclerView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 添加加载更多footer layout
 *
 * @param loadMoreFooterLayoutRes
 */
public void setLoadMoreFooterView(@LayoutRes int loadMoreFooterLayoutRes) {
    ensureLoadMoreFooterContainer();
    final View loadMoreFooter = LayoutInflater.from(getContext()).inflate(loadMoreFooterLayoutRes, mLoadMoreFooterContainer, false);
    if (loadMoreFooter != null) {
        setLoadMoreFooterView(loadMoreFooter);
    }
}
 
Example #3
Source Project: MvpRoute   Author: TLocation   File: BaseAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public BaseAdapter(Collection<T> data, @LayoutRes int layout, OnItemClickListener<V> listener) {
	this.data = new ArrayList<>();
	if (data != null) {
		this.data.addAll(data);
	}
	this.layouts = layout;
	this.listener = listener;
	spLayout = new SparseIntArray();
	spLayout.put(TYPE_NOMAL, this.layouts);
	headerList.addChangeListener(this);
}
 
Example #4
Source Project: Upchain-wallet   Author: xilibi2003   File: AddWalletView.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private void init(@LayoutRes int layoutId) {
	LayoutInflater.from(getContext()).inflate(layoutId, this, true);
	findViewById(R.id.new_account_action).setOnClickListener(this);
	findViewById(R.id.import_account_action).setOnClickListener(this);

       ViewPager viewPager = (ViewPager)findViewById(R.id.intro);
       if (viewPager != null) {
           viewPager.setPageTransformer(false, new DepthPageTransformer());
           viewPager.setAdapter(new IntroPagerAdapter());
       }
}
 
Example #5
Source Project: Phantom   Author: ManbangGroup   File: PluginInterceptActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (null == inflater) {
        return;
    }
    setContentView(inflater.inflate(layoutResID, null));
}
 
Example #6
Source Project: PowerFileExplorer   Author: PowerExplorer   File: HiddenAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
public HiddenAdapter(Context context, ContentFragment mainFrag, Futils utils, @LayoutRes int layoutId,
                     ArrayList<HFile> items, MaterialDialog materialDialog, boolean hide) {
    addAll(items);
    this.utils = utils;
    this.c = context;
    this.context = mainFrag;
    this.items = items;
    this.hide = hide;
    this.materialDialog = materialDialog;
}
 
Example #7
Source Project: V2EX   Author: dengzii   File: BaseActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    super.setContentView(R.layout.w_layout_act_root);
    setRootView();
    LayoutInflater.from(this).inflate(layoutResID, mFlContainer,true);
}
 
Example #8
Source Project: MeiBaseModule   Author: HpWens   File: StatusHelper.java    License: Apache License 2.0 5 votes vote down vote up
public View setTitleLayout(@LayoutRes int layoutResId) {
    TypedValue tv = new TypedValue();
    int actionBarHeight = mContext.getResources().getDimensionPixelSize(R.dimen.mei_48_dp);
    if (mContext.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, mContext
                .getResources().getDisplayMetrics());
    }
    return setTitleLayout(layoutResId, actionBarHeight);
}
 
Example #9
Source Project: MeiBaseModule   Author: HpWens   File: StatusHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * set empty layout
 *
 * @param layoutResId
 * @return
 */
public View setEmptyLayout(@LayoutRes int layoutResId) {
    if (mEmptyView != null) return mEmptyView;
    setViewStubLayoutRes(R.id.base_empty_stub, layoutResId);
    mEmptyView = inflateViewStub(R.id.base_empty_stub);
    return mEmptyView;
}
 
Example #10
Source Project: MeiBaseModule   Author: HpWens   File: StatusHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * set loading layout
 *
 * @param layoutResId
 * @return
 */
public View setLoadingLayout(@LayoutRes int layoutResId) {
    if (mLoadingView != null) return mLoadingView;
    setViewStubLayoutRes(R.id.base_loading_stub, layoutResId);
    mLoadingView = inflateViewStub(R.id.base_loading_stub);
    return mLoadingView;
}
 
Example #11
Source Project: MeiBaseModule   Author: HpWens   File: StatusHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * set error layout
 *
 * @param layoutResId
 * @return
 */
public View setErrorLayout(@LayoutRes int layoutResId) {
    if (mErrorView != null) return mErrorView;
    setViewStubLayoutRes(R.id.base_error_stub, layoutResId);
    mErrorView = inflateViewStub(R.id.base_error_stub);
    return mErrorView;
}
 
Example #12
Source Project: youqu_master   Author: wangfeng19930909   File: IRecyclerView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 添加刷新header layout
 *
 * @param refreshHeaderLayoutRes
 */
public void setRefreshHeaderView(@LayoutRes int refreshHeaderLayoutRes) {
    ensureRefreshHeaderContainer();
    final View refreshHeader = LayoutInflater.from(getContext()).inflate(refreshHeaderLayoutRes, mRefreshHeaderContainer, false);
    if (refreshHeader != null) {
        setRefreshHeaderView(refreshHeader);
    }
}
 
Example #13
Source Project: MvpRoute   Author: TLocation   File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 返回布局id
 *
 * @return 返回布局id
 * @throws @exception NullPointerException 当没有申明此注解是抛出此异常
 * @see Layout
 */
private @LayoutRes
int getLayout() {
	if (getClass().isAnnotationPresent(Layout.class)) {
		return getClass().getAnnotation(Layout.class).value();
	} else {
		throw new NullPointerException("You must declare that layout is annotated on the class");
	}
}
 
Example #14
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: CodeSuggestAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public CodeSuggestAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull ArrayList<Description> objects) {
    super(context, resource, objects);
    this.inflater = LayoutInflater.from(context);
    this.context = context;
    this.clone = (ArrayList<Description>) objects.clone();
    this.suggestion = new ArrayList<>();
    this.resourceID = resource;

    AppSetting appSetting = new AppSetting(context);
    editorTextSize = appSetting.getEditorTextSize();
}
 
Example #15
Source Project: EasySettings   Author: or-dvir   File: CustomDialogSettingsObject.java    License: Apache License 2.0 5 votes vote down vote up
public Builder(String key,
                 String title,
  @LayoutRes int customDialogViewId)
  {
      //todo don't forget to pass your own id's here!
      super(key,
title,
null,
R.id.textView_basicSettingsObject_title,
R.id.textView_basicSettingsObject_summary,
ESettingsTypes.VOID,
R.id.imageView_basicSettingsObject_icon);

      this.customViewId = customDialogViewId;
  }
 
Example #16
Source Project: ETHWallet   Author: snailflying   File: AddWalletView.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void init(@LayoutRes int layoutId) {
	LayoutInflater.from(getContext()).inflate(layoutId, this, true);
	findViewById(R.id.new_account_action).setOnClickListener(this);
	findViewById(R.id.import_account_action).setOnClickListener(this);

       ViewPager viewPager = findViewById(R.id.intro);
       if (viewPager != null) {
           viewPager.setPageTransformer(false, new DepthPageTransformer());
           viewPager.setAdapter(new IntroPagerAdapter());
       }
}
 
Example #17
Source Project: StatusView   Author: SheHuan   File: StatusView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 根据布局文件 Id 得到对应的 View,并设置控件属性、绑定接口
 */
private View generateStatusView(@LayoutRes int layoutId) {
    View statusView = viewArray.get(layoutId);
    if (statusView == null) {
        statusView = inflate(layoutId);
        viewArray.put(layoutId, statusView);
        configStatusView(layoutId, statusView);
    }
    return statusView;
}
 
Example #18
Source Project: ETHWallet   Author: snailflying   File: DepositView.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void init(@LayoutRes int layoutId, @NonNull Wallet wallet) {
    this.wallet = wallet;
    LayoutInflater.from(getContext()).inflate(layoutId, this, true);
    findViewById(R.id.action_coinbase).setOnClickListener(this);
    findViewById(R.id.action_shapeshift).setOnClickListener(this);
    findViewById(R.id.action_changelly).setOnClickListener(this);
}
 
Example #19
Source Project: star-zone-android   Author: bootsrc   File: BaseFragment.java    License: Apache License 2.0 4 votes vote down vote up
@LayoutRes
public abstract int getLayoutResId();
 
Example #20
Source Project: timecat   Author: triline3   File: BaseLazyLoadFragment.java    License: Apache License 2.0 4 votes vote down vote up
@LayoutRes
public abstract int getLayout();
 
Example #21
Source Project: MvpRoute   Author: TLocation   File: BaseAdapter.java    License: Apache License 2.0 4 votes vote down vote up
public final void addHeaderView(@LayoutRes int layout) {
	headerList.add(new DataBean(layout));
}
 
Example #22
Source Project: SimpleAdapterDemo   Author: JustinRoom   File: BaseHeaderFooterAdapter.java    License: Apache License 2.0 4 votes vote down vote up
public void setHeaderLayoutId(@LayoutRes int headerLayoutId) {
    this.headerLayoutId = headerLayoutId;
}
 
Example #23
Source Project: android-espresso-revealed   Author: Apress   File: AppCompatPreferenceActivity.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example #24
Source Project: imsdk-android   Author: qunarcorp   File: BaseMultiItemQuickAdapter.java    License: MIT License 4 votes vote down vote up
protected void setDefaultViewTypeLayout(@LayoutRes int layoutResId) {
    addItemType(DEFAULT_VIEW_TYPE, layoutResId);
}
 
Example #25
Source Project: TikTok   Author: TaoPaox   File: IActivity.java    License: Apache License 2.0 4 votes vote down vote up
@LayoutRes
int layoutResID();
 
Example #26
Source Project: sealrtc-android   Author: rongcloud   File: BaseRecyclerAdapter.java    License: MIT License 4 votes vote down vote up
public BaseRecyclerAdapter(@NonNull List<T> data, @LayoutRes int layoutResId) {
    mData = data;
    mLayoutResId = layoutResId;
    mSelectedItems = new SparseArray<>();
}
 
Example #27
Source Project: SimpleAdapterDemo   Author: JustinRoom   File: BaseItemAdapter.java    License: Apache License 2.0 4 votes vote down vote up
public BaseItemAdapter(@LayoutRes int itemLayoutId) {
    setItemLayoutId(itemLayoutId);
}
 
Example #28
Source Project: SimpleAdapterDemo   Author: JustinRoom   File: BaseItemAdapter.java    License: Apache License 2.0 4 votes vote down vote up
public @LayoutRes
int getItemLayoutId() {
    return itemLayoutId;
}
 
Example #29
Source Project: your-local-weather   Author: thuryn   File: AppCompatPreferenceActivity.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example #30
Source Project: Finder   Author: Seva-coder   File: AppCompatPreferenceActivity.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}