public void setSlideRightAction(SlideAction slideAction) {
   if (mSlideRightAction != slideAction) {
     if (isSlideAdapter()) {
       if (mTouchListener.isOpend()) {
         mTouchListener.closeOpenedItem();
       }
     }
     mSlideRightAction = slideAction;
     if (isSlideAdapter()) {
       SlideBaseAdapter adapter = mAdapter;
       setAdapter(null);
       setAdapter(adapter);
     }
   }
 }
  @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);
  }
Esempio n. 3
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) {}
        });
  }
Esempio n. 4
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);
 }