本文整理汇总了Java中android.support.v4.util.SparseArrayCompat.get方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArrayCompat.get方法的具体用法?Java SparseArrayCompat.get怎么用?Java SparseArrayCompat.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.util.SparseArrayCompat
的用法示例。
在下文中一共展示了SparseArrayCompat.get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCity
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* 设置第二个列表数据
*
* @param city
*/
public void setCity(SparseArrayCompat<List<DataModel>> city) {
mCitisDatasMap = city;
List<DataModel> temp_city = city.get(mProvinceId);
if (temp_city != null) {
for (int i = 0; i < temp_city.size(); i++) {
DataModel data = temp_city.get(i);
if (data.Id == mCityId) {
mCityPosition = i;
break;
}
}
}
updateCities(mCityPosition);
// mCity.setCurrentItem(mCityPosition);
}
示例2: setArea
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* 设置第三个列表数据
*
* @param area
*/
public void setArea(SparseArrayCompat<List<DataModel>> area) {
mAreaDatasMap = area;
List<DataModel> temp_area = area.get(mCityId);
if (temp_area != null) {
for (int i = 0; i < temp_area.size(); i++) {
DataModel data = temp_area.get(i);
if (data.Id == mAreaId) {
mAreaPosition = i;
break;
}
}
}
updateAreas(mAreaPosition);
// mArea.setCurrentItem(mAreaPosition);
}
示例3: getView
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
protected <T extends View> T getView(View view, int viewId)
{
SparseArrayCompat<View> viewHolder = (SparseArrayCompat<View>) view.getTag();
if (viewHolder == null)
{
viewHolder = new SparseArrayCompat<View>();
view.setTag(viewHolder);
}
View res = viewHolder.get(viewId);
if (res == null)
{
res = view.findViewById(viewId);
viewHolder.put(viewId, res);
}
return (T) res;
}
示例4: switchHeaders
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Method switch view holders in map (map with headers view holders).
*
* @param map header view holder's map
* @param fromIndex index from view holder
* @param toIndex index to view holder
* @param type type of items (column header or row header)
*/
@SuppressWarnings("unused")
private void switchHeaders(SparseArrayCompat<ViewHolder> map, int fromIndex, int toIndex, int type) {
ViewHolder fromVh = map.get(fromIndex);
if (fromVh != null) {
map.remove(fromIndex);
if (type == ViewHolderType.COLUMN_HEADER) {
fromVh.setColumnIndex(toIndex);
} else if (type == ViewHolderType.ROW_HEADER) {
fromVh.setRowIndex(toIndex);
}
}
ViewHolder toVh = map.get(toIndex);
if (toVh != null) {
map.remove(toIndex);
if (type == ViewHolderType.COLUMN_HEADER) {
toVh.setColumnIndex(fromIndex);
} else if (type == ViewHolderType.ROW_HEADER) {
toVh.setRowIndex(fromIndex);
}
}
if (fromVh != null) {
map.put(toIndex, fromVh);
}
if (toVh != null) {
map.put(fromIndex, toVh);
}
}
示例5: getRowItems
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Get all row's items
*
* @param row row index
* @return Collection with row's Objects
*/
@NonNull
Collection<TObj> getRowItems(int row) {
Collection<TObj> result = new LinkedList<>();
SparseArrayCompat<TObj> array = mData.get(row);
for (int count = array.size(), i = 0; i < count; i++) {
int key = array.keyAt(i);
TObj columnObj = array.get(key);
if (columnObj != null) {
result.add(columnObj);
}
}
return result;
}
示例6: provideViewBinder
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public final IViewBinder provideViewBinder(StickyHeaderViewAdapter adapter, SparseArrayCompat<? extends IViewBinder> viewBinderPool, int position) {
if (viewBinder == null) {
viewBinder = viewBinderPool.get(getItemLayoutId(adapter));
}
return viewBinder;
}
示例7: provideViewBinder
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public final IViewBinder provideViewBinder(IListAdapter adapter, SparseArrayCompat<? extends IViewBinder> viewBinderPool, int position) {
if (viewBinder == null) {
viewBinder = viewBinderPool.get(getItemLayoutId(adapter));
}
return viewBinder;
}
示例8: get
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* 用于获取ItemView中的控件
*
* @param view ItemView
* @param id 要获取的控件的id
* @param <T> 返回的控件的类型
* @return 返回的控件
*/
public static <T extends View> T get(View view, int id) {
SparseArrayCompat<View> viewHolder = (SparseArrayCompat<View>) view.getTag();
if (viewHolder == null) {
viewHolder = new SparseArrayCompat<>();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null) {
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
}
示例9: addMigration
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
private void addMigration(alpha1.android.arch.persistence.room.migration.Migration migration) {
final int start = migration.startVersion;
final int end = migration.endVersion;
SparseArrayCompat<alpha1.android.arch.persistence.room.migration.Migration> targetMap
= mMigrations.get(start);
if (targetMap == null) {
targetMap = new SparseArrayCompat<>();
mMigrations.put(start, targetMap);
}
alpha1.android.arch.persistence.room.migration.Migration existing = targetMap.get(end);
if (existing != null) {
Log.w(Room.LOG_TAG, "Overriding migration " + existing + " with " + migration);
}
targetMap.append(end, migration);
}
示例10: convertTypesForFilter
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Helper method to convert list of selected types of a {@link com.schautup.data.Filter} to a string with sep {@link
* #DIV}.
*
* @param types
* A list of all {@link com.schautup.data.Filter}s.
*
* @return Selected {@link com.schautup.data.Filter}s in string with sep {@link #DIV}.
*/
private static StringBuilder convertTypesForFilter(SparseArrayCompat<ScheduleType> types) {
StringBuilder stringBuilder = new StringBuilder();
int key;
ScheduleType type;
for (int i = 0; i < types.size(); i++) {
key = types.keyAt(i);
type = types.get(key);
stringBuilder.append(type.getCode());
if (i != types.size() - 1) {//Last one?
stringBuilder.append(DIV);
}
}
return stringBuilder;
}
示例11: isEqualTo
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
@Override
public boolean isEqualTo(final SparseArrayCompat<?> array) {
int count = 0;
for (final SparseArrayEntry<V> entry : this) {
final Object value = array.get(entry.getKey());
if (value == null) {
if (entry.getValue() != null) {
return false;
}
} else if (!value.equals(entry.getValue())) {
return false;
}
++count;
}
return (count == array.size());
}
示例12: onEvent
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Handler for {@link com.schautup.bus.ShowSetFilterEvent}.
*
* @param e
* Event {@link com.schautup.bus.ShowSetFilterEvent}.
*/
public void onEvent(ShowSetFilterEvent e) {
mIsEdit = true;
Filter item = e.getFilter();
mId = item.getId();
mName = item.getName();
mHour = item.getHour();
mMinute = item.getMinute();
mNameEt.setText(mName);
mHourTv.setText(Utils.convertValue(mHour));
mMinuteTv.setText(Utils.convertValue(mMinute));
SparseArrayCompat<ScheduleType> types= item.getSelectedTypes();
int key;
ScheduleType type;
for(int i = 0; i < types.size(); i++) {
key = types.keyAt(i);
type = types.get(key);
switch (type) {
case MUTE:
mSetMuteV.performClick();
break;
case VIBRATE:
mSetVibrateV.performClick();
break;
case SOUND:
mSetSoundV.performClick();
break;
case WIFI:
mSetWifiV.performClick();
break;
case MOBILE:
mSetMobileDataV.performClick();
break;
case BRIGHTNESS:
mSetBrightnessV.performClick();
break;
case BLUETOOTH:
mSetBluetoothV.performClick();
break;
case STARTAPP:
mSetStartAppV.performClick();
break;
case CALLABORT:
mSetCallAbortV.performClick();
break;
}
}
mEventRecurrence = item.getEventRecurrence();
mEventRecurrence = Utils.showRecurrenceBadge(getActivity(), mEventRecurrence, mRecurrenceBgv);
EventBus.getDefault().removeStickyEvent(ShowSetFilterEvent.class);
}
示例13: getFilteredSchedules
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Returns {@link com.schautup.data.ScheduleItem}s from DB by hour , minute , type and recurrence which have been filtered.
*
* @param hour
* Hour.
* @param minute
* Minute.
* @param types
* A list of selected {@link com.schautup.data.ScheduleType}.
* @param eventRecurrence
* {@link EventRecurrence}.
*
* @return {@link com.schautup.data.ScheduleItem}s from DB by hour , minute , type and recurrence.
*/
public synchronized List<ScheduleItem> getFilteredSchedules(int hour, int minute,
SparseArrayCompat<ScheduleType> types, EventRecurrence eventRecurrence) {
if (mDB == null || !mDB.isOpen()) {
open();
}
List<ScheduleItem> items = new ArrayList<ScheduleItem>();
Cursor c = null;
ScheduleType type;
ScheduleItem item;
List<ScheduleItem> list;
try {
int key;
for (int i = 0; i < types.size(); i++) {
key = types.keyAt(i);
type = types.get(key);
c = mDB.query(ScheduleTbl.TABLE_NAME, null, "("+ ScheduleTbl.HOUR + " = ? AND " + ScheduleTbl.MINUTE + " = " +
"? AND " + ScheduleTbl.RECURRENCE + " = ?) AND " + ScheduleTbl.TYPE + " = ?", new String[] { hour + "", minute + "", eventRecurrence.toString(), type.getCode() + "" }, null,
null, null, null);
list = new LinkedList<ScheduleItem>();
EventRecurrence er;
while (c.moveToNext()) {
item = new ScheduleItem(c.getLong(c.getColumnIndex(ScheduleTbl.ID)), ScheduleType.fromCode(c.getInt(
c.getColumnIndex(ScheduleTbl.TYPE))), c.getInt(c.getColumnIndex(ScheduleTbl.HOUR)), c.getInt(c.getColumnIndex(ScheduleTbl.MINUTE)), c.getLong(c.getColumnIndex(
ScheduleTbl.EDIT_TIME)));
er = new EventRecurrence();
er.parse(c.getString(c.getColumnIndex(ScheduleTbl.RECURRENCE)));
item.setEventRecurrence(er);
item.setReserveLeft(c.getString(c.getColumnIndex(ScheduleTbl.RESERVE_LEFT)));
item.setReserveRight(c.getString(c.getColumnIndex(ScheduleTbl.RESERVE_RIGHT)));
list.add(item);
}
items.addAll(list);
}
} finally {
if (c != null) {
c.close();
}
close();
return items;
}
}
示例14: get
import android.support.v4.util.SparseArrayCompat; //导入方法依赖的package包/类
/**
* Get Object from matrix by row and column.
*
* @param row item row position
* @param column item column position
* @return Object in row, column position in the matrix
*/
@Nullable
TObj get(int row, int column) {
SparseArrayCompat<TObj> array = mData.get(row);
return array == null ? null : array.get(column);
}