예제 #1
0
 private void updateDetailFileInfo(File dir) {
   ArrayList<UIFileInfo> files = UIFileInfo.addFileFrom(dir);
   //        ArrayList<UIFileInfo> files = new ArrayList<>();
   //        addFileFrom(files, dir);
   detailFragment.clearListView();
   detailFragment.addListView(files).notifyDataSetChanged(currentSelectedDir().getName());
 }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_with_fragment);

    Intent intent = getIntent();
    if (password == null) {
      password = intent.getStringExtra(FirstActivity.PASSWORD);
    }
    if (password == null) {
      showPasswordDialog();
    }

    // set the secretKey for this fragment to encrypt/decrypt
    fileChooserBL = new FileChooserBL(this);
    fileChooserBL.createAndInitDir(Category.values(), fatherDirInfos);
    // Check that the activity is using the layout version with
    // the fragment_container FrameLayout
    if (findViewById(R.id.folder_fragment_container) != null
        && findViewById(R.id.file_fragment_container) != null) {

      // However, if we're being restored from a previous state,
      // then we don't need to do anything and should return or else
      // we could end up with overlapping fragments.
      if (savedInstanceState != null) {
        return;
      }

      folderFragment =
          FolderFragment.newInstance(
              fatherDirInfos,
              R.layout.with_icon,
              new String[] {UIFileInfo.LOGO, UIFileInfo.NAME},
              new int[] {R.id.logo, R.id.desc1});
      detailFragment =
          DetailFileFragment.newInstance(
              UIFileInfo.addFileFrom(currentSelectedDir()), currentSelectedDir().getName());
      // In case this activity was started with special instructions from an
      // Intent, pass the Intent's extras to the fragment as arguments
      folderFragment.setArguments(getIntent().getExtras());
      detailFragment.setArguments(getIntent().getExtras());

      // Add the fragment to the '#fragment_container' FrameLayout
      FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
      fragmentTransaction.add(R.id.folder_fragment_container, folderFragment);
      fragmentTransaction.add(R.id.file_fragment_container, detailFragment).commit();
    }
  }