1111import com .google .android .material .snackbar .Snackbar ;
1212import com .hjq .bar .OnTitleBarListener ;
1313import com .hjq .bar .TitleBar ;
14- import com .hjq .permissions .Permission ;
1514import com .hjq .permissions .XXPermissions ;
15+ import com .hjq .permissions .permission .PermissionLists ;
1616import com .hjq .toast .ToastParams ;
1717import com .hjq .toast .ToastStrategy ;
1818import com .hjq .toast .Toaster ;
@@ -162,7 +162,7 @@ public void run() {
162162 @ Override
163163 public void run () {
164164 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .R ) {
165- if (XXPermissions .isGrantedPermissions (MainActivity .this , Permission . SYSTEM_ALERT_WINDOW )) {
165+ if (XXPermissions .isGrantedPermission (MainActivity .this , PermissionLists . getSystemAlertWindowPermission () )) {
166166 Toaster .show (R .string .demo_show_toast_in_background_state_result_1 );
167167 } else {
168168 Toaster .show (R .string .demo_show_toast_in_background_state_result_2 );
@@ -176,13 +176,12 @@ public void run() {
176176
177177 public void combinationEasyWindowShow (View v ) {
178178 new EasyWindow <>(this )
179- .setWindowDuration (1000 )
180179 // 将 Toaster 中的 View 转移给 EasyWindow 来显示
181180 .setContentView (Toaster .getStyle ().createView (getApplication ()))
182- .setAnimStyle (android .R .style .Animation_Translucent )
181+ .setWindowDuration (1000 )
182+ .setWindowAnim (android .R .style .Animation_Translucent )
183183 .setTextByTextView (android .R .id .message , R .string .demo_combining_window_framework_use_result )
184- .setGravity (Gravity .BOTTOM )
185- .setYOffset ((int ) TypedValue .applyDimension (TypedValue .COMPLEX_UNIT_DIP , 50 , getResources ().getDisplayMetrics ()))
184+ .setWindowLocation (Gravity .BOTTOM , 0 , (int ) TypedValue .applyDimension (TypedValue .COMPLEX_UNIT_DIP , 50 , getResources ().getDisplayMetrics ()))
186185 .show ();
187186 }
188187}
0 commit comments