@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("本地视频");
    setContentView(R.layout.local_video_main);
    mDbHelper = new DbHelper<VideoInfo>();
    mVideoList = mDbHelper.queryForAll(VideoInfo.class); // 从数据库获取数据记录

    mListView = (SlideListView) findViewById(R.id.my_listview);
    mFileAdapter = new FileAdapter(this);
    mListView.setAdapter(mFileAdapter);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(LoaclVideoActivity.this, SubUnityPlayerActivity.class);
            //                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            //                intent.putExtra("oneshot", 0);
            //                intent.putExtra("configchange", 0);
            //                Uri uri = Uri.fromFile(new File(mVideoList.get(position).path));
            //                intent.setDataAndType(uri, "video/*");
            intent.putExtra("url", "file://" + mVideoList.get(position).path);
            startActivity(intent);
          }
        });

    vandaAlert = VandaAlert.createLoadingDialog(LoaclVideoActivity.this, "正在扫描...");
    vandaAlert.setCanceledOnTouchOutside(false);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mSlideListView = ((SlideListView) findViewById(R.id.list_view));
    mTestData = new ArrayList<String>();
    randomCreateTestData();
    mAdapter = new SlideAdapter(this, mTestData);

    TextView headView1 = new TextView(this);
    headView1.setHeight(60);
    TextView headView2 = new TextView(this);
    headView2.setHeight(60);
    TextView footerView1 = new TextView(this);
    footerView1.setHeight(60);
    headView1.setText("这是HeaderView1");
    headView2.setText("这是HeaderView2");
    footerView1.setText("这是FooterView1");
    mSlideListView.addHeaderView(headView1);
    mSlideListView.addHeaderView(headView2);
    mSlideListView.addFooterView(footerView1);

    mSlideListView.setAdapter(mAdapter);

    mSlideListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String s = (String) parent.getAdapter().getItem(position);
            if (!TextUtils.isEmpty(s)) {
              Toast.makeText(MainActivity.this, "OnItemClick:" + s, Toast.LENGTH_SHORT).show();
            }
          }
        });

    mSlideListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            if (scrollState == SCROLL_STATE_IDLE) {
              Log.d("roamer", "no");
            } else {
              Log.d("roamer", "scroll");
            }
          }

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
        });
  }
예제 #3
0
 private void changeSlideRightAction(MenuItem item) {
   if (mSlideListView.getSlideRightAction() == SlideAction.SCROLL) {
     mSlideListView.setSlideRightAction(SlideAction.REVEAL);
   } else {
     mSlideListView.setSlideRightAction(SlideAction.SCROLL);
   }
   if (item != null) {
     item.setTitle("切换SlideRightAction:" + mSlideListView.getSlideRightAction().toString());
   }
   Toast.makeText(
           this,
           "切换SlideRightAction:" + mSlideListView.getSlideRightAction().toString(),
           Toast.LENGTH_SHORT)
       .show();
 }
예제 #4
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getMenuInflater().inflate(R.menu.main, menu);
   // SlideMode
   MenuItem item = menu.findItem(R.id.menu_slide_mode);
   item.setTitle("切换SlideMode:" + mSlideListView.getSlideMode().toString());
   // SlideLeftAction
   item = menu.findItem(R.id.menu_slide_left_action);
   item.setTitle("切换SlideLeftAction:" + mSlideListView.getSlideLeftAction().toString());
   // SlideRightAction
   item = menu.findItem(R.id.menu_slide_right_action);
   item.setTitle("切换SlideRightAction:" + mSlideListView.getSlideRightAction().toString());
   return true;
 }
예제 #5
0
 private void changeSlideMode(MenuItem item) {
   if (mSlideListView.getSlideMode() == SlideMode.BOTH) {
     mSlideListView.setSlideMode(SlideMode.LEFT);
   } else if (mSlideListView.getSlideMode() == SlideMode.LEFT) {
     mSlideListView.setSlideMode(SlideMode.RIGHT);
   } else if (mSlideListView.getSlideMode() == SlideMode.RIGHT) {
     mSlideListView.setSlideMode(SlideMode.NONE);
   } else if (mSlideListView.getSlideMode() == SlideMode.NONE) {
     mSlideListView.setSlideMode(SlideMode.BOTH);
   }
   if (item != null) {
     item.setTitle("切换SlideMode:" + mSlideListView.getSlideMode().toString());
   }
   Toast.makeText(
           this, "切换SlideMode:" + mSlideListView.getSlideMode().toString(), Toast.LENGTH_SHORT)
       .show();
 }
예제 #6
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Handle action bar item clicks here. The action bar will
   // automatically handle clicks on the Home/Up button, so long
   // as you specify a parent activity in AndroidManifest.xml.
   int id = item.getItemId();
   if (id == R.id.menu_slide_mode) {
     changeSlideMode(item);
   } else if (id == R.id.menu_slide_left_action) {
     changeSlideLeftAction(item);
   } else if (id == R.id.menu_slide_right_action) {
     changeSlideRightAction(item);
   } else if (id == R.id.menu_data_change) {
     randomCreateTestData();
     mAdapter.notifyDataSetChanged();
   } else if (id == R.id.menu_adapter_change) {
     randomCreateTestData();
     mAdapter = new SlideAdapter(this, mTestData);
     mSlideListView.setAdapter(mAdapter);
   }
   return super.onOptionsItemSelected(item);
 }