From 12db4e4882a220374cc938b8b91ea115b446d7ba Mon Sep 17 00:00:00 2001 From: Sean Maas Date: Mon, 24 Oct 2016 22:41:13 -0400 Subject: [PATCH] Android: Fix "up one level" button --- .../activities/AddDirectoryActivity.java | 4 ++-- .../dolphinemu/adapters/FileAdapter.java | 14 +++++++++----- .../src/main/res/layout/activity_add_directory.xml | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AddDirectoryActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AddDirectoryActivity.java index 09e833d1ad..7751844bbb 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AddDirectoryActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/AddDirectoryActivity.java @@ -10,10 +10,10 @@ import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.widget.Toolbar; import org.dolphinemu.dolphinemu.BuildConfig; import org.dolphinemu.dolphinemu.R; @@ -41,7 +41,7 @@ public class AddDirectoryActivity extends AppCompatActivity implements FileAdapt setContentView(R.layout.activity_add_directory); mToolbar = (Toolbar) findViewById(R.id.toolbar_folder_list); - setActionBar(mToolbar); + setSupportActionBar(mToolbar); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list_files); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/FileAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/FileAdapter.java index aea9ce7297..b7114620b8 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/FileAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/FileAdapter.java @@ -1,5 +1,6 @@ package org.dolphinemu.dolphinemu.adapters; +import android.os.Environment; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; @@ -197,12 +198,15 @@ public final class FileAdapter extends RecyclerView.Adapter impl public void upOneLevel() { - File currentDirectory = new File(mPath); - File parentDirectory = currentDirectory.getParentFile(); + if (!mPath.equals(Environment.getExternalStorageDirectory().getPath())) + { + File currentDirectory = new File(mPath); + File parentDirectory = currentDirectory.getParentFile(); - mFileList = generateFileList(parentDirectory); - notifyDataSetChanged(); - mListener.updateSubtitle(mPath); + mFileList = generateFileList(parentDirectory); + notifyDataSetChanged(); + mListener.updateSubtitle(mPath); + } } /** diff --git a/Source/Android/app/src/main/res/layout/activity_add_directory.xml b/Source/Android/app/src/main/res/layout/activity_add_directory.xml index 72d66c3950..3308cbe028 100644 --- a/Source/Android/app/src/main/res/layout/activity_add_directory.xml +++ b/Source/Android/app/src/main/res/layout/activity_add_directory.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical"> -