Search in sources :

Example 41 with ListView

use of android.widget.ListView in project android-sms-relay by nyaruka.

the class MessageListFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedState) {
    super.onActivityCreated(savedState);
    //View view = super.onCreateView(inflater, container, savedInstanceState);
    List<TextMessage> msgs = AndroidRelay.getHelper(getActivity()).getAllMessages();
    m_adapter = new TextMessageAdapter(getActivity(), R.layout.message, msgs);
    setListAdapter(m_adapter);
    ListView lv = getListView();
    lv.setBackgroundColor(Color.WHITE);
    lv.setCacheColorHint(Color.WHITE);
}
Also used : ListView(android.widget.ListView) TextMessage(com.nyaruka.androidrelay.data.TextMessage)

Example 42 with ListView

use of android.widget.ListView in project platform_frameworks_base by android.

the class ListViewTest method testNoSelectableItems.

/**
     * The list view should handle the disappearance of the only selected item, even when that item
     * was selected before its disappearance.
     *
     */
@MediumTest
public void testNoSelectableItems() throws Exception {
    MockContext context = new MockContext2();
    ListView listView = new ListView(context);
    // We use a header as the unselectable item to remain after the selectable one is removed.
    listView.addHeaderView(new View(context), null, false);
    List<String> items = Lists.newArrayList("hello");
    Adapter<String> adapter = new Adapter<String>(context, 0, items);
    listView.setAdapter(adapter);
    listView.setSelection(1);
    int measureSpec = View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY);
    adapter.notifyDataSetChanged();
    listView.measure(measureSpec, measureSpec);
    listView.layout(0, 0, 100, 100);
    items.remove(0);
    adapter.notifyDataSetChanged();
    listView.measure(measureSpec, measureSpec);
    listView.layout(0, 0, 100, 100);
}
Also used : MockContext(android.test.mock.MockContext) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter) View(android.view.View) ListView(android.widget.ListView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 43 with ListView

use of android.widget.ListView in project platform_frameworks_base by android.

the class EffectsTest method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.effectstest);
    Button button = (Button) findViewById(R.id.env_reverb_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, EnvReverbTest.class));
        }
    });
    button = (Button) findViewById(R.id.preset_reverb_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, PresetReverbTest.class));
        }
    });
    button = (Button) findViewById(R.id.equalizer_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, EqualizerTest.class));
        }
    });
    button = (Button) findViewById(R.id.virtualizer_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, VirtualizerTest.class));
        }
    });
    button = (Button) findViewById(R.id.bassboost_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, BassBoostTest.class));
        }
    });
    button = (Button) findViewById(R.id.visualizer_actvity);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            startActivity(new Intent(EffectsTest.this, VisualizerTest.class));
        }
    });
    AudioEffect.Descriptor[] descriptors = AudioEffect.queryEffects();
    ListView list = (ListView) findViewById(R.id.effect_list);
    list.setAdapter(new EffectListAdapter(this, descriptors));
}
Also used : ListView(android.widget.ListView) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 44 with ListView

use of android.widget.ListView in project platform_frameworks_base by android.

the class RootsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_roots, container, false);
    mList = (ListView) view.findViewById(R.id.roots_list);
    mList.setOnItemClickListener(mItemListener);
    mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    return view;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 45 with ListView

use of android.widget.ListView in project PocketHub by pockethub.

the class RefDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    Activity activity = getActivity();
    Bundle arguments = getArguments();
    final MaterialDialog.Builder dialogBuilder = createDialogBuilder().negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {

        @Override
        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            RefDialogFragment.this.onClick(dialog, BUTTON_NEGATIVE);
        }
    });
    LayoutInflater inflater = activity.getLayoutInflater();
    ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null);
    view.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onClick(getDialog(), position);
        }
    });
    ArrayList<GitReference> choices = getChoices();
    int selected = arguments.getInt(ARG_SELECTED_CHOICE);
    RefListAdapter adapter = new RefListAdapter(inflater, choices.toArray(new GitReference[choices.size()]), selected);
    view.setAdapter(adapter);
    if (selected >= 0) {
        view.setSelection(selected);
    }
    dialogBuilder.customView(view, false);
    return dialogBuilder.build();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) BaseActivity(com.github.pockethub.android.ui.BaseActivity) Activity(android.app.Activity) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) DialogAction(com.afollestad.materialdialogs.DialogAction) LayoutInflater(android.view.LayoutInflater) GitReference(com.meisolsson.githubsdk.model.git.GitReference)

Aggregations

ListView (android.widget.ListView)1139 View (android.view.View)739 AdapterView (android.widget.AdapterView)444 TextView (android.widget.TextView)389 ImageView (android.widget.ImageView)167 Intent (android.content.Intent)148 AbsListView (android.widget.AbsListView)135 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)97 ArrayAdapter (android.widget.ArrayAdapter)97 ArrayList (java.util.ArrayList)81 ViewGroup (android.view.ViewGroup)75 ListAdapter (android.widget.ListAdapter)71 OnClickListener (android.view.View.OnClickListener)65 LayoutInflater (android.view.LayoutInflater)63 Bundle (android.os.Bundle)57 Button (android.widget.Button)55 LinearLayout (android.widget.LinearLayout)50 SuppressLint (android.annotation.SuppressLint)34 DialogInterface (android.content.DialogInterface)34 ScrollView (android.widget.ScrollView)31