本文整理匯總了Java中android.support.v4.util.ArrayMap.size方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayMap.size方法的具體用法?Java ArrayMap.size怎麽用?Java ArrayMap.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.util.ArrayMap
的用法示例。
在下文中一共展示了ArrayMap.size方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findSiblingStyleByPosition
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
public GridRangeStyle findSiblingStyleByPosition(int position) {
GridRangeStyle rangeStyle = null;
if (mParent != null) {
ArrayMap<Range<Integer>, GridRangeStyle> siblings = mParent.mChildren;
for (int i = 0, size = siblings.size(); i < size; i++) {
Range range = siblings.keyAt(i);
if (range.contains(position)) {
GridRangeStyle childRangeStyle = siblings.valueAt(i);
if (!childRangeStyle.equals(this)) {
rangeStyle = childRangeStyle;
}
break;
}
}
}
return rangeStyle;
}
示例2: populateList
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
/**
* populateList adds to documents list a new document
* @param attributes Specifications of the new document
* @param bookmarks New document's bookmarks
*/
private void populateList(ArrayMap<String, Object> attributes, ArrayMap<Integer, String> bookmarks){
// Get extension
String ext = "";
for(int e = attributes.get("uri").toString().length()-1; e>0 && attributes.get("uri").toString().charAt(e) != '.'; --e){
ext = attributes.get("uri").toString().charAt(e) + ext;
}
switch(ext){
case "txt":
documents.add(new TXTDocument(attributes.get("title").toString(), attributes.get("author").toString(), (Date) attributes.get("importDate"),
Integer.valueOf(attributes.get("lastReadPosition").toString()), attributes.get("uri").toString()));
break;
case "epub":
documents.add(new EPubDocument(attributes.get("title").toString(), attributes.get("author").toString(), (Date) attributes.get("importDate"),
Integer.valueOf(attributes.get("lastReadPosition").toString()), attributes.get("uri").toString()));
break;
case "html":
documents.add(new HtmlDocument(attributes.get("title").toString(), attributes.get("author").toString(), (Date) attributes.get("importDate"),
Integer.valueOf(attributes.get("lastReadPosition").toString()), attributes.get("uri").toString()));
default:
// TODO: not supported extension
}
// Add Bookmarks
for(int j=0; j < bookmarks.size(); ++j){
documents.get(documents.size()-1).addBookmark(bookmarks.valueAt(j), bookmarks.keyAt(j));
}
}
示例3: setNameOverride
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
private static void setNameOverride(ArrayMap<String, String> overrides, String source, String target) {
if (source != null && target != null) {
for (int index = 0; index < overrides.size(); index++) {
if (source.equals(overrides.valueAt(index))) {
overrides.setValueAt(index, target);
return;
}
}
overrides.put(source, target);
}
}
示例4: setNameOverrides
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
private void setNameOverrides(TransitionState state, ArrayMap<String, View> namedViews, boolean isEnd) {
int count = namedViews.size();
for (int i = 0; i < count; i++) {
String source = (String) namedViews.keyAt(i);
String target = FragmentTransitionCompat21.getTransitionName((View) namedViews.valueAt(i));
if (isEnd) {
setNameOverride(state.nameOverrides, source, target);
} else {
setNameOverride(state.nameOverrides, target, source);
}
}
}
示例5: composeNavigationUri
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
public static Uri composeNavigationUri(String schemeString, String host, String path, ArrayMap<String, String> extras)
{
StringBuilder builder = new StringBuilder(schemeString).append("://").append(host);
if(!TextUtils.isEmpty(path))
{
builder.append("/").append(path);
}
if(extras != null && extras.size() > 0)
{
builder.append("?");
for(Entry<String, String> entry : extras.entrySet())
{
if(entry == null) continue;
builder.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
}
String result = builder.toString();
if(result.endsWith("?") || result.endsWith("&"))
{
result = result.substring(0, result.length() - 1);
}
return Uri.parse(result);
}
示例6: onResult
import android.support.v4.util.ArrayMap; //導入方法依賴的package包/類
@Override
public void onResult(Object result) {
Log.d("k9res", "onResult: " + result.toString());
if (result.toString().equalsIgnoreCase("swiped_down")) {
//do something or nothing
} else {
if (result != null) {
ArrayMap<String, List<String>> applied_filters = (ArrayMap<String, List<String>>) result;
if (applied_filters.size() != 0) {
List<SingleMovie> filteredList = mData.getAllMovies();
//iterate over arraymap
for (Map.Entry<String, List<String>> entry : applied_filters.entrySet()) {
Log.d("k9res", "entry.key: " + entry.getKey());
switch (entry.getKey()) {
case "genre":
filteredList = mData.getGenreFilteredMovies(entry.getValue(), filteredList);
break;
case "rating":
filteredList = mData.getRatingFilteredMovies(entry.getValue(), filteredList);
break;
case "year":
filteredList = mData.getYearFilteredMovies(entry.getValue(), filteredList);
break;
case "quality":
filteredList = mData.getQualityFilteredMovies(entry.getValue(), filteredList);
break;
}
}
Log.d("k9res", "new size: " + filteredList.size());
mList.clear();
mList.addAll(filteredList);
mAdapter.notifyDataSetChanged();
} else {
mList.addAll(mData.getAllMovies());
mAdapter.notifyDataSetChanged();
}
}
//handle result
}
}