当前位置: 首页>>代码示例>>Java>>正文


Java R类代码示例

本文整理汇总了Java中com.haarman.listviewanimations.R的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


R类属于com.haarman.listviewanimations包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDismiss

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public void onDismiss(@NonNull final ViewGroup listView, @NonNull final int[] reverseSortedPositions) {
    for (int position : reverseSortedPositions) {
        mAdapter.remove(position);
    }

    if (mToast != null) {
        mToast.cancel();
    }
    mToast = Toast.makeText(
            DynamicListViewActivity.this,
            getString(R.string.removed_positions, Arrays.toString(reverseSortedPositions)),
            Toast.LENGTH_LONG
    );
    mToast.show();
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:17,代码来源:DynamicListViewActivity.java

示例2: getView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    ViewHolder viewHolder;
    View view = convertView;
    if (view == null) {
        view = LayoutInflater.from(mContext).inflate(R.layout.activity_googlecards_card, parent, false);

        viewHolder = new ViewHolder();
        viewHolder.textView = (TextView) view.findViewById(R.id.activity_googlecards_card_textview);
        view.setTag(viewHolder);

        viewHolder.imageView = (ImageView) view.findViewById(R.id.activity_googlecards_card_imageview);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }

    viewHolder.textView.setText(mContext.getString(R.string.card_number, getItem(position) + 1));
    setImageView(viewHolder, position);

    return view;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:22,代码来源:GoogleCardsAdapter.java

示例3: setImageView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
private void setImageView(final ViewHolder viewHolder, final int position) {
    int imageResId;
    switch (getItem(position) % 5) {
        case 0:
            imageResId = R.drawable.img_nature1;
            break;
        case 1:
            imageResId = R.drawable.img_nature2;
            break;
        case 2:
            imageResId = R.drawable.img_nature3;
            break;
        case 3:
            imageResId = R.drawable.img_nature4;
            break;
        default:
            imageResId = R.drawable.img_nature5;
    }

    Bitmap bitmap = getBitmapFromMemCache(imageResId);
    if (bitmap == null) {
        bitmap = BitmapFactory.decodeResource(mContext.getResources(), imageResId);
        addBitmapToMemoryCache(imageResId, bitmap);
    }
    viewHolder.imageView.setImageBitmap(bitmap);
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:27,代码来源:GoogleCardsAdapter.java

示例4: MyExpandableListItemAdapter

import com.haarman.listviewanimations.R; //导入依赖的package包/类
/**
 * Creates a new ExpandableListItemAdapter with the specified list, or an empty list if
 * items == null.
 */
private MyExpandableListItemAdapter(Context context, List<Integer> items) {
	super(context, R.layout.activity_expandablelistitem_card, R.id.activity_expandablelistitem_card_title, R.id.activity_expandablelistitem_card_content, items);
	mContext = context;

	final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

	// Use 1/8th of the available memory for this memory cache.
	final int cacheSize = maxMemory;
	mMemoryCache = new LruCache<Integer, Bitmap>(cacheSize) {
		@Override
		protected int sizeOf(Integer key, Bitmap bitmap) {
			// The cache size will be measured in kilobytes rather than
			// number of items.
			return bitmap.getRowBytes() * bitmap.getHeight() / 1024;
		}
	};
}
 
开发者ID:HsingPeng,项目名称:ALLGO,代码行数:22,代码来源:ExpandableListItemActivity.java

示例5: onCreate

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_draganddrop);

	mListView = (DynamicListView) findViewById(R.id.activity_draganddrop_listview);
	mListView.setDivider(null);

	ArrayAdapter<Integer> adapter = createListAdapter();
	AlphaInAnimationAdapter animAdapter = new AlphaInAnimationAdapter(adapter);
	animAdapter.setInitialDelayMillis(300);
	animAdapter.setAbsListView(mListView);
	mListView.setAdapter(animAdapter);

	Toast.makeText(this, "Long press an item to start dragging", Toast.LENGTH_LONG).show();
}
 
开发者ID:HsingPeng,项目名称:ALLGO,代码行数:17,代码来源:DragAndDropActivity.java

示例6: onCreate

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_draganddrop);

       DynamicListView listView = (DynamicListView) findViewById(R.id.activity_draganddrop_listview);
	listView.setDivider(null);

       TextView headerView =new TextView(this);
       headerView.setText("HEADER");
       listView.addHeaderView(headerView);

	final ArrayAdapter<Integer> adapter = createListAdapter();
	AlphaInAnimationAdapter animAdapter = new AlphaInAnimationAdapter(adapter);
	animAdapter.setInitialDelayMillis(300);
	animAdapter.setAbsListView(listView);
	listView.setAdapter(animAdapter);

	Toast.makeText(this, "Long press an item to start dragging", Toast.LENGTH_LONG).show();
       listView.setOnItemMovedListener(new DynamicListView.OnItemMovedListener() {
           @Override
           public void onItemMoved(final int newPosition) {
               Toast.makeText(getApplicationContext(), adapter.getItem(newPosition) + " moved to position " + newPosition, Toast.LENGTH_SHORT).show();
           }
       });
}
 
