Java Code Examples for android.support.annotation.LayoutRes

The following are top voted examples for showing how to use android.support.annotation.LayoutRes. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Blockly   File: BasicFieldVariableView.java   View source code 7 votes vote down vote up
/**
 * @param variableNameManager The name manager containing the variables.
 * @param context A context for inflating layouts.
 * @param resource The {@link TextView} layout to use when inflating items.
 */
public VariableViewAdapter(Context context, NameManager variableNameManager,
                           @LayoutRes int resource) {
    super(context, resource);

    mVariableNameManager = variableNameManager;
    mVars = mVariableNameManager.getUsedNames();

    mRenameString = context.getString(R.string.rename_variable);
    mDeleteString = context.getString(R.string.delete_variable);
    refreshVariables();
    variableNameManager.registerObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            refreshVariables();
        }
    });
}
 
Example 2
Project: AcademApp   File: FirebaseRecyclerAdapter.java   View source code 6 votes vote down vote up
FirebaseRecyclerAdapter(Class<T> modelClass,
                        @LayoutRes int modelLayout,
                        Class<VH> viewHolderClass,
                        FirebaseArray snapshots) {
    mModelClass = modelClass;
    mModelLayout = modelLayout;
    mViewHolderClass = viewHolderClass;
    mSnapshots = snapshots;

    mSnapshots.setOnChangedListener(new ChangeEventListener() {
        @Override
        public void onChildChanged(EventType type, int index, int oldIndex) {
            FirebaseRecyclerAdapter.this.onChildChanged(type, index, oldIndex);
        }

        @Override
        public void onDataChanged() {
            FirebaseRecyclerAdapter.this.onDataChanged();
        }

        @Override
        public void onCancelled(DatabaseError error) {
            FirebaseRecyclerAdapter.this.onCancelled(error);
        }
    });
}
 
Example 3
Project: GitHub   File: CommonAdapter.java   View source code 6 votes vote down vote up
public CommonAdapter(Context context, Class<? extends T> clazz, @LayoutRes final int layoutId,final int maxRecyclerCount) {
    super();
    mContext = context;
    this.layoutId = layoutId;
    register(clazz, new MultiItemView<T>() {

        @NonNull
        @Override
        public int getLayoutId() {
            return layoutId;
        }

        @Override
        public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull T item, int position) {
            convert(holder, item, position);
        }

        @Override
        public int getMaxRecycleCount() {
            return maxRecyclerCount;
        }
    });
}
 
Example 4
Project: cniao5   File: ToastUtils.java   View source code 5 votes vote down vote up
/**
 * 安全地显示长时自定义吐司
 */
public static void showCustomLongSafe(@LayoutRes final int layoutId) {
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            setView(layoutId);
            show("", Toast.LENGTH_LONG);
        }
    });
}
 
Example 5
Project: mobile-app-dev-book   File: SectionedFirebaseRecyclerAdapter.java   View source code 5 votes vote down vote up
/**
 *
 * @param modelClass  the class of the list items
 * @param itemLayout  XML layout of each list item
 * @param itemHolderClass  ViewHolder subclass of the list item
 * @param headerLayout  XML layout of the section headers
 * @param headerHolderClass  ViewHolder subclass of the section headers
 * @param q reference to the Firebase datasource
 */
SectionedFirebaseRecyclerAdapter(Class<T> modelClass,
                                 @LayoutRes int itemLayout,
                                 Class<VH> itemHolderClass,
                                 @LayoutRes int headerLayout,
                                 Class<HVH> headerHolderClass,
                                 Query q) {
    super(modelClass, itemLayout,
            (Class<RecyclerView.ViewHolder>) itemHolderClass, q);
    this.itemLayout = itemLayout;
    this.headerLayout = headerLayout;
    this.itemClass = itemHolderClass;
    this.headerClass = headerHolderClass;
}
 
Example 6
Project: Quran   File: AudioStatusBar.java   View source code 5 votes vote down vote up
QariAdapter(@NonNull Context context,
            @NonNull List<QariItem> items,
            @LayoutRes int layoutViewId,
            @LayoutRes int dropDownViewId) {
  mItems = items;
  mLayoutViewId = layoutViewId;
  mDropDownViewId = dropDownViewId;
  mInflater = LayoutInflater.from(context);
}
 
Example 7
Project: FancyShowCaseView   File: FancyShowCaseView.java   View source code 5 votes vote down vote up
/**
 * Inflates custom view
 *
 * @param layout              layout for custom view
 * @param viewInflateListener inflate listener for custom view
 */
private void inflateCustomView(@LayoutRes int layout, OnViewInflateListener viewInflateListener) {
    View view = mActivity.getLayoutInflater().inflate(layout, this, false);
    this.addView(view);
    if (viewInflateListener != null) {
        viewInflateListener.onViewInflated(view);
    }
}
 
