Search in sources :

Example 56 with ListView

use of android.widget.ListView in project picasso by square.

the class SampleContactsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sample_contacts_activity);
    adapter = new SampleContactsAdapter(this);
    ListView lv = (ListView) findViewById(android.R.id.list);
    lv.setAdapter(adapter);
    lv.setOnScrollListener(new SampleScrollListener(this));
    getSupportLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, this);
}
Also used : ListView(android.widget.ListView)

Example 57 with ListView

use of android.widget.ListView in project JieCaoVideoPlayer by lipangit.

the class ListViewViewpagerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listview_viewpager);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setDisplayUseLogoEnabled(false);
    getSupportActionBar().setTitle("ViewPagerAndListView");
    List<View> listViews = new ArrayList<>();
    ListView listView1 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
    ListView listView2 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
    ListView listView3 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
    listView1.setAdapter(new VideoListAdapter(this, 0));
    listView2.setAdapter(new VideoListAdapter(this, 1));
    listView3.setAdapter(new VideoListAdapter(this, 2));
    listViews.add(listView1);
    listViews.add(listView2);
    listViews.add(listView3);
    MyAdapter myAdapter = new MyAdapter(listViews);
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
    viewPager.setAdapter(myAdapter);
    viewPager.setOnPageChangeListener(this);
}
Also used : ListView(android.widget.ListView) ArrayList(java.util.ArrayList) View(android.view.View) ListView(android.widget.ListView) ViewPager(android.support.v4.view.ViewPager)

Example 58 with ListView

use of android.widget.ListView in project QuickReturn by lawloretienne.

the class QuickReturnUtils method getScrollY.

public static int getScrollY(ListView lv) {
    View c = lv.getChildAt(0);
    if (c == null) {
        return 0;
    }
    int firstVisiblePosition = lv.getFirstVisiblePosition();
    int top = c.getTop();
    int scrollY = -top + firstVisiblePosition * c.getHeight();
    return scrollY;
}
Also used : AbsListView(android.widget.AbsListView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) ListView(android.widget.ListView)

Example 59 with ListView

use of android.widget.ListView in project LiveSDK-for-Android by liveservices.

the class ContactsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_contacts);
    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Contact contact = (Contact) parent.getItemAtPosition(position);
            ViewContactDialog dialog = new ViewContactDialog(ContactsActivity.this, contact);
            dialog.setOwnerActivity(ContactsActivity.this);
            dialog.show();
        }
    });
    LinearLayout layout = new LinearLayout(this);
    Button newCalendarButton = new Button(this);
    newCalendarButton.setText("New Contact");
    newCalendarButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            CreateContactDialog dialog = new CreateContactDialog(ContactsActivity.this);
            dialog.setOwnerActivity(ContactsActivity.this);
            dialog.show();
        }
    });
    layout.addView(newCalendarButton);
    lv.addHeaderView(layout);
    mAdapter = new ContactsListAdapter(this);
    setListAdapter(mAdapter);
    LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
    mClient = app.getConnectClient();
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) LinearLayout(android.widget.LinearLayout)

Example 60 with ListView

use of android.widget.ListView in project LiveSDK-for-Android by liveservices.

the class SkyDriveActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.skydrive);
    mPrevFolderIds = new Stack<String>();
    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SkyDriveObject skyDriveObj = (SkyDriveObject) parent.getItemAtPosition(position);
            skyDriveObj.accept(new Visitor() {

                @Override
                public void visit(SkyDriveAlbum album) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(album.getId());
                }

                @Override
                public void visit(SkyDrivePhoto photo) {
                    ViewPhotoDialog dialog = new ViewPhotoDialog(SkyDriveActivity.this, photo);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveFolder folder) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(folder.getId());
                }

                @Override
                public void visit(SkyDriveFile file) {
                    Bundle b = new Bundle();
                    b.putString(JsonKeys.ID, file.getId());
                    b.putString(JsonKeys.NAME, file.getName());
                    showDialog(DIALOG_DOWNLOAD_ID, b);
                }

                @Override
                public void visit(SkyDriveVideo video) {
                    PlayVideoDialog dialog = new PlayVideoDialog(SkyDriveActivity.this, video);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveAudio audio) {
                    PlayAudioDialog audioDialog = new PlayAudioDialog(SkyDriveActivity.this, audio);
                    audioDialog.show();
                }
            });
        }
    });
    LinearLayout layout = new LinearLayout(this);
    Button newFolderButton = new Button(this);
    newFolderButton.setText("New Folder");
    newFolderButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            NewFolderDialog dialog = new NewFolderDialog(SkyDriveActivity.this);
            dialog.setOwnerActivity(SkyDriveActivity.this);
            dialog.show();
        }
    });
    layout.addView(newFolderButton);
    Button uploadFileButton = new Button(this);
    uploadFileButton.setText("Upload File");
    uploadFileButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), FilePicker.class);
            startActivityForResult(intent, FilePicker.PICK_FILE_REQUEST);
        }
    });
    layout.addView(uploadFileButton);
    lv.addHeaderView(layout);
    mPhotoAdapter = new SkyDriveListAdapter(this);
    setListAdapter(mPhotoAdapter);
    LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
    mClient = app.getConnectClient();
}
Also used : Visitor(com.microsoft.live.sample.skydrive.SkyDriveObject.Visitor) ListView(android.widget.ListView) Button(android.widget.Button) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView) OnClickListener(android.view.View.OnClickListener) LinearLayout(android.widget.LinearLayout) FilePicker(com.microsoft.live.sample.util.FilePicker)

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