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


Java WrapperListAdapter类代码示例

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


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

示例1: setAdapterInternal

import android.widget.WrapperListAdapter; //导入依赖的package包/类
/**
 * @throws java.lang.IllegalStateException    if the adapter does not have stable ids.
 * @throws java.lang.IllegalArgumentException if the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.
 */
private void setAdapterInternal(@NonNull final ListAdapter adapter) {
    ListAdapter actualAdapter = adapter;
    if (actualAdapter instanceof WrapperListAdapter) {
        actualAdapter = ((WrapperListAdapter) actualAdapter).getWrappedAdapter();
    }

    if (!actualAdapter.hasStableIds()) {
        throw new IllegalStateException("Adapter doesn't have stable ids! Make sure your adapter has stable ids, and override hasStableIds() to return true.");
    }

    if (!(actualAdapter instanceof Swappable)) {
        throw new IllegalArgumentException("Adapter should implement Swappable!");
    }

    mAdapter = actualAdapter;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:21,代码来源:DragAndDropHandler.java

示例2: setAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setAdapter(final ListAdapter adapter) {
    ListAdapter innerAdapter = adapter;

    if (innerAdapter instanceof WrapperListAdapter) {
        WrapperListAdapter wrapperAdapter = (WrapperListAdapter) innerAdapter;
        innerAdapter = wrapperAdapter.getWrappedAdapter();

        if (!(innerAdapter instanceof AsymmetricGridViewAdapterContract))
            throw new UnsupportedOperationException("Wrapped adapter must implement AsymmetricGridViewAdapterContract");
    } else {
        if (!(innerAdapter instanceof AsymmetricGridViewAdapterContract))
            throw new UnsupportedOperationException("Adapter must implement AsymmetricGridViewAdapterContract");
    }

    gridAdapter = (AsymmetricGridViewAdapterContract) innerAdapter;
    super.setAdapter(innerAdapter);
    gridAdapter.recalculateItemsPerRow();
}
 
开发者ID:dyhpoon,项目名称:Fo.dex,代码行数:21,代码来源:AsymmetricGridView.java

示例3: onItemClick

import android.widget.WrapperListAdapter; //导入依赖的package包/类
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

			/* Get the HighScoreListAdapter back from parent view.
			 * The Adapter is wrapped, so we need to cast it back.
			 * Use the id to get the corresponding data base entry from the
			 * adapter. */
			DSDBGameEntry entry = (DSDBGameEntry) ((HighScoreListAdapter) ((WrapperListAdapter) ((ListView) parent)
					.getAdapter()).getWrappedAdapter()).getItem((int) id);

			Intent intent = getIntent();
			// TODO: Use a constant!
			intent.putExtra("GAMEID", entry.GAMEID);

			setResult(INTENTRESULT_PLAY_REPLAY, intent);

			finish();
		}
 
开发者ID:mNisblee,项目名称:DroidSweeper,代码行数:18,代码来源:HighScoreActivity.java

示例4: listViewHeaderAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
@Test
@UiThreadTest
public void listViewHeaderAdapter() {
    List<String> items = Arrays.asList("one", "two", "three");
    TestHelpers.ViewModel viewModel = new TestHelpers.ViewModel.Builder(items, ItemBinding.<String>of(me.tatarka.bindingcollectionadapter2.BR.item, R.layout.item)).build();
    ViewDataBinding binding = DataBindingUtil.inflate(inflater, R.layout.list_view, null, false);
    binding.setVariable(me.tatarka.bindingcollectionadapter2.BR.viewModel, viewModel);
    binding.executePendingBindings();
    // addHeaderView must be called after the adapter is set.
    ((ListView) binding.getRoot()).addHeaderView(new View(binding.getRoot().getContext()));
    // Trigger rebind to exercise the case when the adapter it wrapped in a HeaderListViewAdapter
    binding.setVariable(me.tatarka.bindingcollectionadapter2.BR.viewModel, viewModel);
    binding.executePendingBindings();

    ListView listView = (ListView) binding.getRoot();
    @SuppressWarnings("unchecked")
    BindingListViewAdapter<String> adapter = (BindingListViewAdapter<String>) ((WrapperListAdapter) listView.getAdapter()).getWrappedAdapter();

    assertThat(TestHelpers.iterable(adapter)).containsExactlyElementsOf(items);
}
 
