當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleArrayMap類代碼示例

本文整理匯總了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);
		}
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:FreeFlowContainer.java

示例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);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:RangeStyle.java

示例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;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:FragmentHostCallback.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:25,代碼來源:FragmentHostCallback.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:FragmentActivity.java

示例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;
}
 
開發者ID:firebase,項目名稱:firebase-jobdispatcher-android,代碼行數:20,代碼來源:GooglePlayReceiver.java

示例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 */);
  }
}
 
開發者ID:firebase,項目名稱:firebase-jobdispatcher-android,代碼行數:27,代碼來源:GooglePlayReceiver.java

示例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;
    }
}
 
開發者ID:bastienleonard,項目名稱:tomate,代碼行數:23,代碼來源:Facade.java

示例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;
}
 
開發者ID:bastienleonard,項目名稱:tomate,代碼行數:17,代碼來源:TasksPersistence.java

示例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;
}
 
開發者ID:bastienleonard,項目名稱:tomate,代碼行數:17,代碼來源:TasksPersistence.java

示例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]);
  }
}
 
開發者ID:material-components,項目名稱:material-components-android,代碼行數:17,代碼來源:ExtendableSavedState.java

示例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;
}
 
開發者ID:Miha-x64,項目名稱:Decouplex,代碼行數:18,代碼來源:Handlers.java

示例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;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:19,代碼來源:FragmentHostCallback.java

示例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();
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:25,代碼來源:FragmentActivity.java

示例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;
}
 
開發者ID:hanhailong,項目名稱:VCL-Android,代碼行數:17,代碼來源:VideoGridFragment.java


注:本文中的android.support.v4.util.SimpleArrayMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。