content: package dev.dworks.apps.anexplorer.common;
  
  import android.app.Activity;
  import android.app.Dialog;
  import android.content.DialogInterface;
  import android.os.Bundle;
  import androidx.appcompat.app.AlertDialog;
  import androidx.appcompat.app.AppCompatDialogFragment;
  
  import android.text.TextUtils;
  import android.widget.Button;
  
  import dev.dworks.apps.anexplorer.misc.CrashReportingManager;
  import dev.dworks.apps.anexplorer.misc.Utils;
  
  /**
   * Created by HaKr on 12/06/16.
   */
  
  public class DialogFragment extends AppCompatDialogFragment {
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
          if(!getShowsDialog()){
              return;
          }
          getDialog().setOnShowListener(new DialogInterface.OnShowListener() {
              @Override
              public void onShow(DialogInterface dialog) {
                  try{
                      tintButtons(getDialog());
                  } catch (Exception e){
                      CrashReportingManager.logException(e);
                  }
              }
          });
      }
  
      public static void tintButtons(Dialog dialog){
          Utils.tintButton(getButton(dialog, DialogInterface.BUTTON_POSITIVE));
          Utils.tintButton(getButton(dialog, DialogInterface.BUTTON_NEGATIVE));
          Utils.tintButton(getButton(dialog, DialogInterface.BUTTON_NEUTRAL));
      }
  
      private static Button getButton(Dialog dialog, int which){
          return ((AlertDialog)dialog).getButton(which);
      }
  }
  