开发者ID:evant,项目名称:binding-collection-adapter,代码行数:21,代码来源:ListViewInflationTest.java

示例5: onPostExecute

import android.widget.WrapperListAdapter; //导入依赖的package包/类
@Override
protected
void onPostExecute(String[][] result)
{
    // Set the titles & counts arrays in this file and notify the adapter.
    ListView navigationList = (ListView) m_activity.findViewById(R.id.fragment_navigation_drawer);
    WrapperListAdapter wrapperAdapter = (WrapperListAdapter) navigationList.getAdapter();
    ArrayAdapter<String[]> adapter = (ArrayAdapter<String[]>) wrapperAdapter.getWrappedAdapter();

    // Update the data in the adapter.
    adapter.clear();
    adapter.addAll(result);

    // Update the subtitle.
    if(Constants.s_fragmentFeeds.isVisible())
    {
        Utilities.setTitlesAndDrawerAndPage(null, -10);
    }
}
 
开发者ID:DarkangelKid,项目名称:rss,代码行数:20,代码来源:AsyncNavigationAdapter.java

示例6: onScrollStateChanged

import android.widget.WrapperListAdapter; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if (AppConfig.INSTANCE.getBoolean(view.getContext(), AppConfig.Key.SCROLLING_PAUSE_LOAD) && view.getAdapter() != null) {
        ListAdapter listAdapter = view.getAdapter();
        if (listAdapter instanceof WrapperListAdapter) {
            listAdapter = ((WrapperListAdapter) listAdapter).getWrappedAdapter();
        }
        if (listAdapter instanceof BaseAdapter) {
            if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
                if (!sketch.getConfiguration().isPauseLoadEnabled()) {
                    sketch.getConfiguration().setPauseLoadEnabled(true);
                }
            } else if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
                if (sketch.getConfiguration().isPauseLoadEnabled()) {
                    sketch.getConfiguration().setPauseLoadEnabled(false);
                    ((BaseAdapter) listAdapter).notifyDataSetChanged();
                }
            }
        }
    }

    if (absListScrollListener != null) {
        absListScrollListener.onScrollStateChanged(view, scrollState);
    }
}
 
开发者ID:panpf,项目名称:sketch,代码行数:26,代码来源:ScrollingPauseLoadManager.java

示例7: saveAdapterState

import android.widget.WrapperListAdapter; //导入依赖的package包/类
/**
 * Saves the current state of the specified <var>adapter</var>.
 *
 * @param adapter The adapter of which state to save. Should be instance of {@link StatefulAdapter}
 *                or one of wrapper adapter ({@link android.widget.WrapperListAdapter}) implementations.
 * @return Adapter's saved state or {@code null} or empty state if the adapter does not save its
 * state or it is not a stateful adapter.
 */
