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


Java SimpleArrayMap.size方法代碼示例

本文整理匯總了Java中android.support.v4.util.SimpleArrayMap.size方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleArrayMap.size方法的具體用法?Java SimpleArrayMap.size怎麽用?Java SimpleArrayMap.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.util.SimpleArrayMap的用法示例。


在下文中一共展示了SimpleArrayMap.size方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: writeSimpleArrayMap

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
static void writeSimpleArrayMap(Parcel dest,
                                @Nullable SimpleArrayMap<String, SparseIntArray> map) {
    if (map == null) {
        dest.writeInt(-1);
    } else {
        int size = map.size();
        dest.writeInt(size);
        for (int i = 0; i < size; ++i) {
            dest.writeString(map.keyAt(i));
            writeSparseIntArray(dest, map.valueAt(i));
        }
    }
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:14,代碼來源:ParcelUtils.java

示例4: getAllSounds

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
@NonNull
public static List<Sound> getAllSounds() {
    List<Sound> sounds = new ArrayList<>();
    SimpleArrayMap<String, List<Sound>> map = getSounds();
    for (int i = 0; i < map.size(); i++) {
        sounds.addAll(getSounds().get(map.valueAt(i)));
    }
    return sounds;
}
 
開發者ID:metinkale38,項目名稱:prayer-times-android,代碼行數:10,代碼來源:Sounds.java

示例5: sendPostsToWearable

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
private void sendPostsToWearable(@NonNull List<Post> posts, @NonNull final String msg,
                                 @Nullable SimpleArrayMap<String, Asset> assets) {
    if (mGoogleApiClient.isConnected()) {
        // convert to json for sending to watch and to save to shared prefs
        // don't need to preserve the order like having separate String lists, can more easily add/remove fields
        PutDataMapRequest mapRequest = PutDataMapRequest.create(Constants.PATH_REDDIT_POSTS);
        DataMap dataMap = mapRequest.getDataMap();

        if (assets != null && !assets.isEmpty()) {
            for (int i = 0; i < assets.size(); i++) {
                dataMap.putAsset(assets.keyAt(i), assets.valueAt(i));
            }
        }

        dataMap.putLong("timestamp", System.currentTimeMillis());
        dataMap.putString(Constants.KEY_REDDIT_POSTS, mGson.toJson(posts));
        dataMap.putBoolean(Constants.KEY_DISMISS_AFTER_ACTION,
                mUserStorage.openOnPhoneDismissesAfterAction());
        dataMap.putIntegerArrayList(Constants.KEY_ACTION_ORDER,
                mWearableActionStorage.getSelectedActionIds());

        PutDataRequest request = mapRequest.asPutDataRequest();
        Wearable.DataApi.putDataItem(mGoogleApiClient, request)
                .setResultCallback(dataItemResult -> {
                    Timber.d(msg + ", final timestamp: " + mUserStorage.getTimestamp() + " result: " + dataItemResult
                            .getStatus());

                    if (dataItemResult.getStatus().isSuccess()) {
                        if (mGoogleApiClient.isConnected()) {
                            mGoogleApiClient.disconnect();
                        }
                    } else {
                        Timber.d("Failed to send posts to wearable " + dataItemResult.getStatus()
                                .getStatusMessage());
                    }
                });
    }
}
 
開發者ID:emmaguy,項目名稱:wear-notify-for-reddit,代碼行數:39,代碼來源:RetrieveService.java

示例6: refresh

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
@Override
public void refresh() {
    new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... params) {
            final String instanceId = mInstanceIdHelper.getInstanceId();
            final String creationTime = DateFormat.getDateTimeInstance()
                    .format(new Date(mInstanceIdHelper.getCreationTime()));
            final Activity activity = getActivity();
            if (activity != null) {
                Handler handler = new Handler(activity.getMainLooper());
                handler.post(new Runnable() {
                    public void run() {
                        setValue(activity.findViewById(R.id.iid_instance_id), instanceId);
                        setValue(activity.findViewById(R.id.iid_creation_time), creationTime);
                    }
                });
            }
            return null;
        }
    }.execute();
    float density = getActivity().getResources().getDisplayMetrics().density;
    SimpleArrayMap<String, Sender> addressBook = mSenders.getSenders();
    LinearLayout sendersList = new LinearLayout(getActivity());
    sendersList.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < addressBook.size(); i++) {
        Sender sender = addressBook.valueAt(i);
        if (sender.appTokens.size() > 0) {
            LinearLayout senderRow = (LinearLayout) getActivity().getLayoutInflater()
                    .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
            ImageView senderIcon = (ImageView) senderRow.findViewById(R.id.widget_itbr_icon);
            TextView senderLabel = (TextView) senderRow.findViewById(R.id.widget_itbr_text);
            senderRow.findViewById(R.id.widget_itbr_button).setVisibility(View.GONE);
            senderIcon.setImageResource(R.drawable.cloud_googblue);
            senderIcon.setPadding(0, 0, (int) (8 * density), 0);
            senderLabel.setText(getString(R.string.topics_sender_id, sender.senderId));
            sendersList.addView(senderRow);
            for (Token token : sender.appTokens.values()) {
                LinearLayout row = (LinearLayout) getActivity().getLayoutInflater()
                        .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
                ImageView icon = (ImageView) row.findViewById(R.id.widget_itbr_icon);
                TextView label = (TextView) row.findViewById(R.id.widget_itbr_text);
                Button button = (Button) row.findViewById(R.id.widget_itbr_button);
                icon.setImageResource(R.drawable.smartphone_grey600);
                label.setText(token.scope + " - "
                        + AbstractFragment.truncateToMediumString(token.token));
                button.setText(R.string.iid_delete_token);
                button.setTag(R.id.tag_senderid, sender.senderId);
                button.setTag(R.id.tag_scope, token.scope);
                button.setOnClickListener(this);
                row.setPadding((int) (16 * density), 0, 0, 0);
                sendersList.addView(row);
            }
        }
    }
    if (sendersList.getChildCount() == 0) {
        TextView noTokens = new TextView(getActivity());
        noTokens.setText(getString(R.string.iid_no_tokens));
        noTokens.setTypeface(null, Typeface.ITALIC);
        sendersList.addView(noTokens);
    }
    FrameLayout tokensView = (FrameLayout) getActivity().findViewById(R.id.iid_tokens_wrapper);
    tokensView.removeAllViews();
    tokensView.addView(sendersList);
}
 