开发者ID:dakshit,项目名称:upes-academics,代码行数:27,代码来源:DragAndDropActivity.java

示例7: getView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    ImageView imageView = (ImageView) convertView;

    if (imageView == null) {
        imageView = new ImageView(mContext);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    }

    int imageResId;
    switch (getItem(position) % 5) {
        case 0:
            imageResId = R.drawable.img_nature1;
            break;
        case 1:
            imageResId = R.drawable.img_nature2;
            break;
        case 2:
            imageResId = R.drawable.img_nature3;
            break;
        case 3:
            imageResId = R.drawable.img_nature4;
            break;
        default:
            imageResId = R.drawable.img_nature5;
    }

    Bitmap bitmap = getBitmapFromMemCache(imageResId);
    if (bitmap == null) {
        bitmap = BitmapFactory.decodeResource(mContext.getResources(), imageResId);
        addBitmapToMemoryCache(imageResId, bitmap);
    }
    imageView.setImageBitmap(bitmap);

    return imageView;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:37,代码来源:GridViewAdapter.java

示例8: onOptionsItemSelected

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_expandable_limit:
            mLimited = !mLimited;
            item.setChecked(mLimited);
            mExpandableListItemAdapter.setLimit(mLimited ? 2 : 0);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:12,代码来源:ExpandableListItemActivity.java

示例9: MyExpandableListItemAdapter

import com.haarman.listviewanimations.R; //导入依赖的package包/类
/**
 * Creates a new ExpandableListItemAdapter with the specified list, or an empty list if
 * items == null.
 */
public MyExpandableListItemAdapter(final Context context) {
    super(context, R.layout.activity_expandablelistitem_card, R.id.activity_expandablelistitem_card_title, R.id.activity_expandablelistitem_card_content);
    mContext = context;
    mMemoryCache = new BitmapCache();

    for (int i = 0; i < 100; i++) {
        add(i);
    }
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:14,代码来源:MyExpandableListItemAdapter.java

示例10: getTitleView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@NonNull
@Override
public View getTitleView(final int position, final View convertView, @NonNull final ViewGroup parent) {
    TextView tv = (TextView) convertView;
    if (tv == null) {
        tv = new TextView(mContext);
    }
    tv.setText(mContext.getString(R.string.expandorcollapsecard, (int) getItem(position)));
    return tv;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:11,代码来源:MyExpandableListItemAdapter.java

示例11: getContentView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@NonNull
@Override
public View getContentView(final int position, final View convertView, @NonNull final ViewGroup parent) {
    ImageView imageView = (ImageView) convertView;
    if (imageView == null) {
        imageView = new ImageView(mContext);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    }

    int imageResId;
    switch (getItem(position) % 5) {
        case 0:
            imageResId = R.drawable.img_nature1;
            break;
        case 1:
            imageResId = R.drawable.img_nature2;
            break;
        case 2:
            imageResId = R.drawable.img_nature3;
            break;
        case 3:
            imageResId = R.drawable.img_nature4;
            break;
        default:
            imageResId = R.drawable.img_nature5;
    }

    Bitmap bitmap = getBitmapFromMemCache(imageResId);
    if (bitmap == null) {
        bitmap = BitmapFactory.decodeResource(mContext.getResources(), imageResId);
        addBitmapToMemoryCache(imageResId, bitmap);
    }
    imageView.setImageBitmap(bitmap);

    return imageView;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:37,代码来源:MyExpandableListItemAdapter.java

示例12: getView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
    View view = convertView;
    if (view == null) {
        view = LayoutInflater.from(mContext).inflate(R.layout.list_row_dynamiclistview, parent, false);
    }

    ((TextView) view.findViewById(R.id.list_row_draganddrop_textview)).setText(getItem(position));

    return view;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:12,代码来源:DynamicListViewActivity.java

示例13: getUndoView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@NonNull
@Override
public View getUndoView(final int position, final View convertView, @NonNull final ViewGroup parent) {
    View view = convertView;
    if (view == null) {
        view = LayoutInflater.from(mContext).inflate(R.layout.undo_row, parent, false);
    }
    return view;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:10,代码来源:DynamicListViewActivity.java

示例14: onItemMoved

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public void onItemMoved(final int originalPosition, final int newPosition) {
    if (mToast != null) {
        mToast.cancel();
    }

    mToast = Toast.makeText(getApplicationContext(), getString(R.string.moved, mAdapter.getItem(newPosition), newPosition), Toast.LENGTH_SHORT);
    mToast.show();
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:10,代码来源:DynamicListViewActivity.java

示例15: getView

import com.haarman.listviewanimations.R; //导入依赖的package包/类
@Override
public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) {
    TextView tv = (TextView) convertView;
    if (tv == null) {
        tv = (TextView) LayoutInflater.from(mContext).inflate(android.R.layout.simple_list_item_1, parent, false);
        tv.setTextColor(mContext.getResources().getColor(android.R.color.white));
    }

    tv.setText(getItem(position));

    return tv;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:13,代码来源:AppearanceExamplesActivity.java


注:本文中的com.haarman.listviewanimations.R类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。