当前位置: 首页>>代码示例>>Java>>正文


Java MainActivity类代码示例

本文整理汇总了Java中org.videolan.vlc.gui.MainActivity的典型用法代码示例。如果您正苦于以下问题:Java MainActivity类的具体用法?Java MainActivity怎么用?Java MainActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MainActivity类属于org.videolan.vlc.gui包,在下文中一共展示了MainActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResume

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    mMainActivity = (MainActivity) getActivity();
    if (mMediaLibrary.isWorking())
        mHandler.sendEmptyMessageDelayed(MSG_LOADING, 300);
    else if (mGenresAdapter.isEmpty() || mArtistsAdapter.isEmpty() ||
            mAlbumsAdapter.isEmpty() || mSongsAdapter.isEmpty())
        updateLists();
    else
        focusHelper(false, mLists.get(mViewPager.getCurrentItem()).getId());
    mMediaLibrary.addUpdateHandler(mHandler);
    mMediaLibrary.setBrowser(this);
    final ListView current = (ListView)mLists.get(mViewPager.getCurrentItem());
    current.post(new Runnable() {
        @Override
        public void run() {
            mSwipeRefreshLayout.setEnabled(current.getFirstVisiblePosition() == 0);
        }
    });
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:22,代码来源:AudioBrowserFragment.java

示例2: onResume

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if ((getActivity() instanceof MainActivity))
        mMainActivity = (MainActivity) getActivity();
    mMediaLibrary.setBrowser(this);
    mMediaLibrary.addUpdateHandler(mHandler);
    final boolean refresh = mVideoAdapter.isEmpty();
    if (refresh)
        updateList();
    else {
        mViewNomedia.setVisibility(View.GONE);
        focusHelper(false);
    }
    //Get & set times
    HashMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes();
    mVideoAdapter.setTimes(times);
    mGridView.setSelection(mGVFirstVisiblePos);
    updateViewMode();
    if (mGroup == null && refresh)
        mAnimator.animate();

    /* Start the thumbnailer */
    if (mThumbnailer != null)
        mThumbnailer.start(this);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:27,代码来源:VideoGridFragment.java

示例3: switchToAudioMode

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
public void switchToAudioMode(boolean showUI) {
    if (mHardwareAccelerationError || mService == null)
        return;
    mSwitchingView = true;
    // Show the MainActivity if it is not in background.
    if (showUI && getIntent().getAction() != null
        && getIntent().getAction().equals(Intent.ACTION_VIEW)) {
        Intent i = new Intent(this, MainActivity.class);
        if (!Util.isCallable(i)){
            try {
                i = new Intent(this, Class.forName("org.videolan.vlc.gui.tv.audioplayer.AudioPlayerActivity"));
            } catch (ClassNotFoundException e) {
                return;
            }
        }
        startActivity(i);
    }
    exitOK();
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:20,代码来源:VideoPlayerActivity.java

示例4: onResume

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    mMainActivity = (MainActivity) getActivity();
    if (mMediaLibrary.isWorking())
        mHandler.sendEmptyMessageDelayed(MSG_LOADING, 300);
    else if (mGenresAdapter.isEmpty() || mArtistsAdapter.isEmpty() ||
            mAlbumsAdapter.isEmpty() || mSongsAdapter.isEmpty())
        updateLists();
    else {
        updateEmptyView(mViewPager.getCurrentItem());
        focusHelper(false, mLists.get(mViewPager.getCurrentItem()).getId());
    }
    mMediaLibrary.addUpdateHandler(mHandler);
    mMediaLibrary.setBrowser(this);
    final ListView current = (ListView)mLists.get(mViewPager.getCurrentItem());
    current.post(new Runnable() {
        @Override
        public void run() {
            mSwipeRefreshLayout.setEnabled(current.getFirstVisiblePosition() == 0);
        }
    });
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:24,代码来源:AudioBrowserFragment.java

示例5: onResume

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if ((getActivity() instanceof MainActivity))
        mMainActivity = (MainActivity) getActivity();
    mMediaLibrary.setBrowser(this);
    mMediaLibrary.addUpdateHandler(mHandler);
    final boolean refresh = mVideoAdapter.isEmpty();
    if (refresh)
        updateList();
    else {
        mViewNomedia.setVisibility(View.GONE);
        focusHelper(false);
    }
    //Get & set times
    ArrayMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes();
    mVideoAdapter.setTimes(times);
    mGridView.setSelection(mGVFirstVisiblePos);
    updateViewMode();
    if (mGroup == null && refresh)
        mAnimator.animate();

    /* Start the thumbnailer */
    if (mThumbnailer != null)
        mThumbnailer.start(this);
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:27,代码来源:VideoGridFragment.java

示例6: focusHelper

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
protected void focusHelper() {
    if (getActivity() == null || !(getActivity() instanceof MainActivity))
        return;
    boolean isEmpty = mAdapter.isEmpty();
    MainActivity main = (MainActivity) getActivity();
    main.setMenuFocusDown(isEmpty, R.id.network_list);
    main.setSearchAsFocusDown(isEmpty, getView(), R.id.network_list);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:9,代码来源:BaseBrowserFragment.java

示例7: focusHelper

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
private void focusHelper(final boolean idIsEmpty, final int listId) {
    final View parent = getView();
    final MainActivity main = (MainActivity)getActivity();
    if (main == null)
        return;
    main.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            main.setMenuFocusDown(false, R.id.header);
            main.setSearchAsFocusDown(idIsEmpty, parent, listId);
        }
    });
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:14,代码来源:AudioBrowserFragment.java

