content: package com.project.newsapp.utils;
  
  import android.app.Activity;
  import android.graphics.PorterDuff;
  import android.graphics.drawable.Drawable;
  import android.os.Build;
  import android.view.Menu;
  import android.view.View;
  import android.view.Window;
  import android.view.WindowManager;
  
  import androidx.annotation.ColorInt;
  import androidx.annotation.ColorRes;
  
  public class Util {
  
      public static final String APP_NAME = "NEWS_APP";
      public static final String API_BASE_URL = "http://newsapi.org/";
  
      public static final String COUNTRY_PREF = "countryPref";
  
      public static void setSystemBarColor(Activity act, @ColorRes int color) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
              Window window = act.getWindow();
              window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
              window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
              window.setStatusBarColor(act.getResources().getColor(color));
          }
      }
  
      public static void setSystemBarLight(Activity act) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
              View view = act.findViewById(android.R.id.content);
              int flags = view.getSystemUiVisibility();
              flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
              view.setSystemUiVisibility(flags);
          }
      }
  
      public static void changeMenuIconColor(Menu menu, @ColorInt int color) {
          for (int i = 0; i < menu.size(); i++) {
              Drawable drawable = menu.getItem(i).getIcon();
              if (drawable == null) continue;
              drawable.mutate();
              drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
          }
      }
  
  }
  