44import android .app .Activity ;
55import android .content .Intent ;
66import android .content .pm .PackageManager ;
7+ import android .os .Environment ;
78import android .support .v4 .app .FragmentManager ;
89import android .support .v4 .content .ContextCompat ;
910import android .support .v7 .app .AppCompatActivity ;
@@ -34,14 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
3435 this .setSelectButtonClickListener ();
3536 SimpleFileExplorerFragment fragment = new SimpleFileExplorerFragment ();
3637 fragment .setListeners (this );
37- getSupportFragmentManager ().beginTransaction ().add (R .id .frame_layout , fragment ).addToBackStack (this .STACK_KEY ).commit ();
38-
39- getSupportFragmentManager ().addOnBackStackChangedListener (new FragmentManager .OnBackStackChangedListener () {
40- @ Override
41- public void onBackStackChanged () {
42- selectButton .setEnabled (false );
43- }
44- });
38+ getSupportFragmentManager ().beginTransaction ().add (R .id .frame_layout , fragment ).addToBackStack (STACK_KEY ).commit ();
39+ this .selectedAbsolutePath = Environment .getExternalStorageDirectory ().getAbsolutePath ();
4540 }
4641
4742 private void initViews (){
@@ -72,10 +67,11 @@ public void onClick(View v) {
7267
7368 @ Override
7469 public void onDirectoryChanged (String absolutePath ) {
70+ this .selectedAbsolutePath = absolutePath ;
7571 SimpleFileExplorerFragment fragment = new SimpleFileExplorerFragment ();
7672 fragment .setListeners (this );
7773 fragment .setDirectory (absolutePath );
78- getSupportFragmentManager ().beginTransaction ().replace (R .id .frame_layout , fragment ).addToBackStack (this . STACK_KEY ).commit ();
74+ getSupportFragmentManager ().beginTransaction ().replace (R .id .frame_layout , fragment ).addToBackStack (STACK_KEY ).commit ();
7975 }
8076
8177 @ Override
@@ -85,8 +81,9 @@ public void onFileSelect(String absolutePath) {
8581 }
8682
8783 @ Override
88- public void updateFileTypeIcon ( ) {
84+ public void onBackButtonPressed ( String absolutePath ) {
8985 this .fileTypeImageView .setImageResource (R .drawable .ic_folder );
86+ this .selectedAbsolutePath = absolutePath ;
9087 }
9188
9289 private void checkPermission (){
0 commit comments