导航菜单

页面标题

页面副标题

Petal Maps v4.7.0.310001 - OverallWidgetReceiver.java 源代码

正在查看: Petal Maps v4.7.0.310001 应用的 OverallWidgetReceiver.java JAVA 源代码文件

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


package com.huawei.maps.app.petalmaps.widget;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;
import com.huawei.maps.app.R;
import com.huawei.maps.app.petalmaps.splash.SplashActivity;
import com.huawei.maps.businessbase.applink.AppLinkHelper;
import com.huawei.maps.businessbase.report.util.SettingBIReportUtil;
import com.huawei.secure.android.common.intent.IntentUtils;
import com.huawei.secure.android.common.intent.SafeIntent;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class OverallWidgetReceiver extends BaseWidgetReceiver {

    @Retention(RetentionPolicy.SOURCE)
    public @interface ItemType {
        public static final int GAS = 5;
        public static final int HOME = 1;
        public static final int HOTEL = 3;
        public static final int RESTAURANT = 4;
        public static final int SEARCH = 6;
        public static final int WORK = 2;
    }

    public final SafeIntent a(Context context, int i) {
        SafeIntent safeIntent = new SafeIntent(new Intent(context, (Class<?>) SplashActivity.class));
        safeIntent.setAction("android.intent.action.MAIN");
        safeIntent.addFlags(335544320);
        String str = "petalmaps://";
        switch (i) {
            case 1:
                str = "petalmaps://showPage?page=desktopExpressCommute&daddr=home";
                break;
            case 2:
                str = "petalmaps://showPage?page=desktopExpressCommute&daddr=company";
                break;
            case 3:
                str = "petalmaps://textSearch?text=" + context.getString(R.string.phrase_hotels);
                break;
            case 4:
                str = "petalmaps://textSearch?text=" + context.getString(R.string.resturant);
                break;
            case 5:
                str = "petalmaps://textSearch?text=" + context.getString(R.string.chargingstation);
                break;
            case 6:
                str = "petalmaps://showPage?page=search";
                AppLinkHelper.p().O(true);
                break;
        }
        Uri parse = Uri.parse(str);
        if (c55.e(parse.toString()).booleanValue()) {
            safeIntent.setData(parse);
        }
        return safeIntent;
    }

    @SuppressLint({"UnspecifiedImmutableFlag"})
    public final PendingIntent b(Context context, int i) {
        SafeIntent safeIntent = new SafeIntent(new Intent());
        safeIntent.setClass(context, getWidgetReceiver());
        safeIntent.addCategory("android.intent.category.ALTERNATIVE");
        safeIntent.putExtra("key_type", i);
        return PendingIntent.getBroadcast(context, i, safeIntent, 201326592);
    }

    @Override
    public int getImageResource() {
        return 0;
    }

    @Override
    public int getLayoutId() {
        return 0;
    }

    @Override
    public String getTextName(Context context) {
        return null;
    }

    @Override
    public int getType() {
        return 4;
    }

    @Override
    public SafeIntent getWidgetIntent(Context context, Intent intent) {
        int safeGetIntExtra = IntentUtils.safeGetIntExtra(new SafeIntent(intent), "key_type", 0);
        hm4.p("OverallWidgetReceiver", "getWidgetIntent type:" + safeGetIntExtra);
        if (safeGetIntExtra != 0) {
            SettingBIReportUtil.t(safeGetIntExtra);
        }
        return a(context, safeGetIntExtra);
    }

    @Override
    public Class<? extends BaseWidgetReceiver> getWidgetReceiver() {
        return OverallWidgetReceiver.class;
    }

    @Override
    public void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int i) {
        hm4.p("OverallWidgetReceiver", "updateAppWidget");
        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.layout_overall_widget);
        remoteViews.setOnClickPendingIntent(R.id.home, b(context, 1));
        remoteViews.setOnClickPendingIntent(R.id.work, b(context, 2));
        remoteViews.setOnClickPendingIntent(R.id.hotel, b(context, 3));
        remoteViews.setOnClickPendingIntent(R.id.restaurants, b(context, 4));
        remoteViews.setOnClickPendingIntent(R.id.gas, b(context, 5));
        remoteViews.setOnClickPendingIntent(R.id.search, b(context, 6));
        remoteViews.setTextViewText(R.id.text_search, context.getString(R.string.search_hi));
        remoteViews.setTextViewText(R.id.tv_home, context.getString(R.string.home_address));
        remoteViews.setTextViewText(R.id.tv_work, context.getString(R.string.company_address));
        remoteViews.setTextViewText(R.id.tv_hotel, context.getString(R.string.phrase_hotels));
        remoteViews.setTextViewText(R.id.tv_restau, context.getString(R.string.resturant));
        remoteViews.setTextViewText(R.id.tv_gas, context.getString(R.string.chargingstation));
        appWidgetManager.updateAppWidget(i, remoteViews);
    }
}