示例8: onKey

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {

    /* Qualify key action to prevent redundant event
     * handling.
     */
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        int newPosition = mViewPager.getCurrentItem();

        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (newPosition < (MODE_TOTAL - 1))
                    newPosition++;
                break;
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (newPosition > 0)
                    newPosition--;
                break;
            default:
                return false;
        }

        if (newPosition != mViewPager.getCurrentItem()) {
            ListView vList = (ListView) mLists.get(newPosition);

            mViewPager.setCurrentItem(newPosition);

            ((MainActivity)getActivity()).setSearchAsFocusDown(
                    vList.getCount() == 0, getView(),
                    vList.getId());
        }
    }

    // clean up with MainActivity
    return false;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:37,代码来源:AudioBrowserFragment.java

示例9: onItemClick

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
    ArrayList<MediaWrapper> mediaList = mArtistsAdapter.getMedias(p);
    MainActivity activity = (MainActivity)getActivity();
    Intent i = new Intent(getActivity(), SecondaryActivity.class);
    i.putExtra("fragment", "albumsSongs");
    i.putParcelableArrayListExtra("list", mediaList);
    i.putExtra("filter", Util.getMediaArtist(activity, mediaList.get(0)));
    startActivity(i);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:11,代码来源:AudioBrowserFragment.java

示例10: onItemClick

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    MediaWrapper media = mVideoAdapter.getItem(position);
    if (media == null)
        return;
    if (media instanceof MediaGroup) {
        MainActivity activity = (MainActivity)getActivity();
        activity.showSecondaryFragment(SecondaryActivity.VIDEO_GROUP_LIST, media.getTitle());
    }
    else
        playVideo(media, false);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:13,代码来源:VideoGridFragment.java