Example 8
Project: SkinFramework   File: ComposedResources.java   View source code 5 votes vote down vote up
@Override
public XmlResourceParser getLayout(@LayoutRes int id) throws NotFoundException {
    int realId = getCorrespondResIdStrictly(id);
    if (realId > 0) {
        return mSkinResources.getLayout(realId);
    }
    return super.getLayout(id);
}
 
Example 9
Project: memory-game   File: BaseActivity.java   View source code 5 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    ButterKnife.bind(this);
    mediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);
    shortAnimationDuration = getResources().getInteger(
            android.R.integer.config_shortAnimTime);
    initViews();
}
 
Example 10
Project: silly-android   File: ParsableDialog.java   View source code 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void setContentView(@LayoutRes final int layoutResID) {
    super.setContentView(layoutResID);
    if (mFoundViews != null) {
        mFoundViews.clear();
    }
    mFoundViews = AnnotationParser.parseFields(getContext(), this, this);
}
 
Example 11
Project: MVPtemplate   File: IRecyclerView.java   View source code 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 12
Project: GitHub   File: UltimateRecyclerView.java   View source code 5 votes vote down vote up
private void setEmptyView(@LayoutRes final int emptyResourceId) {
    if (mEmptyView == null && emptyResourceId > 0) {
        mEmptyId = emptyResourceId;
        mEmpty.setLayoutResource(emptyResourceId);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            mEmpty.setLayoutInflater(inflater);
        }
        mEmptyView = mEmpty.inflate();
    } else {
        Log.d(VIEW_LOG_TAG, "unabled to set empty view because the empty has been set");
    }
}
 
Example 13
Project: Orin   File: PlaylistAdapter.java   View source code 5 votes vote down vote up
public PlaylistAdapter(AppCompatActivity activity, ArrayList<Playlist> dataSet, @LayoutRes int itemLayoutRes, @Nullable CabHolder cabHolder) {
    super(activity, cabHolder, R.menu.menu_playlists_selection);
    this.activity = activity;
    this.dataSet = dataSet;
    this.itemLayoutRes = itemLayoutRes;
    setHasStableIds(true);
}
 
Example 14
Project: ExpandRecyclerView   File: RecyclerViewAdapter.java   View source code 5 votes vote down vote up
public RecyclerViewAdapter(Context context, List<T> dataList
        , @LayoutRes int layoutId, RecyclerViewSingleTypeProcessor singleTypeProcessor) {
    mContext = context;
    mDataList = dataList;
    mTypeLayoutIds = new ArrayMap<>();
    mTypeLayoutIds.put(0, layoutId);
    mSingleTypeProcessor = singleTypeProcessor;
}
 
Example 15
Project: Android-UtilCode   File: SnackbarUtils.java   View source code 5 votes vote down vote up
/**
 * 为snackbar添加布局
 * <p>在show...Snackbar之后调用</p>
 *
 * @param layoutId 布局文件
 * @param index    位置(the position at which to add the child or -1 to add last)
 */
public static void addView(@LayoutRes int layoutId, int index) {
    Snackbar snackbar = snackbarWeakReference.get();
    if (snackbar != null) {
        View view = snackbar.getView();
        Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout) view;
        View child = LayoutInflater.from(view.getContext()).inflate(layoutId, null);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER_VERTICAL;
        layout.addView(child, index, params);
    }
}
 
Example 16
Project: QiangHongBao   File: LViewHolder.java   View source code 5 votes vote down vote up
public static LViewHolder get(View convertView, @LayoutRes int layoutId, int position, ViewGroup parent) {
    if (convertView == null) {
        return new LViewHolder(layoutId, position, parent);
    } else {
        LViewHolder viewHolder = (LViewHolder) convertView.getTag();
        viewHolder.mPosition = position;
        return viewHolder;
    }
}
 
Example 17
Project: Orin   File: AlbumsFragment.java   View source code 5 votes vote down vote up
@LayoutRes
protected int getLayoutRes() {
    super.getLayoutRes();


    if (!Util.isTablet(getResources())) {
        return R.layout.fragment_albums_rv;
    } else {
        return super.getLayoutRes();
    }
}
 
Example 18
Project: HeadlineNews   File: ToastUtils.java   View source code 5 votes vote down vote up
/**
 * 安全地显示短时自定义吐司
 */
public static void showCustomShortSafe(@LayoutRes final int layoutId) {
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            setView(layoutId);
            show("", Toast.LENGTH_SHORT);
        }
    });
}
 
Example 19
Project: GitHub   File: ToastUtils.java   View source code 4 votes vote down vote up
/**
 * 安全地显示短时自定义吐司
 */
public static View showCustomShort(@LayoutRes final int layoutId) {
    final View view = getView(layoutId);
    show(view, Toast.LENGTH_SHORT);
    return view;
}
 
Example 20
Project: godlibrary   File: BaseSimpleAdapter.java   View source code 4 votes vote down vote up
public BaseSimpleAdapter(@LayoutRes int resource, List<T> data) {
    this.mResource = resource;
    this.mData = data;
}
 
Example 21
Project: RLibrary   File: UIWindow.java   View source code 4 votes vote down vote up
public UIWindow layout(@LayoutRes int layoutId) {
    this.layoutId = layoutId;
    return this;
}
 
