导航菜单

页面标题

页面副标题

Hyouka private v5.8.9 - RateGetFragment.java 源代码

正在查看: Hyouka private v5.8.9 应用的 RateGetFragment.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.beint.project.screens.settings.free.minutes;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.lifecycle.h;
import com.beint.project.MainApplication;
import com.beint.project.core.model.http.ServiceResult;
import com.beint.project.core.services.impl.ZangiHTTPServices;
import com.beint.project.core.utils.Log;
import com.beint.project.screens.BaseScreen;
import n0.a;

public class RateGetFragment extends BaseScreen {
    private static final String TAG = "com.beint.project.screens.settings.free.minutes.RateGetFragment";
    private TextView freeMinutesTextId;
    private Button rateButton;

    public RateGetFragment() {
        setScreenId(TAG);
        setScreenType(BaseScreen.SCREEN_TYPE.RATE_GET_FRAGMENT);
    }

    public void rateApplication() {
        try {
            getActivity().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://play.google.com/store/apps/details?id=" + getActivity().getPackageName())));
        } catch (ActivityNotFoundException e) {
            Log.i("TAB MORE", e.getMessage());
        }
    }

    public void rateUserPromotions() {
        new AsyncTask<Void, Void, ServiceResult<Boolean>>() {
            ServiceResult<Boolean> serviceResult;

            @Override
            public ServiceResult<Boolean> doInBackground(Void... voidArr) {
                ServiceResult<Boolean> rateUserPromotions = ZangiHTTPServices.getInstance().rateUserPromotions(false);
                this.serviceResult = rateUserPromotions;
                return rateUserPromotions;
            }

            @Override
            public void onPostExecute(ServiceResult<Boolean> serviceResult) {
                super.onPostExecute((AnonymousClass2) serviceResult);
                if (serviceResult == null || serviceResult.getBody() == null) {
                    RateGetFragment.this.showInfoMessage(2131887052);
                } else if (((Boolean) serviceResult.getBody()).toString().equals("true")) {
                    RateGetFragment.this.rateApplication();
                } else {
                    RateGetFragment.this.showInfoMessage(2131887052);
                }
            }
        }.executeOnExecutor(MainApplication.Companion.getRequestServiceExecutor(), new Void[0]);
    }

    @Override
    public a getDefaultViewModelCreationExtras() {
        return h.a(this);
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(2131558691, viewGroup, false);
        this.rateButton = (Button) inflate.findViewById(2131363389);
        this.freeMinutesTextId = (TextView) inflate.findViewById(2131362568);
        this.rateButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                RateGetFragment.this.rateUserPromotions();
                RateGetFragment.this.rateApplication();
            }
        });
        return inflate;
    }
}