Example #1
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   mActivity = (AMActivity) activity;
   settings = PreferenceManager.getDefaultSharedPreferences(mActivity);
   editor = settings.edit();
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (getArguments() != null) {
     adjustments = (ArrayList<Adjustment>) getArguments().getSerializable(ADJUSTMENTS);
   }
 }
Example #3
0
 @Override
 public void onCreate(Bundle bundle) {
   super.onCreate(bundle);
   Bundle args = this.getArguments();
   dbPath = args.getString(EXTRA_DBPATH);
   setStyle(DialogFragment.STYLE_NO_TITLE, 0);
 }
Example #4
0
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    Bundle args = this.getArguments();
    if (args != null) {
      defaultRoot = args.getString(EXTRA_DEFAULT_ROOT);
      String ext = args.getString(EXTRA_FILE_EXTENSIONS);
      // Default do not dismiss the dialog
      dismissOnSelect = args.getBoolean(EXTRA_DISMISS_ON_SELECT, false);

      if (ext != null) {
        fileExtensions = ext.split(",");
      } else {
        fileExtensions = new String[] {".db"};
      }
    } else {
      fileExtensions = new String[] {".db"};
      defaultRoot = null;
    }
    if (defaultRoot == null) {
      defaultRoot = settings.getString(AMPrefKeys.SAVED_FILEBROWSER_PATH_KEY, null);

      // Make sure the path exists.
      if (!Strings.isNullOrEmpty(defaultRoot) && !new File(defaultRoot).exists()) {
        defaultRoot = null;
      }
    }

    if (Strings.isNullOrEmpty(defaultRoot)) {
      File sdPath = new File(AMEnv.DEFAULT_ROOT_PATH);
      sdPath.mkdir();

      currentDirectory = sdPath;
    } else {
      currentDirectory = new File(defaultRoot + "/");
    }

    // Should use this to enable menu
    setHasOptionsMenu(true);
  }
Example #5
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.file_browser_menu, menu);
 }
Example #6
0
 @Override
 public void onResume() {
   super.onResume();
   browseTo(currentDirectory);
 }
Example #7
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   mActivity = (AMActivity) activity;
 }