Example 22
Project: Excuser   File: AppCompatPreferenceActivity.java   View source code 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example 23
Project: Android-GuideView   File: GuideView.java   View source code 4 votes vote down vote up
public Builder tipsView(@LayoutRes int tipsViewLayoutResId) {
    param.tipsViewResId = tipsViewLayoutResId;
    return this;
}
 
Example 24
Project: trust-wallet-android   File: AddWalletView.java   View source code 4 votes vote down vote up
public AddWalletView(Context context, @LayoutRes int layoutId) {
	super(context);

	init(layoutId);
}
 
Example 25
Project: SmartChart   File: PanelListAdapter.java   View source code 4 votes vote down vote up
ColumnAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List<String> objects) {
    super(context, resource, objects);
    resourceId = resource;
    columnDataList = objects;
}
 
Example 26
Project: UltimateRecyclerView   File: BaseMultiItemQuickAdapter.java   View source code 4 votes vote down vote up
protected void setDefaultViewTypeLayout(@LayoutRes int layoutResId) {
    addItemType(DEFAULT_VIEW_TYPE, layoutResId);
}
 
Example 27
Project: lokey   File: AppCompatPreferenceActivity.java   View source code 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example 28
Project: Aurora   File: DefaultVideoAdapter.java   View source code 4 votes vote down vote up
public DefaultVideoAdapter(@LayoutRes int layoutResId, @Nullable List<VideoListInfo.Video> data) {
    super(layoutResId, data);
}
 
Example 29
Project: search-dialog   File: ContactModelAdapter.java   View source code 4 votes vote down vote up
public ContactModelAdapter(Context context, @LayoutRes int layout, List<T> items) {
    this(context,layout,null, items);
}
 
Example 30
Project: OpenPad-for-Android   File: AppCompatPreferenceActivity.java   View source code 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int _layoutResID)
{
    getDelegate().setContentView(_layoutResID);
}
 
Example 31
Project: TitleBarView   File: BaseActivity.java   View source code 4 votes vote down vote up
@LayoutRes
protected abstract int getLayout();
 
Example 32
Project: trust-wallet-android   File: SystemView.java   View source code 4 votes vote down vote up
public void showEmpty(@LayoutRes int emptyLayout) {
	showEmpty(LayoutInflater.from(getContext())
			.inflate(emptyLayout, emptyBox, false));
}
 
Example 33
Project: Orin   File: SongAdapter.java   View source code 4 votes vote down vote up
public SongAdapter(AppCompatActivity activity, ArrayList<Song> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
    this(activity, dataSet, itemLayoutRes, usePalette, cabHolder, true);
}
 
Example 34
Project: MVVM-JueJin   File: ItemView.java   View source code 4 votes vote down vote up
/**
 * A convenience method for {@code ItemView.setBindingVariable(int).setLayoutRes(int)}.
 *
 * @return the {@code ItemView} for chaining
 */
public ItemView set(int bindingVariable, @LayoutRes int layoutRes) {
    this.bindingVariable = bindingVariable;
    this.layoutRes = layoutRes;
    return this;
}
 
Example 35
Project: hands-on-api-proxy   File: SingleFragmentActivity.java   View source code 4 votes vote down vote up
@LayoutRes
protected int getLayoutResId() {
    return R.layout.activity_single_fragment;
}
 
Example 36
Project: FamilyBond   File: BaseSimpleAdapter.java   View source code 4 votes vote down vote up
public BaseSimpleAdapter(Context context, @LayoutRes int id, List<T> list) {
    mContext = context;
    mLayoutResId = id;
    mList = list;
}
 
Example 37
Project: Orin   File: PlaylistSongAdapter.java   View source code 4 votes vote down vote up
public PlaylistSongAdapter(@NonNull AppCompatActivity activity, @NonNull ArrayList<PlaylistSong> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder, @Nullable OnMoveItemListener onMoveItemListener) {
    super(activity, (ArrayList<Song>) (List) dataSet, itemLayoutRes, usePalette, cabHolder);
    overrideMultiSelectMenuRes(R.menu.menu_playlists_songs_selection);
    this.onMoveItemListener = onMoveItemListener;
}
 
Example 38
Project: Android-Programming-BigNerd   File: SingleFragmentActivity.java   View source code 4 votes vote down vote up
@LayoutRes
protected int getLayoutResId() {
    return R.layout.activity_fragment;
}
 
Example 39
Project: BrewBook   File: AppCompatPreferenceActivity.java   View source code 4 votes vote down vote up
@Override
public void setContentView(@LayoutRes int layoutResID) {
    getDelegate().setContentView(layoutResID);
}
 
Example 40
Project: GitHub   File: BaseActivity.java   View source code 4 votes vote down vote up
protected <T> T inflateView(@LayoutRes int layoutResource) {
    LogUtils.verbose(className + " inflate view by layout resource");
    //noinspection unchecked
    return (T) LayoutInflater.from(activity).inflate(layoutResource, null);
}