Android Open Source - android-training-tutorial Youtube Activity






From Project

Back to project page android-training-tutorial.

License

The source code is released under:

MIT License

If you think the Android project android-training-tutorial listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.flavienlaurent.vdh;
//from   w w w.  j a v  a 2 s . co  m
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.flavienlaurent.vdh.YoutubeLayout.YoutubeLayoutListener;

/**
 * Created by Flavien Laurent (flavienlaurent.com) on 23/08/13.
 */
public class YoutubeActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_youtube);

    // final TextView viewHeader = (TextView) findViewById(R.id.header);
    final YoutubeLayout youtubeLayout = (YoutubeLayout) findViewById(R.id.dragLayout);
    youtubeLayout.setYoutubeLayoutListener(new YoutubeLayoutListener() {

      @Override
      public void onHeadViewClickListener(View view) {
        Toast.makeText(getBaseContext(), "clicked", Toast.LENGTH_SHORT)
            .show();
      }
    });

    final ListView listView = (ListView) findViewById(R.id.listView);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> adapterView, View view,
          int i, long l) {
        // viewHeader.setText(listView.getAdapter().getItem(i).toString());
        youtubeLayout.setVisibility(View.VISIBLE);
        youtubeLayout.maximize();
      }
    });

    listView.setAdapter(new BaseAdapter() {
      @Override
      public int getCount() {
        return 50;
      }

      @Override
      public String getItem(int i) {
        return "object" + i;
      }

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

      @Override
      public View getView(int i, View rView, ViewGroup viewGroup) {
        View view = rView;
        if (view == null) {
          view = getLayoutInflater().inflate(
              android.R.layout.simple_list_item_1, viewGroup,
              false);
        }
        ((TextView) view.findViewById(android.R.id.text1))
            .setText(getItem(i));
        return view;
      }
    });
  }
}




Java Source Code List

com.flavienlaurent.vdh.DragActivity.java
com.flavienlaurent.vdh.DragLayout.java
com.flavienlaurent.vdh.HorizontalDragLayout.java
com.flavienlaurent.vdh.MainActivity.java
com.flavienlaurent.vdh.YoutubeActivity.java
com.flavienlaurent.vdh.YoutubeLayout.java
com.flavienlaurent.vdh.listener.SwipeDismissTouchListener.java
com.hb.views.PinnedSectionListView.java
fi.harism.curl.CurlActivity.java
fi.harism.curl.CurlMesh.java
fi.harism.curl.CurlPage.java
fi.harism.curl.CurlRenderer.java
fi.harism.curl.CurlView.java
im.ene.dev.zbroadcastreceiver2.MainActivity.java
im.ene.dev.zbroadcastreceiver2.receivers.CustomBroadcastReceiver.java
im.ene.dev.zbroadcastreceiver2.services.CustomBroadcastService.java
im.ene.dev.zbroadcastreceiver.MainActivity.java
im.ene.dev.zbroadcastreceiver.SecondActivity.java
im.ene.dev.zbroadcastreceiver.receivers.CustomBroadcastReceiver.java
im.ene.dev.zbroadcastreceiver.services.CustomBroadcastService.java
im.ene.dev.zserviceibinder.MainActivity.java
im.ene.dev.zserviceibinder.services.CustomService.java
im.ene.pinnedheaderlistviewsample.MainActivity.java
im.ene.samplevideoplayer.MainActivity.java
im.ene.samplevideoplayer.constant.Constant.java
im.ene.samplevideoplayer.views.CustomSurfaceView.java
im.ene.samplevideoplayer.views.VideoControllerView.java
im.ene.zaidlservicesample.MainActivity.java
im.ene.zaidlservicesample.Second.java
im.ene.zanimationsample.MainActivity.java
im.ene.zcustomvideoview.MainActivity.java
im.ene.zcustomvideoview.views.CustomVideoView.java
im.ene.zcustomvideoview.views.VideoControllerView.java
im.ene.zintenttutorial.MainActivity.java
im.ene.zintenttutorial.broadcastreceiver.CustomBroadcastReceiver.java
im.ene.zintenttutorial.services.CustomService.java
im.ene.zviewpager.MainActivity.java