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 File: AbstractPopup.java    From Common with 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 File: BaseActivity.java    From V2EX with 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 #3
Source File: HiddenAdapter.java    From PowerFileExplorer with 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 #4
Source File: AddWalletView.java    From Upchain-wallet with 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 File: BaseAdapter.java    From MvpRoute with 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 #6
Source File: StatusHelper.java    From MeiBaseModule with 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 #7
Source File: BaseFragment.java    From MvpRoute with 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 #8
Source File: StatusHelper.java    From MeiBaseModule with 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 #9
Source File: StatusHelper.java    From MeiBaseModule with 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 File: StatusHelper.java    From MeiBaseModule with 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 #11
Source File: CodeSuggestAdapter.java    From java-n-IDE-for-Android with 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 #12
Source File: IRecyclerView.java    From youqu_master with 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 File: CustomDialogSettingsObject.java    From EasySettings with 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 #14
Source File: PluginInterceptActivity.java    From Phantom with 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 #15
Source File: IRecyclerView.java    From youqu_master with 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 #16
Source File: AddWalletView.java    From ETHWallet with 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 File: StatusView.java    From StatusView with 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 File: DepositView.java    From ETHWallet with 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 File: AddWalletView.java    From ETHWallet with GNU General Public License v3.0 4 votes vote down vote up
public AddWalletView(Context context, @LayoutRes int layoutId) {
	super(context);

	init(layoutId);
}
 
Example #20
Source File: BaseCommonAdapter.java    From SimpleProject with MIT License 4 votes vote down vote up
public BaseCommonAdapter(Context context, List<T> data, @LayoutRes int[] resId) {
	this.mContext = context;
	this.mData = data;
	this.mResId = resId;
}
 
Example #21
Source File: AppCompatPreferenceActivity.java    From android-auto-call-recorder with MIT License 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example #22
Source File: StatusView.java    From StatusView with Apache License 2.0 4 votes vote down vote up
/**
 * 设置自定义 Empty 布局文件
 */
public void setEmptyView(@LayoutRes int emptyLayoutRes) {
    this.emptyLayoutId = emptyLayoutRes;
}
 
Example #23
Source File: BaseActivity.java    From StatusView with Apache License 2.0 4 votes vote down vote up
protected abstract @LayoutRes
int initLayoutResID();
 
Example #24
Source File: MeiCompatActivity.java    From MeiBaseModule with Apache License 2.0 4 votes vote down vote up
/**
 * @param layoutResId
 */
public void setToolbarLayout(@LayoutRes int layoutResId) {
    mDelegate.setToolbarLayout(layoutResId);
}
 
Example #25
Source File: BaseDialog.java    From BaseDialog with Apache License 2.0 4 votes vote down vote up
public BaseDialog contentView(@LayoutRes int layoutResID) {
    getWindow().setContentView(layoutResID);
    return this;
}
 
Example #26
Source File: MeiCompatFragmentDelegate.java    From MeiBaseModule with Apache License 2.0 4 votes vote down vote up
public void setToolbarLayout(@LayoutRes int layoutResId) {
    if (mMeiCompatFragment.canStatusHelper()) {
        mStatusHelper.setTitleLayout(layoutResId);
    }
}
 
Example #27
Source File: CartAdapter.java    From CartLayout with Apache License 2.0 4 votes vote down vote up
protected abstract @LayoutRes
int getNormalItemLayout();
 
Example #28
Source File: StatusView.java    From StatusView with Apache License 2.0 4 votes vote down vote up
/**
 * 设置自定义 Error 布局文件
 */
public void setErrorView(@LayoutRes int errorLayoutRes) {
    this.errorLayoutId = errorLayoutRes;
}
 
Example #29
Source File: MainAdapter.java    From PageRecyclerView with Apache License 2.0 4 votes vote down vote up
public MainAdapter(Context context, @LayoutRes int itemLayoutId) {
	super(context);
	mLayoutId = itemLayoutId;
}
 
Example #30
Source File: BaseFragment.java    From timecat with Apache License 2.0 4 votes vote down vote up
@LayoutRes
protected abstract int fragmentLayout();