示例11: handleContextItemSelected

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
private boolean handleContextItemSelected(MenuItem menu, int position) {
    if (position >= mVideoAdapter.getCount())
        return false;
    MediaWrapper media = mVideoAdapter.getItem(position);
    if (media == null)
        return false;
    switch (menu.getItemId()){
        case R.id.video_list_play_from_start:
            playVideo(media, true);
            return true;
        case R.id.video_list_play_audio:
            playAudio(media);
            return true;
        case R.id.video_list_info:
            Activity activity = getActivity();
            if (activity instanceof MainActivity)
                ((MainActivity)activity).showSecondaryFragment(SecondaryActivity.MEDIA_INFO, media.getLocation());
            else {
                Intent i = new Intent(activity, SecondaryActivity.class);
                i.putExtra("fragment", "mediaInfo");
                i.putExtra("param", media.getLocation());
                startActivity(i);
            }
            return true;
        case R.id.video_list_delete:
            Snackbar.make(getView(), getString(R.string.file_deleted), Snackbar.LENGTH_LONG)
                .setAction(android.R.string.cancel, mCancelDeleteMediaListener)
                .show();
            Message msg = mDeleteHandler.obtainMessage(DELETE_MEDIA, position, 0);
            mDeleteHandler.sendMessageDelayed(msg, DELETE_DURATION);
            return true;
    }
    return false;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:35,代码来源:VideoGridFragment.java

示例12: focusHelper

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
private void focusHelper(boolean idIsEmpty) {
View parent = getView();
if (getActivity() == null || !(getActivity() instanceof MainActivity))
    return;
MainActivity activity = (MainActivity)getActivity();
activity.setMenuFocusDown(idIsEmpty, android.R.id.list);
activity.setSearchAsFocusDown(idIsEmpty, parent,
        android.R.id.list);
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:10,代码来源:VideoGridFragment.java

示例13: handleContextItemSelected

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
private boolean handleContextItemSelected(MenuItem menu, int position) {
    if (position >= mVideoAdapter.getCount())
        return false;
    MediaWrapper media = mVideoAdapter.getItem(position);
    if (media == null)
        return false;
    switch (menu.getItemId()){
        case R.id.video_list_play_from_start:
            playVideo(media, true);
            return true;
        case R.id.video_list_play_audio:
            playAudio(media);
            return true;
        case R.id.video_list_info:
            Activity activity = getActivity();
            if (activity instanceof MainActivity)
                ((MainActivity)activity).showSecondaryFragment(SecondaryActivity.MEDIA_INFO, media.getLocation());
            else {
                Intent i = new Intent(activity, SecondaryActivity.class);
                i.putExtra("fragment", "mediaInfo");
                i.putExtra("param", media.getLocation());
                startActivity(i);
            }
            return true;
        case R.id.video_list_delete:
            Snackbar.make(getView(), getString(R.string.file_deleted), DELETE_DURATION)
                .setAction(android.R.string.cancel, mCancelDeleteMediaListener)
                .show();
            Message msg = mDeleteHandler.obtainMessage(DELETE_MEDIA, position, 0);
            mDeleteHandler.sendMessageDelayed(msg, DELETE_DURATION);
            return true;
    }
    return false;
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:35,代码来源:VideoGridFragment.java

示例14: onItemClick

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
    ArrayList<Media> mediaList = mArtistsAdapter.getMedia(p);
    MainActivity activity = (MainActivity)getActivity();
    AudioAlbumsSongsFragment frag = (AudioAlbumsSongsFragment)activity.showSecondaryFragment("albumsSongs");
    if (frag != null) {
        frag.setMediaList(mediaList, mediaList.get(0).getArtist());
    }
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:10,代码来源:AudioBrowserFragment.java

示例15: onGridItemClick

import org.videolan.vlc.gui.MainActivity; //导入依赖的package包/类
@Override
public void onGridItemClick(GridView l, View v, int position, long id) {
    Media media = (Media) getListAdapter().getItem(position);
    if (media instanceof MediaGroup) {
        MainActivity activity = (MainActivity)getActivity();
        VideoGridFragment frag = (VideoGridFragment)activity.showSecondaryFragment("videoGroupList");
        if (frag != null) {
            frag.setGroup(media.getTitle());
        }
    }
    else
        playVideo(media, false);
    super.onGridItemClick(l, v, position, id);
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:15,代码来源:VideoGridFragment.java


注:本文中的org.videolan.vlc.gui.MainActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。