44import androidx .appcompat .widget .SearchView ;
55import androidx .cardview .widget .CardView ;
66import androidx .core .content .ContextCompat ;
7+ import androidx .core .graphics .ColorUtils ;
78import androidx .recyclerview .widget .LinearLayoutManager ;
89import androidx .recyclerview .widget .RecyclerView ;
910import androidx .swiperefreshlayout .widget .SwipeRefreshLayout ;
2223import android .widget .TextView ;
2324
2425import com .fox2code .mmm .compat .CompatActivity ;
26+ import com .fox2code .mmm .compat .CompatDisplay ;
2527import com .fox2code .mmm .installer .InstallerInitializer ;
2628import com .fox2code .mmm .manager .LocalModuleInfo ;
2729import com .fox2code .mmm .manager .ModuleManager ;
3234import com .google .android .material .progressindicator .LinearProgressIndicator ;
3335
3436import eightbitlab .com .blurview .BlurView ;
37+ import eightbitlab .com .blurview .BlurViewFacade ;
3538import eightbitlab .com .blurview .RenderScriptBlur ;
3639
3740public class MainActivity extends CompatActivity implements SwipeRefreshLayout .OnRefreshListener ,
@@ -72,10 +75,8 @@ protected void onCreate(Bundle savedInstanceState) {
7275 setContentView (R .layout .activity_main );
7376 this .setTitle (R .string .app_name );
7477 this .getWindow ().setFlags (
75- WindowManager .LayoutParams .FLAG_TRANSLUCENT_NAVIGATION |
76- WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS ,
77- WindowManager .LayoutParams .FLAG_TRANSLUCENT_NAVIGATION |
78- WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS );
78+ WindowManager .LayoutParams .FLAG_TRANSLUCENT_NAVIGATION ,
79+ WindowManager .LayoutParams .FLAG_TRANSLUCENT_NAVIGATION );
7980 setActionBarBackground (null );
8081 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
8182 WindowManager .LayoutParams layoutParams = this .getWindow ().getAttributes ();
@@ -106,7 +107,7 @@ protected void onCreate(Bundle savedInstanceState) {
106107 this .actionBarBlur .setupWith (this .moduleList ).setFrameClearDrawable (
107108 this .getWindow ().getDecorView ().getBackground ())
108109 .setBlurAlgorithm (new RenderScriptBlur (this ))
109- .setBlurRadius (5F ).setBlurAutoUpdate (true )
110+ .setBlurRadius (4F ).setBlurAutoUpdate (true )
110111 .setHasFixedTransformationMatrix (true );
111112 this .updateBlurState ();
112113 this .moduleList .addOnScrollListener (new RecyclerView .OnScrollListener () {
@@ -116,6 +117,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat
116117 MainActivity .this .searchView .clearFocus ();
117118 }
118119 });
120+ this .searchView .setMinimumHeight (CompatDisplay .dpToPixel (16 ));
119121 this .searchView .setImeOptions (EditorInfo .IME_ACTION_SEARCH |
120122 EditorInfo .IME_FLAG_NO_FULLSCREEN );
121123 this .searchView .setOnQueryTextListener (this );
@@ -238,32 +240,37 @@ private void updateScreenInsets(Configuration configuration) {
238240 this .swipeRefreshLayout .setProgressViewOffset (false ,
239241 swipeRefreshLayoutOrigStartOffset + combinedBarsHeight ,
240242 swipeRefreshLayoutOrigEndOffset + combinedBarsHeight );
241- this .moduleViewListBuilder .setHeaderPx (actionBarHeight );
243+ this .moduleViewListBuilder .setHeaderPx (
244+ actionBarHeight + CompatDisplay .dpToPixel (4 ));
242245 this .moduleViewListBuilder .setFooterPx (
243246 bottomInset + this .searchCard .getHeight ());
244247 this .moduleViewListBuilder .updateInsets ();
245248 this .actionBarBlur .invalidate ();
246249 this .overScrollInsetTop = combinedBarsHeight ;
247250 this .overScrollInsetBottom = bottomInset ;
251+ Log .d (TAG , "( " + bottomInset + ", " +
252+ this .searchCard .getHeight () + ")" );
248253 }
249254
250255 private void updateBlurState () {
256+ boolean isLightMode = this .isLightTheme ();
257+ int colorBackground ;
258+ try {
259+ colorBackground = this .getColorCompat (
260+ android .R .attr .windowBackground );
261+ } catch (Resources .NotFoundException e ) {
262+ colorBackground = this .getColorCompat (isLightMode ?
263+ R .color .white : R .color .black );
264+ }
251265 if (MainApplication .isBlurEnabled ()) {
252266 this .actionBarBlur .setBlurEnabled (true );
253- int transparent = this .getColorCompat (R .color .transparent );
254- this .actionBarBackground .setColor (transparent );
267+ this .actionBarBackground .setColor (ColorUtils
268+ .setAlphaComponent (colorBackground , 0x02 ));
269+ this .actionBarBackground .setColor (Color .TRANSPARENT );
255270 } else {
256271 this .actionBarBlur .setBlurEnabled (false );
257- boolean isLightMode = this .isLightTheme ();
258- int colorOpaque ;
259- try {
260- colorOpaque = this .getColorCompat (
261- android .R .attr .windowBackground );
262- } catch (Resources .NotFoundException e ) {
263- colorOpaque = this .getColorCompat (isLightMode ?
264- R .color .white : R .color .black );
265- }
266- this .actionBarBackground .setColor (colorOpaque );
272+ this .actionBarBlur .setOverlayColor (Color .TRANSPARENT );
273+ this .actionBarBackground .setColor (colorBackground );
267274 }
268275 }
269276
0 commit comments