private Parcelable saveAdapterState(Adapter adapter) {
	if (adapter instanceof StatefulAdapter) {
		return ((StatefulAdapter) adapter).saveInstanceState();
	} else if (adapter instanceof WrapperListAdapter) {
		return saveAdapterState(((WrapperListAdapter) adapter).getWrappedAdapter());
	}
	return null;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:17,代码来源:ListViewWidget.java

示例8: restoreAdapterState

import android.widget.WrapperListAdapter; //导入依赖的package包/类
/**
 * Restores the saved state of the specified <var>adapter</var>.
 *
 * @param adapter      The adapter of which state to restore. Should be instance of {@link StatefulAdapter}
 *                     or one of wrapper adapter ({@link android.widget.WrapperListAdapter}) implementations.
 * @param adapterState The previously saved adapter state via {@link #saveAdapterState(Adapter)}.
 */
private void restoreAdapterState(Adapter adapter, Parcelable adapterState) {
	if (adapter instanceof StatefulAdapter) {
		((StatefulAdapter) adapter).restoreInstanceState(adapterState);
	} else if (adapter instanceof WrapperListAdapter) {
		restoreAdapterState(((WrapperListAdapter) adapter).getWrappedAdapter(), adapterState);
	}
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:15,代码来源:ListViewWidget.java

示例9: type

import android.widget.WrapperListAdapter; //导入依赖的package包/类
public static SubjectFactory<WrapperListAdapterSubject, WrapperListAdapter> type() {
  return new SubjectFactory<WrapperListAdapterSubject, WrapperListAdapter>() {
    @Override
    public WrapperListAdapterSubject getSubject(FailureStrategy fs, WrapperListAdapter that) {
      return new WrapperListAdapterSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:WrapperListAdapterSubject.java

示例10: getPinnedAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
private PinnedSectionGridAdapter getPinnedAdapter() {
    PinnedSectionGridAdapter adapter;
    if (getAdapter() instanceof WrapperListAdapter)
        adapter= (PinnedSectionGridAdapter) ((WrapperListAdapter)getAdapter()).getWrappedAdapter();
    else adapter = (PinnedSectionGridAdapter) getAdapter();
    return adapter;
}
 
开发者ID:LeshiyGS,项目名称:shikimori,代码行数:8,代码来源:PinnedSectionGridView.java

示例11: getPinnedAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
private PinnedSectionListAdapter getPinnedAdapter() {
    PinnedSectionListAdapter adapter;
    if (getAdapter() instanceof WrapperListAdapter)
        adapter= (PinnedSectionListAdapter) ((WrapperListAdapter)getAdapter()).getWrappedAdapter();
    else adapter = (PinnedSectionListAdapter) getAdapter();
    return adapter;
}
 
开发者ID:LeshiyGS,项目名称:shikimori,代码行数:8,代码来源:PinnedSectionListView.java

示例12: setAdapterProxy

import android.widget.WrapperListAdapter; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void setAdapterProxy(final AdapterView adapterView) {
    Adapter adapter = adapterView.getAdapter();
    if (adapter == null || Proxy.isProxyClass(adapter.getClass())) {
        // Thou shalt not Proxy a Proxy!
        return;
    }
    if (adapterView instanceof ExpandableListView) {
        // FIXME - Right now, skip the support for ExpandableListView.
        // This class throws exceptions on setAdapter(Adapter), and requires
        // a special adapter that only works with it.... Lame API break!
        return;
    }
    // Collect the Adapter sub-interfaces that we
    // would like to proxy.
    List<Class<?>> interfaces = new ArrayList<Class<?>>(4);
    interfaces.add(Adapter.class);
    if (adapter instanceof ListAdapter) {
        interfaces.add(ListAdapter.class);
    }
    if (adapter instanceof WrapperListAdapter) {
        interfaces.add(WrapperListAdapter.class);
    }
    if (adapter instanceof SpinnerAdapter) {
        interfaces.add(SpinnerAdapter.class);
    }

    // Create a proxy for the adapter to intercept
    // the 'getView'
    Adapter newAdapter = (Adapter) PXAdapterInvocationHandler.newInstance(adapterView,
            interfaces.toArray(new Class<?>[interfaces.size()]));

    // Set the proxy as the adapter
    adapterView.setAdapter(newAdapter);
}
 
开发者ID:Pixate,项目名称:pixate-freestyle-android,代码行数:36,代码来源:PXHierarchyListener.java

示例13: getAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
ListAdapter getAdapter() {
    final ListAdapter adapter = mAbsListView.getAdapter();
    if (adapter instanceof WrapperListAdapter) {
        WrapperListAdapter wrapperAdapter = (WrapperListAdapter) adapter;
        return wrapperAdapter.getWrappedAdapter();
    }

    return adapter;
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:10,代码来源:ItemManaged.java

示例14: getAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
private QuickReturnAdapter getAdapter() {
  ListAdapter adapter = listView.getAdapter();

  if (adapter instanceof WrapperListAdapter) {
    adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
  }

  if (!(adapter instanceof QuickReturnAdapter)) {
    throw new UnsupportedOperationException(
        "Your QuickReturn ListView adapter must be an instance of QuickReturnAdapter.");
  }

  return (QuickReturnAdapter) adapter;
}
 
开发者ID:felipecsl,项目名称:QuickReturn,代码行数:15,代码来源:AbsListViewScrollTarget.java

示例15: getBaseAdapter

import android.widget.WrapperListAdapter; //导入依赖的package包/类
public BaseAdapter getBaseAdapter() {
    Adapter adapter = getAdapter();
    if (adapter != null) {
        if (adapter instanceof WrapperListAdapter) {
            adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
        }

        if (adapter instanceof BaseAdapter) {
            return (BaseAdapter) adapter;
        }
    }
    return null;
}
 
开发者ID:mikepenz,项目名称:AnimatedGridView,代码行数:14,代码来源:AnimatedHeaderGridView.java


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