開發者ID:google,項目名稱:gcm,代碼行數:66,代碼來源:InstanceIdFragment.java

示例7: refresh

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
@Override
public void refresh() {
    float density = getActivity().getResources().getDisplayMetrics().density;
    SimpleArrayMap<String, Sender> addressBook = mSenders.getSenders();
    LinearLayout sendersList = new LinearLayout(getActivity());
    sendersList.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < addressBook.size(); i++) {
        Sender sender = addressBook.valueAt(i);
        // Check if at least a topic is subscribed for this sender
        int subscribedTopics = 0;
        for (Boolean subscribed : sender.topics.values()) {
            if (subscribed) {
                subscribedTopics++;
            }
        }
        if (subscribedTopics > 0) {
            LinearLayout senderRow = (LinearLayout) getActivity().getLayoutInflater()
                    .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
            ImageView senderIcon = (ImageView) senderRow.findViewById(R.id.widget_itbr_icon);
            TextView senderLabel = (TextView) senderRow.findViewById(R.id.widget_itbr_text);
            senderRow.findViewById(R.id.widget_itbr_button).setVisibility(View.GONE);
            senderIcon.setImageResource(R.drawable.cloud_googblue);
            senderIcon.setPadding(0, 0, (int) (8 * density), 0);
            senderLabel.setText(getString(R.string.topics_sender_id, sender.senderId));
            sendersList.addView(senderRow);
            for (Map.Entry<String, Boolean> topic : sender.topics.entrySet()) {
                if (topic.getValue()) {
                    LinearLayout row = (LinearLayout) getActivity().getLayoutInflater()
                            .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
                    ImageView icon = (ImageView) row.findViewById(R.id.widget_itbr_icon);
                    TextView label = (TextView) row.findViewById(R.id.widget_itbr_text);
                    Button button = (Button) row.findViewById(R.id.widget_itbr_button);
                    icon.setImageResource(R.drawable.bigtop_updates_grey600);
                    label.setText(topic.getKey());
                    button.setText(R.string.topics_unsubscribe);
                    button.setTag(R.id.tag_action, ACTION_UNSUBSCRIBE);
                    button.setTag(R.id.tag_senderid, sender.senderId);
                    button.setTag(R.id.tag_topic, topic.getKey());
                    button.setOnClickListener(this);
                    row.setPadding((int) (16 * density), 0, 0, 0);
                    sendersList.addView(row);
                }
            }
        }
    }
    if (sendersList.getChildCount() == 0) {
        TextView noTokens = new TextView(getActivity());
        noTokens.setText(getString(R.string.topics_no_topic_subscribed));
        noTokens.setTypeface(null, Typeface.ITALIC);
        sendersList.addView(noTokens);
    }
    FrameLayout topicsView = (FrameLayout) getActivity().findViewById(R.id.topics_list_wrapper);
    topicsView.removeAllViews();
    topicsView.addView(sendersList);
}
 
