content: /*
   *    Copyright (C) 2019
   *    Albrecht Lohofener (albrechtloh@gmx.de)
   *
   *    This file is part of the welle.io.
   *    Many of the ideas as implemented in welle.io are derived from
   *    other work, made available through the GNU general Public License.
   *    All copyrights of the original authors are recognized.
   *
   *    welle.io is free software; you can redistribute it and/or modify
   *    it under the terms of the GNU General Public License as published by
   *    the Free Software Foundation; either version 2 of the License, or
   *    (at your option) any later version.
   *
   *    welle.io is distributed in the hope that it will be useful,
   *    but WITHOUT ANY WARRANTY; without even the implied warranty of
   *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *    GNU General Public License for more details.
   *
   *    You should have received a copy of the GNU General Public License
   *    along with welle.io; if not, write to the Free Software
   *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
   *    Driver for https://github.com/martinmarinov/rtl_tcp_andro-
   */
  
  package io.welle.welle;
  
  import android.app.FragmentManager;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.app.Dialog;
  import android.content.DialogInterface;
  import android.os.Bundle;
  import android.app.DialogFragment;
  import android.content.Intent;
  import android.net.Uri;
  
  public class InstallRtlTcpAndro extends DialogFragment {
      private String okButtonText;
      private String cancelButtonText;
      private String message;
  
      public void setMessageText(String okButtonText, String cancelButtonText, String message) {
          this.okButtonText = okButtonText;
          this.cancelButtonText = cancelButtonText;
          this.message = message;
          }
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          // Use the Builder class for convenient dialog construction
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          builder.setMessage(message)
                  .setPositiveButton(okButtonText, new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                          Intent goToMarket = new Intent(Intent.ACTION_VIEW)
                              .setData(Uri.parse("market://details?id=marto.rtl_tcp_andro"));
                          startActivity(goToMarket);
                      }
                  })
                  .setNegativeButton(cancelButtonText, new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                          // User cancelled the dialog
                      }
                  });
          // Create the AlertDialog object and return it
          return builder.create();
      }
  }
  
  