Zenisoft

Untitled

Oct 6th, 2022
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.28 KB | Source Code | 0 0
  1. package com.zenisoft.dishcontroller.ui.home;
  2.  
  3. import static android.content.ContentValues.TAG;
  4. import static android.content.Context.MODE_PRIVATE;
  5.  
  6. import androidx.appcompat.app.ActionBar;
  7. import androidx.appcompat.app.AppCompatActivity;
  8. import androidx.appcompat.widget.AppCompatTextView;
  9. import androidx.collection.CircularArray;
  10. import androidx.fragment.app.Fragment;
  11. import androidx.fragment.app.FragmentActivity;
  12. import androidx.lifecycle.ViewModelProvider;
  13.  
  14. import android.annotation.SuppressLint;
  15. import android.app.Activity;
  16. import android.app.AlertDialog;
  17. import android.content.Context;
  18. import android.content.DialogInterface;
  19. import android.content.Intent;
  20. import android.content.SharedPreferences;
  21. import android.os.Bundle;
  22.  
  23. import androidx.annotation.NonNull;
  24. import androidx.annotation.Nullable;
  25.  
  26. import android.telecom.Call;
  27. import android.util.Log;
  28. import android.view.LayoutInflater;
  29. import android.view.Menu;
  30. import android.view.MenuInflater;
  31. import android.view.MenuItem;
  32. import android.view.View;
  33. import android.view.ViewGroup;
  34. import android.widget.Button;
  35. import android.widget.TextView;
  36. import android.widget.Toast;
  37.  
  38. import com.android.billingclient.api.AcknowledgePurchaseParams;
  39. import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
  40. import com.android.billingclient.api.BillingClient;
  41. import com.android.billingclient.api.BillingClientStateListener;
  42. import com.android.billingclient.api.BillingFlowParams;
  43. import com.android.billingclient.api.BillingResult;
  44. import com.android.billingclient.api.ConsumeParams;
  45. import com.android.billingclient.api.ConsumeResponseListener;
  46. import com.android.billingclient.api.ProductDetails;
  47. import com.android.billingclient.api.ProductDetailsResponseListener;
  48. import com.android.billingclient.api.Purchase;
  49. import com.android.billingclient.api.PurchasesResponseListener;
  50. import com.android.billingclient.api.PurchasesUpdatedListener;
  51.  
  52. import com.android.billingclient.api.QueryProductDetailsParams;
  53. import com.android.billingclient.api.QueryPurchasesParams;
  54. import com.android.billingclient.api.SkuDetails;
  55. import com.android.billingclient.api.SkuDetailsParams;
  56. import com.android.billingclient.api.SkuDetailsResponseListener;
  57. import com.anjlab.android.iab.v3.BillingProcessor;
  58. import com.anjlab.android.iab.v3.PurchaseInfo;
  59. import com.anjlab.android.iab.v3.PurchaseState;
  60. import com.google.common.collect.ImmutableList;
  61. import com.zenisoft.dishcontroller.BuildConfig;
  62. import com.zenisoft.dishcontroller.Constants;
  63. import com.zenisoft.dishcontroller.DetailActivity;
  64. import com.zenisoft.dishcontroller.MainActivity;
  65. import com.zenisoft.dishcontroller.MyDatabaseHelper;
  66. import com.zenisoft.dishcontroller.R;
  67.  
  68. import org.json.JSONException;
  69.  
  70. import java.util.ArrayList;
  71. import java.util.List;
  72. import java.util.Objects;
  73.  
  74. public class HomeFragment extends Fragment {
  75.  
  76.     private HomeViewModel mViewModel;
  77.  
  78.     public static HomeFragment newInstance() {
  79.         return new HomeFragment();
  80.     }
  81.     TextView breakfastTextView, lunchTextView, dinnerTextView;
  82.     Button breakfastButton, lunchButton, dinnerButton, generateButton;
  83.  
  84.     MyDatabaseHelper myDatabaseHelper;
  85.  
  86.     BillingClient billingClient;
  87. //    BillingProcessor bp; //!
  88.     private boolean readyToPurchase = false;
  89.  
  90.     int breakfast, lunch, dinner;
  91.  
  92.  
  93.     @Override
  94.     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
  95.                              @Nullable Bundle savedInstanceState) {
  96.         View view = inflater.inflate(R.layout.navigation_home, container, false);
  97.  
  98.         Objects.requireNonNull(((AppCompatActivity) requireActivity()).getSupportActionBar()).setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  99.         Objects.requireNonNull(((AppCompatActivity) requireActivity()).getSupportActionBar()).setCustomView(R.layout.action_bar_layout);
  100.         AppCompatTextView title = requireActivity().findViewById(R.id.titleTextApp);
  101.         title.setText(R.string.app_name);
  102.         setHasOptionsMenu(true);
  103.  
  104.         // Подключится к Google Play
  105. //        bp = BillingProcessor.newBillingProcessor(requireContext(), base64Key, this);
  106. //        bp.initialize(); // binds
  107.  
  108.         // Can't create handler inside thread Thread[PlayBillingLibrary-4,5,main] that has not called Looper.prepare() ! Как решить?
  109.         billingClient = BillingClient.newBuilder(requireContext())
  110.                 .setListener(new PurchasesUpdatedListener() {
  111.                     @Override
  112.                     public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> purchases) {
  113.                         if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && purchases != null) {
  114.                             for (Purchase purchase : purchases) {
  115.                                 verifyPayment(purchase);
  116.                             }
  117.                         } else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
  118.                             // Handle an error caused by a user cancelling the purchase flow.
  119.                         } else {
  120.                             // Handle any other error codes.
  121.                         }
  122.                     }
  123.                 })
  124.                 .enablePendingPurchases()
  125.                 .build();
  126.  
  127.  
  128.         // call connectGooglePlayBilling()
  129.         connectGooglePlayBilling();
  130.  
  131. //        if(!BillingProcessor.isIabServiceAvailable(requireContext())) {
  132. //            Toast.makeText(getContext(), "In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16", Toast.LENGTH_LONG).show();
  133. //        }
  134.  
  135.         Log.d(TAG, "onCreateView: " + getArguments());
  136.         breakfastTextView = view.findViewById(R.id.randomBreakfastText);
  137.         lunchTextView = view.findViewById(R.id.randomLunchText);
  138.         dinnerTextView = view.findViewById(R.id.randomDinnerText);
  139.         breakfastButton = view.findViewById(R.id.regenBreakfastButton);
  140.         lunchButton = view.findViewById(R.id.regenLunchButton);
  141.         dinnerButton = view.findViewById(R.id.regenDinnerButton);
  142.         generateButton = view.findViewById(R.id.generateButton);
  143.         myDatabaseHelper = new MyDatabaseHelper(getContext());
  144.  
  145.         generateButton.setOnClickListener(v -> {
  146.             breakfast = myDatabaseHelper.getRandomDish("breakfast");
  147.             lunch = myDatabaseHelper.getRandomDish("lunch");
  148.             dinner = myDatabaseHelper.getRandomDish("dinner");
  149.  
  150.             String breakfastName = myDatabaseHelper.getDishNameById(breakfast);
  151.             String lunchName = myDatabaseHelper.getDishNameById(lunch);
  152.             String dinnerName = myDatabaseHelper.getDishNameById(dinner);
  153.  
  154.             breakfastTextView.setText(breakfastName);
  155.             lunchTextView.setText(lunchName);
  156.             dinnerTextView.setText(dinnerName);
  157.             System.out.println("Breakfast: " + breakfast);
  158.             if (breakfast != -1)
  159.             {
  160.                 breakfastTextView.setOnClickListener(v1 -> {
  161.                     int id = breakfast;
  162.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  163.                     intent.putExtra("id", id);
  164.                     startActivity(intent);
  165.                 });
  166.             }
  167.  
  168.             System.out.println("Lunch: " + lunch);
  169.             if (lunch != -1)
  170.             {
  171.                 lunchTextView.setOnClickListener(v2 -> {
  172.                     int id = lunch;
  173.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  174.                     intent.putExtra("id", id);
  175.                     startActivity(intent);
  176.                 });
  177.             }
  178.  
  179.             System.out.println("Dinner: " + dinner);
  180.             if (dinner != -1)
  181.             {
  182.                 dinnerTextView.setOnClickListener(v3 -> {
  183.                     int id = dinner;
  184.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  185.                     intent.putExtra("id", id);
  186.                     startActivity(intent);
  187.                 });
  188.             }
  189.  
  190.             // Save instance state
  191.  
  192. //            setArguments(bundle);
  193.  
  194.         });
  195.  
  196.  
  197.         breakfastButton.setOnClickListener(v -> {
  198.             // Генерируем рандомное блюдо для завтрака
  199.             breakfast = myDatabaseHelper.getRandomDish("breakfast");
  200.             // Получаем имя блюда по его id
  201.             String breakfastName = myDatabaseHelper.getDishNameById(breakfast);
  202.             // Выводим имя блюда на экран
  203.             breakfastTextView.setText(breakfastName);
  204.  
  205.             // Сохраняем информацию в Bundle для передачи в другой фрагмент
  206. //            bundle.putInt("breakfast", breakfast);
  207. //            setArguments(bundle);
  208.  
  209.             if (breakfast != -1)
  210.             {
  211.                 breakfastTextView.setOnClickListener(v1 -> {
  212.                     int id = breakfast;
  213.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  214.                     intent.putExtra("id", id);
  215.                     startActivity(intent);
  216.                 });
  217.  
  218.             }
  219.  
  220.         });
  221.  
  222.         lunchButton.setOnClickListener(v -> {
  223.  
  224.             lunch = myDatabaseHelper.getRandomDish("lunch");
  225.  
  226.             String lunchName = myDatabaseHelper.getDishNameById(lunch);
  227.  
  228.             lunchTextView.setText(lunchName);
  229.  
  230. //            bundle.putInt("lunch", lunch);
  231. //            setArguments(bundle);
  232.  
  233.  
  234.             if (lunch != -1)
  235.             {
  236.                 lunchTextView.setOnClickListener(v2 -> {
  237.                     int id = lunch;
  238.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  239.                     intent.putExtra("id", id);
  240.                     startActivity(intent);
  241.                 });
  242.             }
  243.  
  244.         });
  245.  
  246.         dinnerButton.setOnClickListener(v -> {
  247.             dinner = myDatabaseHelper.getRandomDish("dinner");
  248.             String dinnerName = myDatabaseHelper.getDishNameById(dinner);
  249.             dinnerTextView.setText(dinnerName);
  250.  
  251. //            bundle.putInt("dinner", dinner);
  252. //            setArguments(bundle);
  253.  
  254.  
  255.             if (dinner != -1)
  256.             {
  257.                 dinnerTextView.setOnClickListener(v3 -> {
  258.                     int id = dinner;
  259.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  260.                     intent.putExtra("id", id);
  261.                     startActivity(intent);
  262.                 });
  263.             }
  264.  
  265.         });
  266.  
  267.         restoreDataFromSharedPreferences();
  268.  
  269.         return view;
  270.     }
  271.  
  272.     void connectGooglePlayBilling() {
  273.  
  274.         billingClient.startConnection(new BillingClientStateListener() {
  275.             @Override
  276.             public void onBillingServiceDisconnected() {
  277.                 readyToPurchase = false;
  278.                 connectGooglePlayBilling();
  279.             }
  280.  
  281.             @Override
  282.             public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
  283.                 if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
  284.                     Log.d(TAG, "Connected " + 0);
  285.                     readyToPurchase = true;
  286.                 }
  287.  
  288.             }
  289.         });
  290.  
  291.     }
  292.     void buyProduct(String id) {
  293.  
  294.         List<String> skuList = new ArrayList<>();
  295.  
  296.         //replace these with your product IDs from google play console
  297.         skuList.add(id);
  298.  
  299.         SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
  300.         params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
  301.  
  302.         billingClient.querySkuDetailsAsync(params.build(),
  303.                 new SkuDetailsResponseListener() {
  304.                     @SuppressLint("SetTextI18n")
  305.                     @Override
  306.                     public void onSkuDetailsResponse(BillingResult billingResult,
  307.                                                      List<SkuDetails> skuDetailsList) {
  308.                         // Process the result.
  309.                         if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
  310.  
  311.                             for (SkuDetails skuDetails : skuDetailsList) {
  312.                                 if (skuDetails.getSku().equals(id)) {
  313.                                     BillingFlowParams flowParams = BillingFlowParams.newBuilder()
  314.                                             .setSkuDetails(skuDetails)
  315.                                             .build();
  316.                                     billingClient.launchBillingFlow(getActivity(), flowParams);
  317.                                 }
  318.  
  319.                             }
  320.                         }
  321.  
  322.                     }
  323.                 });
  324.  
  325.     }
  326.  
  327.     void donateWindow()
  328.     {
  329.         Context context = getContext();
  330.         AlertDialog.Builder builder = new AlertDialog.Builder(context);
  331.         builder.setTitle(R.string.donate_title);
  332. //        builder.setMessage(R.string.donate_desc);
  333.         builder.setItems(new CharSequence[]
  334.                         {getString(R.string.donate_one), getString(R.string.donate_two), getString(R.string.donate_five), getString(R.string.donate_ten)},
  335.                 new DialogInterface.OnClickListener() {
  336.                     public void onClick(DialogInterface dialog, int which) {
  337.                         if (!readyToPurchase) {
  338.                             Toast.makeText(context, R.string.donate_not_ready, Toast.LENGTH_SHORT).show();
  339.                             return;
  340.                         }
  341.                         // The 'which' argument contains the index position
  342.                         // of the selected item
  343.                         switch (which) {
  344.                             case 0:
  345.                                 dialog.dismiss();
  346.                                 // Купить товар donate_one
  347. //                                bp.purchase(getActivity(), donate_one);
  348.                                 buyProduct(Constants.donate_one);
  349.  
  350.                                 break;
  351.                             case 1:
  352.                                 dialog.dismiss();
  353. //                                bp.purchase(getActivity(), donate_two);
  354.                                 buyProduct(Constants.donate_two);
  355.  
  356.                                 break;
  357.                             case 2:
  358.                                 dialog.dismiss();
  359. //                                bp.purchase(getActivity(), donate_five);
  360.                                 buyProduct(Constants.donate_five);
  361.  
  362.                                 break;
  363.                             case 3:
  364.                                 dialog.dismiss();
  365. //                                bp.purchase(getActivity(), donate_ten);
  366.                                 buyProduct(Constants.donate_ten);
  367.  
  368.                                 break;
  369.                         }
  370.                     }
  371.                 });
  372.         builder.create().show();
  373.  
  374.     }
  375.  
  376.     void verifyPayment(Purchase purchase) {
  377.  
  378.  
  379.         ConsumeParams consumeParams = ConsumeParams.newBuilder()
  380.                 .setPurchaseToken(purchase.getPurchaseToken())
  381.                 .build();
  382.  
  383.         ConsumeResponseListener listener = new ConsumeResponseListener() {
  384.             @Override
  385.             public void onConsumeResponse(@NonNull BillingResult billingResult, @NonNull String s) {
  386.                 if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
  387.  
  388.                     Log.d(TAG, purchase.getSkus().get(0) + " sku");
  389.  
  390.                     CallThanksDialog();
  391.  
  392.                 }
  393.  
  394.             }
  395.         };
  396.  
  397.         billingClient.consumeAsync(consumeParams, listener);
  398.  
  399.     }
  400.  
  401.  
  402.     @Override
  403.     public void onDestroy() {
  404. //        if (bp != null) {
  405. //            bp.release();
  406. //        }
  407.         super.onDestroy();
  408.     }
  409.  
  410.     public void CallThanksDialog()
  411.     {
  412.         Context context = getContext();
  413.         AlertDialog.Builder builder = new AlertDialog.Builder(context);
  414.         builder.setTitle(R.string.thank_you_title);
  415. //        builder.setMessage(R.string.donate_desc);
  416.         builder.setMessage(R.string.thank_you_desc);
  417.         builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
  418.             @Override
  419.             public void onClick(DialogInterface dialog, int which) {
  420.                 dialog.dismiss();
  421.             }
  422.         });
  423.         builder.create().show();
  424.     }
  425.     //endregion
  426.  
  427.     //region Other
  428.     @Override
  429.     public void onPause()
  430.     {
  431.         super.onPause();
  432.  
  433.         SharedPreferences preferences = requireActivity().getPreferences(MODE_PRIVATE);
  434.         @SuppressLint("CommitPrefEdits") SharedPreferences.Editor editor = preferences.edit();  // Put the values from the UI
  435.         editor.putInt("breakfast", breakfast);
  436.         editor.putInt("lunch", lunch);
  437.         editor.putInt("dinner", dinner);
  438.  
  439.         editor.apply();
  440.     }
  441.  
  442.     void restoreDataFromBundle(Bundle bundle)
  443.     {
  444.         if (bundle != null) {
  445.             if (myDatabaseHelper.hasObject(String.valueOf(bundle.getInt("breakfast", -1))))
  446.             {
  447.                 breakfast = bundle.getInt("breakfast", -1);
  448.                 String breakfastName = myDatabaseHelper.getDishNameById(breakfast);
  449.                 breakfastTextView.setText(breakfastName);
  450.  
  451.                 breakfastTextView.setOnClickListener(v1 -> {
  452.                     int id = breakfast;
  453.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  454.                     intent.putExtra("id", id);
  455.                     startActivity(intent);
  456.                 });
  457.             }
  458.             if (myDatabaseHelper.hasObject(String.valueOf(bundle.getInt("lunch", -1))))
  459.             {
  460.                 lunch = bundle.getInt("lunch", -1);
  461.  
  462.                 String lunchName = myDatabaseHelper.getDishNameById(lunch);
  463.                 lunchTextView.setText(lunchName);
  464.  
  465.                 lunchTextView.setOnClickListener(v2 -> {
  466.                     int id = lunch;
  467.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  468.                     intent.putExtra("id", id);
  469.                     startActivity(intent);
  470.                 });
  471.             }
  472.  
  473.             if (myDatabaseHelper.hasObject(String.valueOf(bundle.getInt("dinner", -1))))
  474.             {
  475.                 dinner = bundle.getInt("dinner", -1);
  476.                 String dinnerName = myDatabaseHelper.getDishNameById(dinner);
  477.                 dinnerTextView.setText(dinnerName);
  478.  
  479.                 dinnerTextView.setOnClickListener(v3 -> {
  480.                     int id = dinner;
  481.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  482.                     intent.putExtra("id", id);
  483.                     startActivity(intent);
  484.                 });
  485.             }
  486.         }
  487.         Log.d(TAG, "restoreDataFromBundle: " + bundle);
  488.     }
  489.  
  490.     void restoreDataFromSharedPreferences()
  491.     {
  492.         SharedPreferences sharedPref = requireActivity().getPreferences(Context.MODE_PRIVATE);
  493.         if (sharedPref != null)
  494.         {
  495.             if (myDatabaseHelper.hasObject(String.valueOf(sharedPref.getInt("breakfast", -1))))
  496.             {
  497.                 breakfast = sharedPref.getInt("breakfast", -1);
  498.                 String breakfastName = myDatabaseHelper.getDishNameById(breakfast);
  499.                 breakfastTextView.setText(breakfastName);
  500.  
  501.                 breakfastTextView.setOnClickListener(v1 -> {
  502.                     int id = breakfast;
  503.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  504.                     intent.putExtra("id", id);
  505.                     startActivity(intent);
  506.                 });
  507.             }
  508.             if (myDatabaseHelper.hasObject(String.valueOf(sharedPref.getInt("lunch", -1))))
  509.             {
  510.                 lunch = sharedPref.getInt("lunch", -1);
  511.  
  512.                 String lunchName = myDatabaseHelper.getDishNameById(lunch);
  513.                 lunchTextView.setText(lunchName);
  514.  
  515.                 lunchTextView.setOnClickListener(v2 -> {
  516.                     int id = lunch;
  517.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  518.                     intent.putExtra("id", id);
  519.                     startActivity(intent);
  520.                 });
  521.             }
  522.  
  523.             if (myDatabaseHelper.hasObject(String.valueOf(sharedPref.getInt("dinner", -1))))
  524.             {
  525.                 dinner = sharedPref.getInt("dinner", -1);
  526.                 String dinnerName = myDatabaseHelper.getDishNameById(dinner);
  527.                 dinnerTextView.setText(dinnerName);
  528.  
  529.                 dinnerTextView.setOnClickListener(v3 -> {
  530.                     int id = dinner;
  531.                     Intent intent = new Intent(getContext(), DetailActivity.class);
  532.                     intent.putExtra("id", id);
  533.                     startActivity(intent);
  534.                 });
  535.             }
  536.         }
  537.  
  538.     }
  539.     @Override
  540.     public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
  541.         super.onViewStateRestored(savedInstanceState);
  542.         Log.d(TAG, "onViewStateRestored: " + savedInstanceState);
  543.         restoreDataFromBundle(savedInstanceState);
  544.     }
  545.  
  546.     @Override
  547.     public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
  548.         MenuInflater menuInflater = requireActivity().getMenuInflater();
  549.         menuInflater.inflate(R.menu.home, menu);
  550.         super.onCreateOptionsMenu(menu, inflater);
  551.     }
  552.  
  553.     @Override
  554.     public boolean onOptionsItemSelected(@NonNull MenuItem item) {
  555.         if (item.getItemId() == R.id.donate_btn)
  556.         {
  557.             donateWindow();
  558.         }
  559.  
  560.         return super.onOptionsItemSelected(item);
  561.     }
  562.  
  563.     @Override
  564.     public void onActivityCreated(@Nullable Bundle savedInstanceState) {
  565.         super.onActivityCreated(savedInstanceState);
  566.         mViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
  567.         // TODO: Use the ViewModel
  568. //        restoreDataFromBundle(savedInstanceState);
  569. //        restoreDataFromBundle(getArguments());
  570.     }
  571.  
  572.     /*@Override
  573.     public void onProductPurchased(@NonNull String productId, @Nullable PurchaseInfo details) {
  574.         if (productId.equals(donate_one) || productId.equals(donate_two) || productId.equals(donate_five) || productId.equals(donate_ten))
  575.         {
  576.             assert details != null;
  577.             if (details.purchaseData.purchaseState.equals(PurchaseState.PurchasedSuccessfully))
  578.             {
  579.                 CallThanksDialog();
  580.             }
  581.         }
  582.         assert details != null;
  583.         Log.d(TAG, "onProductPurchased: " + details.purchaseData.purchaseState);
  584.  
  585.     }
  586.  
  587.     @Override
  588.     public void onPurchaseHistoryRestored() {
  589.         Log.d(TAG, "onPurchaseHistoryRestored: ");
  590.  
  591.     }
  592.  
  593.     @Override
  594.     public void onBillingError(int errorCode, @Nullable Throwable error) {
  595.         AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
  596.         builder.setTitle("Error");
  597.         builder.setMessage("Error code: " + errorCode);
  598.         builder.setPositiveButton("OK", (dialog, which) -> dialog.dismiss());
  599.         builder.show();
  600.     }
  601.  
  602.     @Override
  603.     public void onBillingInitialized() {
  604.         Log.d(TAG, "onBillingInitialized: " + "Billing initialized");
  605.         readyToPurchase = true;
  606.     }*/
  607.  
  608. }
Add Comment
Please, Sign In to add comment