Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d12960ce authored by jruesga's avatar jruesga
Browse files

New search action "Open parent"

parent 8e2c09f6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -126,6 +126,10 @@
      android:id="@+id/mnu_actions_add_to_bookmarks"
      android:showAsAction="ifRoom"
      android:title="@string/actions_menu_add_to_bookmarks"/>
    <item
      android:id="@+id/mnu_actions_open_parent_folder"
      android:showAsAction="ifRoom"
      android:title="@string/actions_menu_open_parent_folder"/>
  </group>

</menu>
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -493,6 +493,8 @@
  <string name="actions_menu_properties">Properties</string>
  <!-- Actions Dialog * Menu * Add to bookmarks -->
  <string name="actions_menu_add_to_bookmarks">Add to bookmarks</string>
  <!-- Actions Dialog * Menu * Open parent folder -->
  <string name="actions_menu_open_parent_folder">Open parent</string>

  <!-- Actions * Ask user prior to do an undone operation -->
  <string name="actions_ask_undone_operation">
+9 −1
Original line number Diff line number Diff line
@@ -767,6 +767,14 @@ public class NavigationActivity extends Activity
        this.getCurrentNavigationView().onDeselectAll();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void onNavigateTo(Object o) {
        // Ignored
    }

    /**
     * {@inheritDoc}
     */
@@ -1182,7 +1190,7 @@ public class NavigationActivity extends Activity
        }

        // Show the dialog
        ActionsDialog dialog = new ActionsDialog(this, fso, global);
        ActionsDialog dialog = new ActionsDialog(this, fso, global, false);
        dialog.setOnRequestRefreshListener(this);
        dialog.setOnSelectionListener(getCurrentNavigationView());
        dialog.show();
+22 −9
Original line number Diff line number Diff line
@@ -500,7 +500,7 @@ public class SearchActivity extends Activity
                                }

                                //Close search activity
                                back(true, null);
                                back(true, null, false);
                            }
                       });
        dialog.show();
@@ -762,7 +762,7 @@ public class SearchActivity extends Activity
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                back(true, null);
                back(true, null, false);
                return true;
            default:
                return super.onKeyUp(keyCode, event);
@@ -776,7 +776,7 @@ public class SearchActivity extends Activity
    public boolean onOptionsItemSelected(MenuItem item) {
       switch (item.getItemId()) {
          case android.R.id.home:
              back(true, null);
              back(true, null, false);
              return true;
          default:
             return super.onOptionsItemSelected(item);
@@ -792,15 +792,15 @@ public class SearchActivity extends Activity
            SearchResult result = ((SearchResultAdapter)parent.getAdapter()).getItem(position);
            FileSystemObject fso = result.getFso();
            if (fso instanceof Directory) {
                back(false, fso);
                back(false, fso, false);
            } else if (fso instanceof Symlink) {
                Symlink symlink = (Symlink)fso;
                if (symlink.getLinkRef() != null && symlink.getLinkRef() instanceof Directory) {
                    back(false, symlink.getLinkRef());
                    back(false, symlink.getLinkRef(), false);
                }
            } else {
                // Open the file with the preferred registered app
                back(false, fso);
                back(false, fso, false);
            }
        } catch (Throwable ex) {
            ExceptionUtil.translateException(this.mSearchListView.getContext(), ex);
@@ -868,7 +868,7 @@ public class SearchActivity extends Activity
            return;
        }

        ActionsDialog dialog = new ActionsDialog(this, fso, false);
        ActionsDialog dialog = new ActionsDialog(this, fso, false, true);
        dialog.setOnRequestRefreshListener(this);
        dialog.show();
    }
@@ -934,6 +934,16 @@ public class SearchActivity extends Activity
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void onNavigateTo(Object o) {
        if (o instanceof FileSystemObject) {
            back(false, (FileSystemObject)o, true);
        }
    }

    /**
     * Method that returns to previous activity.
     *
@@ -941,7 +951,7 @@ public class SearchActivity extends Activity
     * @param item The fso
     * @hide
     */
    void back(final boolean canceled, FileSystemObject item) {
    void back(final boolean canceled, FileSystemObject item, boolean isChecked) {
        Intent intent =  new Intent();
        if (canceled) {
            if (SearchActivity.this.mDrawingSearchResultTask != null
@@ -957,7 +967,10 @@ public class SearchActivity extends Activity
        } else {
            // Check that the bookmark exists
            try {
                FileSystemObject fso = CommandHelper.getFileInfo(this, item.getFullPath(), null);
                FileSystemObject fso = item;
                if (!isChecked) {
                    fso = CommandHelper.getFileInfo(this, item.getFullPath(), null);
                }
                if (fso != null) {
                    if (FileHelper.isDirectory(fso)) {
                        intent.putExtra(NavigationActivity.EXTRA_SEARCH_ENTRY_SELECTION, fso);
+7 −0
Original line number Diff line number Diff line
@@ -34,4 +34,11 @@ public interface OnRequestRefreshListener {
     * @param o The object that was removed
     */
    void onRequestRemove(Object o);

    /**
     * Invoked when the object need to navigate to.
     *
     * @param o The object where to navigate to
     */
    void onNavigateTo(Object o);
}
Loading