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


Java ArrayMap类代码示例

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


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

示例1: readThisArrayMapXml

import android.util.ArrayMap; //导入依赖的package包/类
/**
 * Like {@link #readThisMapXml}, but returns an ArrayMap instead of HashMap.
 * @hide
 */
public static final ArrayMap<String, ?> readThisArrayMapXml(XmlPullParser parser, String endTag,
        String[] name, ReadMapCallback callback)
        throws XmlPullParserException, java.io.IOException
{
    ArrayMap<String, Object> map = new ArrayMap<>();

    int eventType = parser.getEventType();
    do {
        if (eventType == parser.START_TAG) {
            Object val = readThisValueXml(parser, name, callback, true);
            map.put(name[0], val);
        } else if (eventType == parser.END_TAG) {
            if (parser.getName().equals(endTag)) {
                return map;
            }
            throw new XmlPullParserException(
                "Expected " + endTag + " end tag at: " + parser.getName());
        }
        eventType = parser.next();
    } while (eventType != parser.END_DOCUMENT);

    throw new XmlPullParserException(
        "Document ended before " + endTag + " end tag");
}
 
开发者ID:draekko-rand,项目名称:traypreferences,代码行数:29,代码来源:XmlUtils.java

示例2: applyConfigActivities

import android.util.ArrayMap; //导入依赖的package包/类
public static void applyConfigActivities(PackageManager pm, ArrayMap<String, AppRow> rows,
        List<ResolveInfo> resolveInfos) {
    if (DEBUG) Log.d(TAG, "Found " + resolveInfos.size() + " preference activities"
            + (resolveInfos.size() == 0 ? " ;_;" : ""));
    for (ResolveInfo ri : resolveInfos) {
        final ActivityInfo activityInfo = ri.activityInfo;
        final ApplicationInfo appInfo = activityInfo.applicationInfo;
        final AppRow row = rows.get(appInfo.packageName);
        if (row == null) {
            if (DEBUG) Log.v(TAG, "Ignoring notification preference activity ("
                    + activityInfo.name + ") for unknown package "
                    + activityInfo.packageName);
            continue;
        }
        if (row.settingsIntent != null) {
            if (DEBUG) Log.v(TAG, "Ignoring duplicate notification preference activity ("
                    + activityInfo.name + ") for package "
                    + activityInfo.packageName);
            continue;
        }
        row.settingsIntent = new Intent(APP_NOTIFICATION_PREFS_CATEGORY_INTENT)
                .setClassName(activityInfo.packageName, activityInfo.name);
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:25,代码来源:AppNotificationSettings.java

示例3: unZip

import android.util.ArrayMap; //导入依赖的package包/类
public void unZip(ArrayMap<String,File> files) throws IOException, FileExistsException {
if (!zipFile.exists())
  throw new FileNotFoundException(zipFile.toString());

FileInputStream fis= new FileInputStream(zipFile);
CheckedInputStream cos = new CheckedInputStream(fis, checksum);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(cos));

try {
  unZip(zis, files);
} finally {
  if (zis != null) {
	try {
	  zis.close();
	} catch (IOException e) {
	  throw e;
	}
  }
}
 }
 
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:21,代码来源:ZipUtil.java

示例4: setContentAreaForJsonFile

import android.util.ArrayMap; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
    public void setContentAreaForJsonFile(String str) {
        try {
            final ArrayMap fields = getFields();
            ArrayMap[] methods = getMethods();
            final ArrayMap arrayMap = methods[0];
            final ArrayMap arrayMap2 = methods[1];
//            setCanvasArea(CanvasUIEngine.g().inflateCanvasArea((CanvasHost) this, str, new CanvasUIEngineInflateListener() {
//                public void didInflatedArea(CanvasArea canvasArea, String str) {
//                    if (fields.containsKey(str)) {
//                        Field field = (Field) fields.get(str);
//                        field.setAccessible(true);
//                        try {
//                            field.set(CanvasAreaView.this, canvasArea);
//                        } catch (IllegalAccessException e) {
//                            e.printStackTrace();
//                            throw new RuntimeException(e.getMessage());
//                        }
//                    }
//                    if (arrayMap.containsKey(str)) {
//                        canvasArea.clickListener = CanvasAreaView.getListener((Method) arrayMap.get(str), canvasArea, CanvasAreaView.this);
//                    }
//                    if (arrayMap2.containsKey(str)) {
//                        canvasArea.longClickListener = CanvasAreaView.getLongListener((Method) arrayMap2.get(str), canvasArea, CanvasAreaView.this);
//                    }
//                }
//            }));
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
            throw new RuntimeException(e2.getMessage());
        } catch (InvocationTargetException e3) {
            e3.printStackTrace();
            throw new RuntimeException(e3.getMessage());
        }
    }
 
开发者ID:xieyangxuejun,项目名称:CommentView,代码行数:39,代码来源:CanvasAreaView.java

示例5: checkObj

import android.util.ArrayMap; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Test
public void checkObj() throws JSONException {
    String json = "{'a':1,'b':'2'}";

    ParamsWrapper wrapper = new ParamsWrapper(json);
    String json2 = "{'c':1,'d':'2'}";
    List<String> arr2 = new ArrayList<>();
    arr2.add("a");
    arr2.add("b");
    Map<String, Object> map2 = new ArrayMap<>();
    map2.put("A","1");
    map2.put("B","2");

    wrapper.append(json2);
    wrapper.append(arr2);
    wrapper.append(map2);
    System.out.println();
}
 
开发者ID:TangXiaoLv,项目名称:Android-Router,代码行数:20,代码来源:ParamsWrapperTest.java

示例6: createNewTokenRequest

import android.util.ArrayMap; //导入依赖的package包/类
@VisibleForTesting
protected HttpRequest createNewTokenRequest(@NonNull String bcid, @NonNull String task) {
    try {
        Map<String, String> queryParameters = new ArrayMap<>(3);
        queryParameters.put("id", BuildConfig.BIOID_APP_ID);
        queryParameters.put("bcid", bcid);
        queryParameters.put("task", task);

        return withDefaultTimeout(
                HttpRequest.get(BWS_BASE_URL + "/extension/token", queryParameters, true)
                        .basic(BuildConfig.BIOID_APP_ID, BuildConfig.BIOID_APP_SECRET)
                        .accept(CONTENT_TYPE_TEXT));
    } catch (HttpRequest.HttpRequestException e) {
        throw new NoConnectionException(e);
    }
}
 
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:17,代码来源:BioIdWebserviceClientExtended.java

示例7: addFilter

import android.util.ArrayMap; //导入依赖的package包/类
private final void addFilter(ArrayMap<String, F[]> map, String name, F filter) {
    F[] array = map.get(name);
    if (array == null) {
        array = newArray(2);
        map.put(name,  array);
        array[0] = filter;
    } else {
        final int N = array.length;
        int i = N;
        while (i > 0 && array[i-1] == null) {
            i--;
        }
        if (i < N) {
            array[i] = filter;
        } else {
            F[] newa = newArray((N*3)/2);
            System.arraycopy(array, 0, newa, 0, N);
            newa[N] = filter;
            map.put(name, newa);
        }
    }
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:23,代码来源:IntentResolver.java

示例8: getBatteryReading

import android.util.ArrayMap; //导入依赖的package包/类
public  void getBatteryReading(SensorDataListener listener){

        IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
        Intent batteryStatus = context.registerReceiver(null, intentFilter);

        int batteryStatusIntExtra = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
        boolean isCharging = batteryStatusIntExtra == BatteryManager.BATTERY_STATUS_CHARGING ||
                batteryStatusIntExtra == BatteryManager.BATTERY_STATUS_FULL;

        int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
        boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
        boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC;

        int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
        int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);

        float batteryPct = level / (float)scale;

        Log.i(TAG, "AC connected: "+acCharge);
        Log.i(TAG, "USB connected: "+usbCharge);
        Log.i(TAG, "Battery charging: "+ isCharging);
        Log.i(TAG, "Battery Level: "+ batteryPct);

        ArrayMap<String, String> map = new ArrayMap<>(3);
        map.put(SENSOR, "Battery");
        map.put(VALUE, Integer.toString(level));
        map.put(UNIT, BATTERYSENSOR_UNIT);
        map.put("charging", Boolean.toString(isCharging));
        map.put("acPlugged", Boolean.toString(acCharge));
        map.put("usbPlugged", Boolean.toString(usbCharge));
        listener.sensorData(map);
    }
 
开发者ID:ray0711,项目名称:homeDash,代码行数:33,代码来源:SensorReader.java

示例9: removeActivityFromTransitionManager

import android.util.ArrayMap; //导入依赖的package包/类
private void removeActivityFromTransitionManager() {
    final Class transitionManagerClass = TransitionManager.class;
    try {
        final Field runningTransitionsField = transitionManagerClass
                .getDeclaredField("sRunningTransitions");
        runningTransitionsField.setAccessible(true);
        //noinspection unchecked
        final ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>> runningTransitions
                = (ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>>)
                runningTransitionsField.get(transitionManagerClass);
        if(runningTransitions.get() == null || runningTransitions.get().get() == null) {
            return;
        }
        ArrayMap map = runningTransitions.get().get();
        View decorView = getWindow().getDecorView();
        if(map.containsKey(decorView)) {
            map.remove(decorView);
        }
    } catch(Exception ignored) {
    }
}
 
开发者ID:tpb1908,项目名称:AndroidProjectsClient,代码行数:22,代码来源:BaseActivity.java

示例10: testmapAttributeToObjectJSONObject

import android.util.ArrayMap; //导入依赖的package包/类
@Test
public void testmapAttributeToObjectJSONObject() throws Exception {
  JSONObject jsonObject = mock(JSONObject.class);
  Deserializer mockDeserializer = mock(Deserializer.class);
  AttributeMapper attributeMapper = new AttributeMapper(mockDeserializer, new Gson());
  JSONObject mockJSONObject = mock(JSONObject.class);
  Iterator mockIter = mock(Iterator.class);

  when(jsonObject.get("map")).thenReturn(new JSONObject());
  when(jsonObject.getJSONObject("map")).thenReturn(mockJSONObject);

  when(mockIter.hasNext()).thenReturn(true, true, false);
  when(mockIter.next()).thenReturn("Key 1", "Key 2");
  when(mockJSONObject.keys()).thenReturn(mockIter);
  when(mockJSONObject.get(anyString())).thenReturn("String");

  Article article = new Article();
  Field field = Article.class.getDeclaredField("map");
  attributeMapper.mapAttributeToObject(article, jsonObject, field, "map");

  ArgumentCaptor<ArrayMap> mapArgumentCaptor = ArgumentCaptor.forClass(ArrayMap.class);

  verify(mockDeserializer).setField(Matchers.<Resource>anyObject(), eq("map"), mapArgumentCaptor.capture());

  assertNotNull(mapArgumentCaptor);
}
 
开发者ID:xamoom,项目名称:Morpheus,代码行数:27,代码来源:AttributeMapperUnitTest.java

示例11: processDisappearingList

import android.util.ArrayMap; //导入依赖的package包/类
/**
 * A LayoutManager may want to layout a view just to animate disappearance.
 * This method handles those views and triggers remove animation on them.
 */
private void processDisappearingList(ArrayMap<View, Rect> appearingViews) {
	final int count = mDisappearingViewsInLayoutPass.size();
	for (int i = 0; i < count; i ++) {
		View view = mDisappearingViewsInLayoutPass.get(i);
		ViewHolder vh = getChildViewHolderInt(view);
		final ItemHolderInfo info = mState.mPreLayoutHolderMap.remove(vh);
		if (!mState.isPreLayout()) {
			mState.mPostLayoutHolderMap.remove(vh);
		}
		if (appearingViews.remove(view) != null) {
			mLayout.removeAndRecycleView(view, mRecycler);
			continue;
		}
		if (info != null) {
			animateDisappearance(info);
		} else {
			// let it disappear from the position it becomes visible
			animateDisappearance(new ItemHolderInfo(vh, view.getLeft(), view.getTop(),
					view.getRight(), view.getBottom()));
		}
	}
	mDisappearingViewsInLayoutPass.clear();
}
 
开发者ID:fython-tools,项目名称:NyanpasuTile,代码行数:28,代码来源:RecyclerView.java

示例12: onCreate

import android.util.ArrayMap; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    sRunning = true;

    mNotificationManager =
            (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    BluetoothManager manager =
            (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
    mBluetoothLeScanner = manager.getAdapter().getBluetoothLeScanner();

    mDetectedBeacons = new ArrayMap<>();

    startScanning();
}
 
开发者ID:devunwired,项目名称:nearby-beacons,代码行数:17,代码来源:EddystoneScannerService.java

示例13: readThisArrayMapXml

import android.util.ArrayMap; //导入依赖的package包/类
/**
 * Like {@link #readThisMapXml}, but returns an ArrayMap instead of HashMap.
 * @hide
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static final ArrayMap<String, ?> readThisArrayMapXml(XmlPullParser parser, String endTag,
                                                            String[] name, ReadMapCallback callback)
        throws XmlPullParserException, IOException
{
    ArrayMap<String, Object> map = new ArrayMap<>();

    int eventType = parser.getEventType();
    do {
        if (eventType == parser.START_TAG) {
            Object val = readThisValueXml(parser, name, callback, true);
            map.put(name[0], val);
        } else if (eventType == parser.END_TAG) {
            if (parser.getName().equals(endTag)) {
                return map;
            }
            throw new XmlPullParserException(
                "Expected " + endTag + " end tag at: " + parser.getName());
        }
        eventType = parser.next();
    } while (eventType != parser.END_DOCUMENT);

    throw new XmlPullParserException(
        "Document ended before " + endTag + " end tag");
}
 
开发者ID:NickAndroid,项目名称:SinaWeibo_Android,代码行数:30,代码来源:XmlUtils.java

示例14: getLoadedApks

import android.util.ArrayMap; //导入依赖的package包/类
@TargetApi(KITKAT)
public List<LoadedApkInternal> getLoadedApks()
    throws NoSuchFieldException, IllegalAccessException {
  List<LoadedApkInternal> loadedApks = new ArrayList<>();
  for (String field : new String[] {"mPackages", "mResourcePackages"}) {
    ArrayMap packages =
        (ArrayMap) Reflect.getField(activityThread, sActivityThreadClass, field);
    for (Object loadedApkRef : packages.values()) {
      Object loadedApk = ((WeakReference) loadedApkRef).get();
      if (loadedApk == null) {
        continue;
      }
      loadedApks.add(new LoadedApkInternal(loadedApk));
    }
  }
  return loadedApks;
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:ResourcesLoader.java

示例15: updateResourceKeys

import android.util.ArrayMap; //导入依赖的package包/类
@TargetApi(NOUGAT)
private static void updateResourceKeys(Context context, String originalResourcePath)
    throws InvocationTargetException, IllegalAccessException, NoSuchFieldException, IOException {
  List<String> exoResourcePaths = getExoPaths(context);
  if (exoResourcePaths.isEmpty()) {
    return;
  }
  String resDir = exoResourcePaths.get(0);
  String[] splitResDirs =
      exoResourcePaths
          .subList(1, exoResourcePaths.size())
          .toArray(new String[exoResourcePaths.size() - 1]);

  ArrayMap<?, ?> resourceImpls = ResourcesManagerInternal.getInstance().getResourceImpls();
  ArrayMap<Object, Object> newResourceImpls = new ArrayMap<>(resourceImpls.size());
  for (Map.Entry<?, ?> entry : resourceImpls.entrySet()) {
    Object key = entry.getKey();
    ResourcesKeyInternal keyInternal = new ResourcesKeyInternal(key);
    if (keyInternal.getResDir().equals(originalResourcePath)) {
      keyInternal.setResDir(resDir);
      keyInternal.setSplitResDirs(splitResDirs);
      newResourceImpls.put(key, entry.getValue());
    }
  }
  ResourcesManagerInternal.getInstance().setResourceImpls(newResourceImpls);
}
 
开发者ID:facebook,项目名称:buck,代码行数:27,代码来源:ResourcesLoader.java


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