開發者ID:google,項目名稱:gcm,代碼行數:56,代碼來源:TopicsFragment.java

示例8: refresh

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
@Override
public void refresh() {
    float density = getActivity().getResources().getDisplayMetrics().density;
    SimpleArrayMap<String, Sender> senders = mSenders.getSenders();
    LinearLayout sendersList = new LinearLayout(getActivity());
    sendersList.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < senders.size(); i++) {
        Sender sender = senders.valueAt(i);
        if (sender.groups.size() > 0) {
            LinearLayout senderRow = (LinearLayout) getActivity().getLayoutInflater()
                    .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
            ImageView senderIcon = (ImageView) senderRow.findViewById(R.id.widget_itbr_icon);
            TextView senderText = (TextView) senderRow.findViewById(R.id.widget_itbr_text);
            senderRow.findViewById(R.id.widget_itbr_button).setVisibility(View.GONE);
            senderIcon.setImageResource(R.drawable.cloud_googblue);
            senderIcon.setPadding(0, 0, (int) (8 * density), 0);
            senderText.setText(getString(R.string.groups_sender_id, sender.senderId));
            sendersList.addView(senderRow);
            for (DeviceGroup deviceGroup : sender.groups.values()) {
                LinearLayout row = (LinearLayout) getActivity().getLayoutInflater()
                        .inflate(R.layout.widget_icon_text_button_row, sendersList, false);
                ImageView icon = (ImageView) row.findViewById(R.id.widget_itbr_icon);
                TextView label = (TextView) row.findViewById(R.id.widget_itbr_text);
                Button button = (Button) row.findViewById(R.id.widget_itbr_button);
                icon.setImageResource(R.drawable.group_grey600);
                label.setText(deviceGroup.notificationKeyName);
                label.setBackgroundResource(selectableBackgroundResource);
                label.setTag(R.id.tag_action, ACTION_OPEN_GROUP);
                label.setTag(R.id.tag_senderid, sender.senderId);
                label.setTag(R.id.tag_group, deviceGroup.notificationKeyName);
                label.setOnClickListener(this);

                button.setText(R.string.groups_delete);
                button.setTag(R.id.tag_action, ACTION_DELETE_GROUP);
                button.setTag(R.id.tag_senderid, sender.senderId);
                button.setTag(R.id.tag_group, deviceGroup.notificationKeyName);
                button.setOnClickListener(this);
                row.setPadding((int) (16 * density), 0, 0, 0);
                sendersList.addView(row);
            }
        }
    }
    if (sendersList.getChildCount() == 0) {
        TextView noTokens = new TextView(getActivity());
        noTokens.setText(getString(R.string.groups_no_groups_available));
        noTokens.setTypeface(null, Typeface.ITALIC);
        sendersList.addView(noTokens);
    }
    FrameLayout topicsView = (FrameLayout) getActivity().findViewById(R.id.groups_list_wrapper);
    topicsView.removeAllViews();
    topicsView.addView(sendersList);
}
 
開發者ID:google,項目名稱:gcm,代碼行數:53,代碼來源:GroupsFragment.java

示例9: isEqualTo

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
@Override
public boolean isEqualTo(final SimpleArrayMap<?, ?> array) {

    int count = 0;

    for (final SimpleArrayMapEntry<K, 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());
}
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:27,代碼來源:SimpleArrayMapIterableImpl.java

示例10: SimpleArrayMapReverseIterator

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
public SimpleArrayMapReverseIterator(final SimpleArrayMap<K, V> arrayMap) {

        super(arrayMap.size());

        mArrayMap = arrayMap;
    }
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:7,代碼來源:SimpleArrayMapReverseIterator.java

示例11: SimpleArrayMapIterator

import android.support.v4.util.SimpleArrayMap; //導入方法依賴的package包/類
public SimpleArrayMapIterator(final SimpleArrayMap<K, V> arrayMap) {

        super(arrayMap.size());

        mArrayMap = arrayMap;
    }
 
開發者ID:davide-maestroni,項目名稱:robo-fashion,代碼行數:7,代碼來源:SimpleArrayMapIterator.java


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