本文整理汇总了Java中android.support.v4.util.SimpleArrayMap类的典型用法代码示例。如果您正苦于以下问题:Java SimpleArrayMap类的具体用法?Java SimpleArrayMap怎么用?Java SimpleArrayMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleArrayMap类属于android.support.v4.util包,在下文中一共展示了SimpleArrayMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setChoiceMode
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
/**
* Defines the choice behavior for the Container allowing multi-select etc.
*
* @see <a href=
* "http://developer.android.com/reference/android/widget/AbsListView.html#attr_android:choiceMode"
* >List View's Choice Mode</a>
*/
public void setChoiceMode(int choiceMode) {
mChoiceMode = choiceMode;
if (mChoiceActionMode != null) {
mChoiceActionMode.finish();
mChoiceActionMode = null;
}
if (mChoiceMode != CHOICE_MODE_NONE) {
if (mCheckStates == null) {
mCheckStates = new SimpleArrayMap<IndexPath, Boolean>();
}
if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL) {
clearChoices();
setLongClickable(true);
}
}
}
示例2: setRange
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
/**
* @param start offset relative to its parent
* @param end offset relative to its parent
*/
public void setRange(int start, int end) {
mRange = Range.create(start, end);
if (!mChildren.isEmpty()) {
SimpleArrayMap<Range<Integer>, T> newMap = new SimpleArrayMap<>();
for (int i = 0, size = mChildren.size(); i < size; i++) {
T rangeStyle = mChildren.valueAt(i);
int newStart = rangeStyle.getOriginStartOffset() + start;
int newEnd = rangeStyle.getOriginEndOffset() + start;
Range<Integer> newRange = Range.create(newStart, newEnd);
newMap.put(newRange, rangeStyle);
rangeStyle.setRange(newStart, newEnd);
}
mChildren.clear();
mChildren.putAll(newMap);
}
}
示例3: getLoaderManager
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
LoaderManagerImpl getLoaderManager(String who, boolean started, boolean create) {
if (this.mAllLoaderManagers == null) {
this.mAllLoaderManagers = new SimpleArrayMap();
}
LoaderManagerImpl lm = (LoaderManagerImpl) this.mAllLoaderManagers.get(who);
if (lm != null) {
lm.updateHostController(this);
return lm;
} else if (!create) {
return lm;
} else {
lm = new LoaderManagerImpl(who, this, started);
this.mAllLoaderManagers.put(who, lm);
return lm;
}
}
示例4: retainLoaderNonConfig
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
SimpleArrayMap<String, LoaderManager> retainLoaderNonConfig() {
boolean retainLoaders = false;
if (this.mAllLoaderManagers != null) {
int i;
int N = this.mAllLoaderManagers.size();
LoaderManagerImpl[] loaders = new LoaderManagerImpl[N];
for (i = N - 1; i >= 0; i--) {
loaders[i] = (LoaderManagerImpl) this.mAllLoaderManagers.valueAt(i);
}
for (i = 0; i < N; i++) {
LoaderManagerImpl lm = loaders[i];
if (lm.mRetaining) {
retainLoaders = true;
} else {
lm.doDestroy();
this.mAllLoaderManagers.remove(lm.mWho);
}
}
}
if (retainLoaders) {
return this.mAllLoaderManagers;
}
return null;
}
示例5: onRetainNonConfigurationInstance
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
public final Object onRetainNonConfigurationInstance() {
if (this.mStopped) {
doReallyStop(true);
}
Object custom = onRetainCustomNonConfigurationInstance();
List<Fragment> fragments = this.mFragments.retainNonConfig();
SimpleArrayMap<String, LoaderManager> loaders = this.mFragments.retainLoaderNonConfig();
if (fragments == null && loaders == null && custom == null) {
return null;
}
Object nci = new NonConfigurationInstances();
nci.custom = custom;
nci.fragments = fragments;
nci.loaders = loaders;
return nci;
}
示例6: prepareJob
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
@Nullable
JobInvocation prepareJob(JobCallback callback, Bundle bundle) {
JobInvocation job = prefixedCoder.decodeIntentBundle(bundle);
if (job == null) {
Log.e(TAG, "unable to decode job");
sendResultSafely(callback, JobService.RESULT_FAIL_NORETRY);
return null;
}
synchronized (callbacks) {
SimpleArrayMap<String, JobCallback> map = callbacks.get(job.getService());
if (map == null) {
map = new SimpleArrayMap<>(1);
callbacks.put(job.getService(), map);
}
map.put(job.getTag(), callback);
}
return job;
}
示例7: onSchedule
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
/**
* Stops the job if it is running.
*
* <p>Needed to avoid possibility of sending job result before the reschedule request is received
* by Google Play services.
*/
static void onSchedule(Job job) {
// Stop if running
synchronized (callbacks) {
SimpleArrayMap<String, JobCallback> jobs = callbacks.get(job.getService());
if (jobs == null) { // not running
return;
}
JobCallback jobCallback = jobs.get(job.getTag());
if (jobCallback == null) { // not running
return;
}
JobInvocation key =
new JobInvocation.Builder()
.setTag(job.getTag())
.setService(job.getService())
.setTrigger(job.getTrigger())
.build();
ExecutionDelegator.stopJob(key, false /* must not send the result */);
}
}
示例8: getTasks
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
@Nullable
@WorkerThread
public static SimpleArrayMap<String, Task> getTasks(Context context) {
LogUtils.d(TAG, "Loading tasks");
try {
SimpleArrayMap<String, Task> ret;
String json = getString(context, KEY_TASKS);
if (TextUtils.isEmpty(json)) {
ret = new SimpleArrayMap<>();
} else {
ret = TasksPersistence.fromJson(json);
}
LogUtils.d(TAG, "Loaded tasks " + ret);
return ret;
} catch (JSONException e) {
LogUtils.e(TAG, e);
return null;
}
}
示例9: toJson
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
public static String toJson(SimpleArrayMap<String, Task> tasks)
throws JSONException {
JSONObject root = new JSONObject();
JSONObject jsonTasks = new JSONObject();
for (int i = 0; i < tasks.size(); ++i) {
String cardId = tasks.keyAt(i);
Task task = tasks.valueAt(i);
jsonTasks.put(cardId, toJson(task));
}
root.put(KEY_TASKS, jsonTasks);
String json = root.toString();
LogUtils.d(TAG, "Generated tasks JSON " + json);
return json;
}
示例10: fromJson
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
public static SimpleArrayMap<String, Task> fromJson(String json)
throws JSONException {
LogUtils.d(TAG, "Parsing " + json);
JSONObject root = new JSONObject(json);
JSONObject jsonTasks = root.getJSONObject(KEY_TASKS);
SimpleArrayMap<String, Task> tasks = new SimpleArrayMap<>();
Iterator<String> iterator = jsonTasks.keys();
while (iterator.hasNext()) {
String cardId = iterator.next();
JSONObject jsonTask = jsonTasks.getJSONObject(cardId);
tasks.put(cardId, fromJson(cardId, jsonTask));
}
return tasks;
}
示例11: ExtendableSavedState
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
private ExtendableSavedState(Parcel in, ClassLoader loader) {
super(in, loader);
int size = in.readInt();
String[] keys = new String[size];
in.readStringArray(keys);
Bundle[] states = new Bundle[size];
in.readTypedArray(states, Bundle.CREATOR);
extendableStates = new SimpleArrayMap<>(size);
for (int i = 0; i < size; i++) {
extendableStates.put(keys[i], states[i]);
}
}
示例12: forName
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
Method forName(String methodName) {
Method handler = immediateHandlers.get(methodName);
if (handler != null) {
return handler;
}
SimpleArrayMap<String, Method> wildcardHandlers = this.wildcardHandlers;
int size = wildcardHandlers.size();
for (int i = 0; i < size; i++) {
String wildcard = wildcardHandlers.keyAt(i);
if (methodName.matches(wildcard.replace("*", ".*?"))) {
return wildcardHandlers.get(wildcard);
}
}
return fallback;
}
示例13: getLoaderManager
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
final LoaderManagerImpl getLoaderManager(String paramString, boolean paramBoolean1, boolean paramBoolean2)
{
if (this.mAllLoaderManagers == null) {
this.mAllLoaderManagers = new SimpleArrayMap();
}
LoaderManagerImpl localLoaderManagerImpl = (LoaderManagerImpl)this.mAllLoaderManagers.get(paramString);
if (localLoaderManagerImpl == null)
{
if (paramBoolean2)
{
localLoaderManagerImpl = new LoaderManagerImpl(paramString, this, paramBoolean1);
this.mAllLoaderManagers.put(paramString, localLoaderManagerImpl);
}
return localLoaderManagerImpl;
}
localLoaderManagerImpl.mHost = this;
return localLoaderManagerImpl;
}
示例14: onCreate
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
public void onCreate(Bundle paramBundle)
{
FragmentController localFragmentController1 = this.mFragments;
localFragmentController1.mHost.mFragmentManager.attachController(localFragmentController1.mHost, localFragmentController1.mHost, null);
super.onCreate(paramBundle);
NonConfigurationInstances localNonConfigurationInstances = (NonConfigurationInstances)getLastNonConfigurationInstance();
if (localNonConfigurationInstances != null)
{
FragmentController localFragmentController3 = this.mFragments;
SimpleArrayMap localSimpleArrayMap = localNonConfigurationInstances.loaders;
localFragmentController3.mHost.mAllLoaderManagers = localSimpleArrayMap;
}
if (paramBundle != null)
{
Parcelable localParcelable = paramBundle.getParcelable("android:support:fragments");
FragmentController localFragmentController2 = this.mFragments;
List localList = null;
if (localNonConfigurationInstances != null) {
localList = localNonConfigurationInstances.fragments;
}
localFragmentController2.mHost.mFragmentManager.restoreAllState(localParcelable, localList);
}
this.mFragments.mHost.mFragmentManager.dispatchCreate();
}
示例15: doInBackground
import android.support.v4.util.SimpleArrayMap; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
int size;
MediaWrapper MediaWrapper;
ArrayList<MediaWrapper> mediaList = mMediaLibrary.getVideoItems();
size = mediaList == null ? 0 : mediaList.size();
mMediaIndex = new SimpleArrayMap<String, Integer>(size);
for (int i = 0 ; i < size ; ++i){
MediaWrapper = mediaList.get(i);
mMediaIndex.put(MediaWrapper.getLocation(), Integer.valueOf(i));
publishProgress(MediaWrapper);
}
return null;
}