Android: Fix "up one level" button

This commit is contained in:
Sean Maas 2016-10-24 22:41:13 -04:00
parent b0e2642883
commit 12db4e4882
3 changed files with 12 additions and 8 deletions

View File

@ -10,10 +10,10 @@ import android.os.Environment;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toolbar;
import org.dolphinemu.dolphinemu.BuildConfig; import org.dolphinemu.dolphinemu.BuildConfig;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
@ -41,7 +41,7 @@ public class AddDirectoryActivity extends AppCompatActivity implements FileAdapt
setContentView(R.layout.activity_add_directory); setContentView(R.layout.activity_add_directory);
mToolbar = (Toolbar) findViewById(R.id.toolbar_folder_list); mToolbar = (Toolbar) findViewById(R.id.toolbar_folder_list);
setActionBar(mToolbar); setSupportActionBar(mToolbar);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list_files); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list_files);

View File

@ -1,5 +1,6 @@
package org.dolphinemu.dolphinemu.adapters; package org.dolphinemu.dolphinemu.adapters;
import android.os.Environment;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -197,12 +198,15 @@ public final class FileAdapter extends RecyclerView.Adapter<FileViewHolder> impl
public void upOneLevel() public void upOneLevel()
{ {
File currentDirectory = new File(mPath); if (!mPath.equals(Environment.getExternalStorageDirectory().getPath()))
File parentDirectory = currentDirectory.getParentFile(); {
File currentDirectory = new File(mPath);
File parentDirectory = currentDirectory.getParentFile();
mFileList = generateFileList(parentDirectory); mFileList = generateFileList(parentDirectory);
notifyDataSetChanged(); notifyDataSetChanged();
mListener.updateSubtitle(mPath); mListener.updateSubtitle(mPath);
}
} }
/** /**

View File

@ -5,7 +5,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar_folder_list" android:id="@+id/toolbar_folder_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"