1111import android .content .Intent ;
1212import android .content .pm .PackageManager ;
1313import android .content .pm .ResolveInfo ;
14+ import android .content .res .Resources ;
1415import android .content .res .TypedArray ;
1516import android .graphics .Bitmap ;
1617import android .graphics .Color ;
1718import android .graphics .Rect ;
1819import android .graphics .drawable .ColorDrawable ;
1920import android .graphics .drawable .Drawable ;
21+ import android .graphics .drawable .VectorDrawable ;
2022import android .net .Uri ;
2123import android .os .Build ;
2224import android .os .Bundle ;
4951import androidx .annotation .NonNull ;
5052import androidx .annotation .Nullable ;
5153import androidx .appcompat .app .AppCompatActivity ;
54+ import androidx .appcompat .app .AppCompatDelegate ;
5255import androidx .appcompat .content .res .AppCompatResources ;
56+ import androidx .appcompat .view .ContextThemeWrapper ;
5357import androidx .appcompat .widget .AppCompatTextView ;
5458import androidx .constraintlayout .widget .Group ;
5559import androidx .core .app .ActivityCompat ;
5660import androidx .core .app .ActivityOptionsCompat ;
5761import androidx .core .app .SharedElementCallback ;
5862import androidx .core .content .ContextCompat ;
5963import androidx .core .content .FileProvider ;
64+ import androidx .core .content .res .ResourcesCompat ;
6065import androidx .core .graphics .Insets ;
6166import androidx .core .graphics .drawable .DrawableKt ;
6267import androidx .core .view .ViewCompat ;
6974import androidx .lifecycle .ViewModelProvider ;
7075import androidx .recyclerview .widget .LinearLayoutManager ;
7176import androidx .recyclerview .widget .RecyclerView ;
77+ import androidx .vectordrawable .graphics .drawable .VectorDrawableCompat ;
7278
7379import com .aurelhubert .ahbottomnavigation .AHBottomNavigation ;
7480import com .aurelhubert .ahbottomnavigation .AHBottomNavigationItem ;
8288import java .util .Collections ;
8389import java .util .List ;
8490import java .util .Map ;
91+ import java .util .concurrent .ExecutorService ;
92+ import java .util .concurrent .Executors ;
8593import java .util .concurrent .atomic .AtomicBoolean ;
8694
8795import ir .smartdevelopers .smartfilebrowser .R ;
@@ -196,6 +204,7 @@ public class FileBrowserMainActivity extends AppCompatActivity {
196204 // when it closing
197205 private final AtomicBoolean mIsCanceled = new AtomicBoolean (true );
198206 //</editor-fold>
207+ private ExecutorService mExecutorService ;
199208
200209 private void getDataFromIntent () {
201210 mShowVideosInGallery = getIntent ().getBooleanExtra ("mShowVideosInGallery" , true );
@@ -243,18 +252,25 @@ public boolean accept(File pathname) {
243252 };
244253 }
245254
255+
246256 @ Override
247257 protected void onCreate (Bundle savedInstanceState ) {
248- setTheme (R .style .sfb_AppTheme );
258+
259+
260+ super .onCreate (savedInstanceState );
261+
249262 Window window = getWindow ();
263+ window .requestFeature (Window .FEATURE_ACTIVITY_TRANSITIONS );
250264// window.setSharedElementsUseOverlay(false);
251265 WindowCompat .enableEdgeToEdge (window );
252266 window .setBackgroundDrawable (new ColorDrawable (Color .TRANSPARENT ));
267+ window .getDecorView ().setBackground (new ColorDrawable (Color .TRANSPARENT ));
253268 window .addFlags (WindowManager .LayoutParams .FLAG_DIM_BEHIND );
269+ window .addFlags (WindowManager .LayoutParams .FLAG_TRANSLUCENT_STATUS );
270+
254271// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
255272 window .setDimAmount (0.6f );
256273
257- window .requestFeature (Window .FEATURE_ACTIVITY_TRANSITIONS );
258274 window .setAllowEnterTransitionOverlap (false );
259275 Transition transition = TransitionInflater .from (this ).inflateTransition (R .transition .iten_transition_in );
260276 window .setSharedElementExitTransition (transition );
@@ -273,7 +289,6 @@ public void onMapSharedElements(List<String> names, Map<String, View> sharedElem
273289 }
274290 });
275291
276- super .onCreate (savedInstanceState );
277292 setContentView (R .layout .activity_file_browser_main );
278293 mIsCanceled .set (true );
279294 mSelectionFileViewModel = new ViewModelProvider (this ).get (SelectionFileViewModel .class );
@@ -339,11 +354,12 @@ public void onChanged(List<FileBrowserModel> fileBrowserModels) {
339354 // </editor-fold>
340355 // <editor-fold desc=" FileBrowser adapter init">
341356 if (mShowGalleryTab ) {
357+ mExecutorService = Executors .newFixedThreadPool (3 );
342358 int spanCount = getResources ().getInteger (R .integer .sfb_gallery_grid );
343359 int gapSpace = getResources ().getDimensionPixelSize (R .dimen .sfb_gallery_gap_size );
344360
345361 mGalleryLayoutManager = new GalleryLayoutManager (this , spanCount );
346- mGalleryAdapter = new GalleryAdapter (mSelectionFileViewModel .getSelectedFiles ());
362+ mGalleryAdapter = new GalleryAdapter (mSelectionFileViewModel .getSelectedFiles (), mExecutorService );
347363 mGalleryAdapter .setCanSelectMultiple (mCanSelectMultipleInGallery );
348364 mGalleryAdapter .setOnItemClickListener (mGalleryModelItemClickListener );
349365 mGalleryAdapter .setOnItemSelectListener (mOnFileItemSelectListener );
@@ -511,9 +527,12 @@ private void manageEdgeToEdge() {
511527
512528 @ Override
513529 protected void onDestroy () {
514- super .onDestroy ();
515- // mCallbackViewModel.clearCallback();
530+ if (mExecutorService != null ){
531+ mExecutorService .shutdown ();
532+ }
516533 mResultListener .clear ();
534+ super .onDestroy ();
535+
517536 }
518537
519538 @ Override
@@ -818,7 +837,10 @@ private AHBottomNavigationItem createNavItem(int colorAttr, int titleRes, int ic
818837 value .data );
819838 }
820839 private void initViews (Bundle savedInstanceState ) {
821-
840+ // ContextThemeWrapper wrapper = new ContextThemeWrapper(this,R.style.sfb_BaseAppTheme);
841+ // Drawable okDrawable = VectorDrawableCompat.create(wrapper.getResources(),R.drawable.sfb_ic_circle_tick_filled,wrapper.getTheme());
842+ // //okDrawable.setTintList(null);
843+ // btnSelectionOk.setImageDrawable(okDrawable);
822844 int [] attrs ={R .attr .SFBColorGallery ,R .attr .SFBColorPDF ,R .attr .SFBColorAudio ,R .attr .SFBColorFile };
823845
824846 if (mShowGalleryTab ) {
0 commit comments