Search in sources :

Example 11 with BaseAdapter

use of android.widget.BaseAdapter in project bee by orhanobut.

the class UiHandler method initSettingsContent.

void initSettingsContent(List<MethodInfo> list) {
    BaseAdapter adapter = SettingsAdapter.newInstance(context, list);
    listView.setAdapter(adapter);
}
Also used : BaseAdapter(android.widget.BaseAdapter)

Example 12 with BaseAdapter

use of android.widget.BaseAdapter in project android-flip by openaphid.

the class FlipTextViewActivity method onCreate.

/**
   * Called when the activity is first created.
   */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.activity_title);
    flipView = new FlipViewController(this);
    flipView.setAdapter(new BaseAdapter() {

        @Override
        public int getCount() {
            return 10;
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            NumberTextView view;
            if (convertView == null) {
                final Context context = parent.getContext();
                view = new NumberTextView(context, position);
                view.setTextSize(context.getResources().getDimension(R.dimen.textSize));
            } else {
                view = (NumberTextView) convertView;
                view.setNumber(position);
            }
            return view;
        }
    });
    setContentView(flipView);
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) FlipViewController(com.aphidmobile.flip.FlipViewController) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) BaseAdapter(android.widget.BaseAdapter) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) View(android.view.View)

Example 13 with BaseAdapter

use of android.widget.BaseAdapter in project android-flip by openaphid.

the class FlipTextViewXmlActivity method onCreate.

/**
   * Called when the activity is first created.
   */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.activity_title);
    setContentView(R.layout.xml_layout);
    flipView = (FlipViewController) findViewById(R.id.flipView);
    flipView.setAdapter(new BaseAdapter() {

        @Override
        public int getCount() {
            return 10;
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            NumberTextView view;
            if (convertView == null) {
                final Context context = parent.getContext();
                view = new NumberTextView(context, position);
                view.setTextSize(context.getResources().getDimension(R.dimen.textSize));
            } else {
                view = (NumberTextView) convertView;
                view.setNumber(position);
            }
            return view;
        }
    });
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) BaseAdapter(android.widget.BaseAdapter) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) View(android.view.View)

Example 14 with BaseAdapter

use of android.widget.BaseAdapter in project android-vertical-slide-view by xmuSistone.

the class VerticalFragment2 method initView.

/**
	 * 初始化ListView
	 * 
	 * @param rootView
	 *            根View
	 */
private void initView(View rootView) {
    ListView listview = (ListView) rootView.findViewById(R.id.fragment2_listview);
    ListAdapter adapter = new BaseAdapter() {

        private LayoutInflater inflater;

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (inflater == null) {
                inflater = LayoutInflater.from(getActivity());
            }
            if (null == convertView) {
                convertView = inflater.inflate(R.layout.fragment2_list_item, null);
            }
            return convertView;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public int getCount() {
            return 100;
        }
    };
    listview.setAdapter(adapter);
}
Also used : ListView(android.widget.ListView) ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) BaseAdapter(android.widget.BaseAdapter) View(android.view.View) ListView(android.widget.ListView) ListAdapter(android.widget.ListAdapter)

Example 15 with BaseAdapter

use of android.widget.BaseAdapter in project android_frameworks_base by ResurrectionRemix.

the class AppWidgetHostView method viewDataChanged.

/**
     * Process data-changed notifications for the specified view in the specified
     * set of {@link RemoteViews} views.
     */
void viewDataChanged(int viewId) {
    View v = findViewById(viewId);
    if ((v != null) && (v instanceof AdapterView<?>)) {
        AdapterView<?> adapterView = (AdapterView<?>) v;
        Adapter adapter = adapterView.getAdapter();
        if (adapter instanceof BaseAdapter) {
            BaseAdapter baseAdapter = (BaseAdapter) adapter;
            baseAdapter.notifyDataSetChanged();
        } else if (adapter == null && adapterView instanceof RemoteAdapterConnectionCallback) {
            // If the adapter is null, it may mean that the RemoteViewsAapter has not yet
            // connected to its associated service, and hence the adapter hasn't been set.
            // In this case, we need to defer the notify call until it has been set.
            ((RemoteAdapterConnectionCallback) adapterView).deferNotifyDataSetChanged();
        }
    }
}
Also used : RemoteAdapterConnectionCallback(android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback) AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter)

Aggregations

BaseAdapter (android.widget.BaseAdapter)43 View (android.view.View)22 AdapterView (android.widget.AdapterView)21 ViewGroup (android.view.ViewGroup)16 Adapter (android.widget.Adapter)15 TextView (android.widget.TextView)15 ListAdapter (android.widget.ListAdapter)8 ListView (android.widget.ListView)7 RemoteAdapterConnectionCallback (android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback)7 LayoutInflater (android.view.LayoutInflater)5 Context (android.content.Context)4 AbsListView (android.widget.AbsListView)4 RecipeInformation (com.se491.chef_ly.model.RecipeInformation)4 SuppressLint (android.annotation.SuppressLint)3 Intent (android.content.Intent)3 GridView (android.widget.GridView)3 HeaderViewListAdapter (android.widget.HeaderViewListAdapter)3 ImageView (android.widget.ImageView)3 FlipViewController (com.aphidmobile.flip.FlipViewController)3 NumberTextView (com.aphidmobile.flip.demo.views.NumberTextView)3