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,8 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat
116117 MainActivity .this .searchView .clearFocus ();
117118 }
118119 });
120+ this .searchCard .setRadius (this .searchCard .getHeight () / 2F );
121+ this .searchView .setMinimumHeight (CompatDisplay .dpToPixel (16 ));
119122 this .searchView .setImeOptions (EditorInfo .IME_ACTION_SEARCH |
120123 EditorInfo .IME_FLAG_NO_FULLSCREEN );
121124 this .searchView .setOnQueryTextListener (this );
@@ -177,6 +180,8 @@ public void commonNext() {
177180 } else {
178181 if (AppUpdateManager .getAppUpdateManager ().checkUpdate (true ))
179182 moduleViewListBuilder .addNotification (NotificationType .UPDATE_AVAILABLE );
183+ if (AppUpdateManager .getAppUpdateManager ().isLastCheckSuccess ())
184+ AppUpdateManager .getAppUpdateManager ().checkUpdateCompat ();
180185 if (max != 0 ) {
181186 int current = 0 ;
182187 for (LocalModuleInfo localModuleInfo :
@@ -238,32 +243,38 @@ private void updateScreenInsets(Configuration configuration) {
238243 this .swipeRefreshLayout .setProgressViewOffset (false ,
239244 swipeRefreshLayoutOrigStartOffset + combinedBarsHeight ,
240245 swipeRefreshLayoutOrigEndOffset + combinedBarsHeight );
241- this .moduleViewListBuilder .setHeaderPx (actionBarHeight );
246+ this .moduleViewListBuilder .setHeaderPx (
247+ actionBarHeight + CompatDisplay .dpToPixel (8 ));
242248 this .moduleViewListBuilder .setFooterPx (
243249 bottomInset + this .searchCard .getHeight ());
250+ this .searchCard .setRadius (this .searchCard .getHeight () / 2F );
244251 this .moduleViewListBuilder .updateInsets ();
245252 this .actionBarBlur .invalidate ();
246253 this .overScrollInsetTop = combinedBarsHeight ;
247254 this .overScrollInsetBottom = bottomInset ;
255+ Log .d (TAG , "( " + bottomInset + ", " +
256+ this .searchCard .getHeight () + ")" );
248257 }
249258
250259 private void updateBlurState () {
260+ boolean isLightMode = this .isLightTheme ();
261+ int colorBackground ;
262+ try {
263+ colorBackground = this .getColorCompat (
264+ android .R .attr .windowBackground );
265+ } catch (Resources .NotFoundException e ) {
266+ colorBackground = this .getColorCompat (isLightMode ?
267+ R .color .white : R .color .black );
268+ }
251269 if (MainApplication .isBlurEnabled ()) {
252270 this .actionBarBlur .setBlurEnabled (true );
253- int transparent = this .getColorCompat (R .color .transparent );
254- this .actionBarBackground .setColor (transparent );
271+ this .actionBarBackground .setColor (ColorUtils
272+ .setAlphaComponent (colorBackground , 0x02 ));
273+ this .actionBarBackground .setColor (Color .TRANSPARENT );
255274 } else {
256275 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 );
276+ this .actionBarBlur .setOverlayColor (Color .TRANSPARENT );
277+ this .actionBarBackground .setColor (colorBackground );
267278 }
268279 }
269280
0 commit comments