コード例 #1
0
 @Override
 public void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   if (mActivity != null) {
     mActivity.unregisterReceiver(mScannerReceiver);
   }
 }
コード例 #2
0
 private void registerScannerReceiver() {
   mScannerReceiver = new ScannerReceiver();
   IntentFilter intentFilter = new IntentFilter();
   intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
   intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
   intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
   intentFilter.addDataScheme("file");
   mActivity.registerReceiver(mScannerReceiver, intentFilter);
 }
コード例 #3
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // TODO Auto-generated method stub

    if (!mActivity.getSupportActionBar().isShowing()) {
      return;
    }

    mMenuUtils.addMenu(menu);

    super.onCreateOptionsMenu(menu, inflater);
  }
コード例 #4
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    mActivity = (MainActivity) getActivity();
    mActivity.setFileCategoryFragment(this);

    setHasOptionsMenu(true);
    mRootView = inflater.inflate(R.layout.file_explorer_category, container, false);

    mFilePathListView = (ListView) mRootView.findViewById(R.id.file_path_list);

    mEmptyView = (LinearLayout) mRootView.findViewById(R.id.empty_view);

    mFileInteractionHub = new FileInteractionHub(this);
    mFileInteractionHub.setMode(Mode.View);
    mFileInteractionHub.setRootPath("/");

    mMenuUtils = new MenuUtils(mActivity, mFileInteractionHub);

    mFileCagetoryHelper = new FileCategoryHelper(mActivity);
    mFileIconHelper = new FileIconHelper(mActivity);

    mFavoriteList =
        new FavoriteList(
            mActivity,
            (ListView) mRootView.findViewById(R.id.favorite_list),
            this,
            mFileInteractionHub,
            mFileIconHelper);
    mFavoriteList.initList();

    mAdapter = new FileListCursorAdapter(mActivity, null, mFileInteractionHub, mFileIconHelper);
    mFilePathListView.setAdapter(mAdapter);
    registerScannerReceiver();

    return mRootView;
  }
コード例 #5
0
 @Override
 public void runOnUiThread(Runnable r) {
   // TODO Auto-generated method stub
   mActivity.runOnUiThread(r);
 }