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


Java ArrayMap类代码示例

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


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

示例1: getDefaultStyle

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
@Override
protected Map<String, String> getDefaultStyle() {
    Map<String,String> map = new ArrayMap<>();

    boolean isVertical = true;
    if (parent != null) {
        if (parent.getType() != null) {
            if (parent.getType().equals(WXBasicComponentType.HLIST)) {
                isVertical = false;
            }
        }
    }

    String prop = isVertical ? Constants.Name.HEIGHT : Constants.Name.WIDTH;
    if (getStyles().get(prop) == null &&
        getStyles().get(Constants.Name.FLEX) == null) {
        map.put(Constants.Name.FLEX, "1");
    }

    return map;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXListDomObject.java

示例2: findAllFragmentsWithViews

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
private void findAllFragmentsWithViews(
    android.app.FragmentManager fragmentManager, ArrayMap<View, android.app.Fragment> result) {
  int index = 0;
  while (true) {
    tempBundle.putInt(FRAGMENT_INDEX_KEY, index++);
    android.app.Fragment fragment = null;
    try {
      fragment = fragmentManager.getFragment(tempBundle, FRAGMENT_MANAGER_GET_FRAGMENT_KEY);
    } catch (Exception e) {
      // This generates log spam from FragmentManager anyway.
    }
    if (fragment == null) {
      break;
    }
    if (fragment.getView() != null) {
      result.put(fragment.getView(), fragment);
      if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
        findAllFragmentsWithViews(fragment.getChildFragmentManager(), result);
      }
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RequestManagerRetriever.java

示例3: pauseTest

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
@Test
public void pauseTest() {
    Class<?> reflected = showDoc.getClass();
    try {
        Method method = reflected.getDeclaredMethod("resetValues");
        method.setAccessible(true);
        method.invoke(showDoc);

        Field pauseBool = reflected.getDeclaredField("boolValues");
        pauseBool.setAccessible(true);
        Assert.assertFalse(((ArrayMap<String, Boolean>) pauseBool.get(showDoc)).get("isPaused"));

        Field field = reflected.getDeclaredField("audioPlayer");
        field.setAccessible(true);
        field.set(showDoc,new MediaPlayer());

        showDoc.pause();
        Assert.assertTrue(((ArrayMap<String, Boolean>) pauseBool.get(showDoc)).get("isPaused"));

    } catch(Exception e){
        assertFalse(true);
    }
}
 
开发者ID:Visions-Team,项目名称:eBread,代码行数:24,代码来源:ShowDocumentFragmentTest.java

示例4: fromSimpleDeviceModel

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
private DeviceState fromSimpleDeviceModel(Models.SimpleDevice offlineDevice) {
    Set<String> functions = new HashSet<>();
    Map<String, VariableType> variables = new ArrayMap<>();

    return new DeviceState.DeviceStateBuilder(offlineDevice.id, functions, variables)
            .name(offlineDevice.name)
            .cellular(offlineDevice.cellular)
            .connected(offlineDevice.isConnected)
            .version("")
            .deviceType(ParticleDeviceType.fromInt(offlineDevice.productId))
            .platformId(offlineDevice.platformId)
            .productId(offlineDevice.productId)
            .imei(offlineDevice.imei)
            .currentBuild(offlineDevice.currentBuild)
            .defaultBuild(offlineDevice.defaultBuild)
            .ipAddress(offlineDevice.ipAddress)
            .lastAppName("")
            .status(offlineDevice.status)
            .requiresUpdate(false)
            .lastHeard(offlineDevice.lastHeard)
            .build();
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:23,代码来源:ParticleCloud.java

示例5: generateViewType

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * generate viewtype by component
 *
 * @param component
 * @return
 */
private int generateViewType(WXComponent component) {
  long id;
  try {
    id = Integer.parseInt(component.getDomObject().getRef());
    String type = component.getDomObject().getAttrs().getScope();

    if (!TextUtils.isEmpty(type)) {
      if (mRefToViewType == null) {
        mRefToViewType = new ArrayMap<>();
      }
      if (!mRefToViewType.containsKey(type)) {
        mRefToViewType.put(type, id);
      }
      id = mRefToViewType.get(type);

    }
  } catch (RuntimeException e) {
    WXLogUtils.eTag(TAG, e);
    id = RecyclerView.NO_ID;
    WXLogUtils.e(TAG, "getItemViewType: NO ID, this will crash the whole render system of WXListRecyclerView");
  }
  return (int) id;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:30,代码来源:BasicListComponent.java

示例6: loadData

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * Load voice settings from file and set radio buttons
 * @throws IOException
 * @throws XmlPullParserException
 */
private void loadData() throws IOException, XmlPullParserException {
    ArrayMap<String, String> values = settingsManager.getSettings();
    voice = values.get("id");
    Voice loadedVoice = searchVoice(voice);
    if(loadedVoice == null){
        Toast.makeText(getContext(), "Errore caricamento impostazioni", Toast.LENGTH_SHORT).show();
        return;
    }
    // Language/Locale
    language = loadedVoice.get("locale");
    spnLanguage.setSelection(((ArrayAdapter) spnLanguage.getAdapter()).getPosition(language));
    // Gender
    gender = loadedVoice.get("gender");
    if(gender.equals("male"))
        rbM.setChecked(true);
    else
        rbF.setChecked(true);
    updateChoice();
    // Voice
    int pos=((ArrayAdapter) spnVoice.getAdapter()).getPosition(voice);
    spnVoice.setSelection(pos);
    // Speed
    speed = Float.valueOf(values.get("speed"));
    spnSpeed.setSelection(Math.round((speed - 1) / 0.25f));
}
 
开发者ID:Visions-Team,项目名称:eBread,代码行数:31,代码来源:SettingTTSFragment.java

示例7: bindConnect

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
private void bindConnect() {

        refreshListAndNotifyData(presenter.getLastMessages(dbMessageCount));
        Bundle bundle = new Bundle();
        Map<String, String> map = new ArrayMap<>();
        map.put("appid", SPUtils.getAppid());
        map.put("platform", "Android");
        map.put("token", SPUtils.getUserToken());
        map.put("version", "2.2");
        map.put("uuid", Utils.getUUID(mActivity));
        bundle.putString("query", com.kf5.sdk.im.utils.Utils.getMapAppend(map));
        bundle.putString("url", SPUtils.getChatUrl());
        presenter.initParams(bundle);
        presenter.connect();

    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:17,代码来源:BaseChatActivity.java

示例8: getUniqueMap

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * Construct a new map, that contains a unique String key for each value.
 * <p>
 * Current algorithm will construct unique key by appending a unique position number to
 * key's toString() value
 *
 * @return a {@link Map}
 */
public ArrayMap<String, V> getUniqueMap() {
    ArrayMap<String, V> uniqueMap = new ArrayMap<>();
    for (Map.Entry<K, List<V>> entry : mInternalMap.entrySet()) {
        int count = 1;
        for (V value : entry.getValue()) {
            if (count == 1) {
                addUniqueEntry(uniqueMap, entry.getKey().toString(), value);
            } else {
                // append unique number to key for each value
                addUniqueEntry(uniqueMap, String.format("%s%d", entry.getKey(), count), value);
            }
            count++;
        }
    }
    return uniqueMap;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:25,代码来源:MultiMap.java

示例9: RecyclerViewGroupAdapter

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
public RecyclerViewGroupAdapter(Context context, List<T> dataList
        , @LayoutRes int[] typeLayoutIds, Integer groupType, RecyclerViewGroupTypeProcessor<T> groupTypeProcessor) {
    mContext = context;
    if (groupType != null && groupType >= 0) mGroupViewType = groupType;
    mDataList = dataList;
    if (typeLayoutIds != null && typeLayoutIds.length != 0) {
        mTypeLayoutIds = new ArrayMap<>();
        int typeSize = typeLayoutIds.length;
        for (int i = 0; i < typeSize; i++) {
            mTypeLayoutIds.put(i, typeLayoutIds[i]);
        }
    }
    mGroupTypeProcessor = groupTypeProcessor;

    initGroup();
}
 
开发者ID:arjinmc,项目名称:ExpandRecyclerView,代码行数:17,代码来源:RecyclerViewGroupAdapter.java

示例10: initGroup

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * init group info for group count, position map and count map
 */
private void initGroup() {
    mGroupPositionMap = new ArrayMap<>();
    mGroupItemCountMap = new ArrayMap<>();
    mGroupCount = 0;

    int lastGroupPosition = 0;

    if (mDataList != null && !mDataList.isEmpty()) {
        int dataSize = mDataList.size();
        for (int i = 0; i < dataSize; i++) {
            if (getItemViewType(i) == mGroupViewType) {
                mGroupPositionMap.put(mGroupCount, i);
                lastGroupPosition = i;

                if (mGroupCount != 0) {
                    mGroupItemCountMap.put(mGroupCount - 1, i - mGroupPositionMap.get(mGroupCount - 1));
                }
                mGroupCount++;
            }
        }
        mGroupItemCountMap.put(mGroupCount - 1, dataSize - lastGroupPosition);
    }
}
 
开发者ID:arjinmc,项目名称:ExpandRecyclerView,代码行数:27,代码来源:RecyclerViewGroupAdapter.java

示例11: findChildGroupPosition

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * find out the child position of its group
 *
 * @param position adapter item position
 * @return
 */
private int findChildGroupPosition(int position) {

    if (mChildGroupPositionCacheMap == null)
        mChildGroupPositionCacheMap = new ArrayMap<>();
    if (mDataList == null || mDataList.isEmpty()) return -1;
    int tempPosition = mDataList.size();
    int groupPosition = 0;

    if (mChildGroupPositionCacheMap.containsKey(position))
        return mChildGroupPositionCacheMap.get(position);
    for (int i = mGroupCount; i > 0; i--) {
        if (tempPosition <= position) {
            groupPosition = i;
            mChildGroupPositionCacheMap.put(position, groupPosition);
            break;
        }

        tempPosition -= mGroupItemCountMap.get(i - 1);
    }
    return groupPosition;
}
 
开发者ID:arjinmc,项目名称:ExpandRecyclerView,代码行数:28,代码来源:RecyclerViewGroupAdapter.java

示例12: findChildPosition

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/**
 * find out the child position of its group
 *
 * @param groupPosition the group position of the group list
 * @param position      adapter item position
 * @return
 */
private int findChildPosition(int groupPosition, int position) {

    if (mChildItemPositionCacheMap == null)
        mChildItemPositionCacheMap = new ArrayMap<>();
    if (mDataList == null || mDataList.isEmpty()) return -1;
    int positionInGroup = 0;
    if (mChildItemPositionCacheMap.containsKey(position))
        return mChildItemPositionCacheMap.get(position);

    int groupItemCount = mGroupItemCountMap.get(groupPosition);
    int groupRealPosition = mGroupPositionMap.get(groupPosition);
    positionInGroup = (position - groupRealPosition) % groupItemCount - 1;
    mChildItemPositionCacheMap.put(position, positionInGroup);

    return positionInGroup;

}
 
开发者ID:arjinmc,项目名称:ExpandRecyclerView,代码行数:25,代码来源:RecyclerViewGroupAdapter.java

示例13: readThemeSetting

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
/***
 * Public method that read information about theme settings from XML file
 * @param parser                    the current parser used to parse the XML file
 * @return ThemeSetting contains loaded settings
 * @throws XmlPullParserException
 * @throws IOException
 */
private ThemeSetting readThemeSetting(XmlPullParser parser) throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, null, "themesetting");

    ArrayMap<String, String> newValues = new ArrayMap<>();
    while (parser.next() != XmlPullParser.END_TAG) {
        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();
        if (name.equals("font")) {
            newValues.put("font", readText(parser));
        } else if (name.equals("palette")) {
            newValues.put("palette", readText(parser));
        } else if (name.equals("highlight")) {
            newValues.put("highlight", readText(parser));
        }
    }

    ThemeSetting themesetting = new ThemeSetting();
    themesetting.changeSetting(newValues);
    return themesetting;
}
 
开发者ID:Visions-Team,项目名称:eBread,代码行数:30,代码来源:SettingManager.java

示例14: performLogin

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
private void performLogin() {
    if (!TextUtils.isEmpty(mNameView.getText().toString())
            && !TextUtils.isEmpty(mPasswordView.getText().toString())
            && !TextUtils.isEmpty(mUrlView.getText().toString())) {
        final String userName = mNameView.getText().toString().trim();
        final String userPassword = mPasswordView.getText().toString();
        final Map<String, Object> params = new ArrayMap<String, Object>();
        params.put(Constants.PREFS_USER, userName);
        params.put(Constants.PREFS_PASSWORD, userPassword);

        showDialog();
        Communicator.getInstance().login(params,
                collectUrl(mUrlView.getText().toString()), this);
    } else {
        DialogHelper.showAlertDialog(LoginActivity.this, getString(R.string.fill_fields));
    }
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:18,代码来源:LoginActivity.java

示例15: getIds

import android.support.v4.util.ArrayMap; //导入依赖的package包/类
public ArrayMap<Integer, long[]> getIds() {
    ArrayMap<Integer, long[]> arrayMap = new ArrayMap<>();
    if (choiceMode == ListView.CHOICE_MODE_MULTIPLE) {
        for (Map.Entry<Integer, SparseBooleanArray> entry : multipleIds.entrySet()) {
            List<Integer> l = new ArrayList<>();
            SparseBooleanArray ids = entry.getValue();
            for (int i = 0; i < ids.size(); i++) {
                if (ids.valueAt(i)) {
                    l.add(ids.keyAt(i));
                }
            }
            long[] _ids = new long[l.size()];
            for (int i = 0; i < l.size(); i++) {
                _ids[i] = l.get(i);
            }
            arrayMap.put(entry.getKey(), _ids);
        }
    }
    return arrayMap;
}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:21,代码来源:ExpandableListViewCheckAdapter.java


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