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);
}
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);
}
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));
}
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;
}
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();
}
Aggregations