OssLicensesMenuActivity样式

问题描述 投票:1回答:1

我在我的应用上使用的是从play-services-pluginsinclude Open Source Notices的Google库。

我可以毫无问题地实施它,但是我不知道如何设置显示许可证的活动的样式。

在我的代码中,我通过调用startActivity(Intent(this, OssLicensesMenuActivity::class.java))开始活动>

由于OssLicensesMenuActivity是一个Activity类,所以我设法这样设计:styles.xml:

<style name="LicensesTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimaryDark</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

AndroidManifest.xml:

<activity
    android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
    android:theme="@style/LicensesTheme" />

这就像一个咒语,但是此活动仅显示我正在使用的所有库。还有第二个活动显示许可证,这是我不知道如何设置样式的活动。我面临的问题是OssLicensesMenuActivity中的代码被混淆了,我找不到我想要设置样式的活动类的名称和程序包。

任何人都知道我可以解决这个问题吗?

为了更容易检查,来自OssLicensesMenuActivity的模糊代码如下:

package com.google.android.gms.oss.licenses;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.content.res.Resources.NotFoundException;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.internal.oss_licenses.zzc;
import com.google.android.gms.oss.licenses.R.id;
import com.google.android.gms.oss.licenses.R.layout;
import com.google.android.gms.tasks.Task;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public final class OssLicensesMenuActivity extends AppCompatActivity implements LoaderCallbacks<List<zzc>> {
    private static String zzx;
    private ListView zzy;
    private ArrayAdapter<zzc> zzz;
    private boolean zzaa;
    private zze zzp;
    private Task<String> zzab;
    private com.google.android.gms.oss.licenses.zzc zzo;

    public OssLicensesMenuActivity() {
    }

    @KeepForSdk
    protected final void onCreate(@Nullable Bundle var1) {
        super.onCreate(var1);
        this.zzo = com.google.android.gms.oss.licenses.zzc.zza(this);
        this.zzaa = fileExistsAndNotEmpty(this, "third_party_licenses") && fileExistsAndNotEmpty(this, "third_party_license_metadata");
        Intent var3;
        if (zzx == null && (var3 = this.getIntent()).hasExtra("title")) {
            zzx = var3.getStringExtra("title");
            Log.w("OssLicensesMenuActivity", "The intent based title is deprecated. Use OssLicensesMenuActivity.setActivityTitle(title) instead.");
        }

        if (zzx != null) {
            this.setTitle(zzx);
        }

        if (this.getSupportActionBar() != null) {
            this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }

        if (this.zzaa) {
            zzh var10001 = com.google.android.gms.oss.licenses.zzc.zza(this).zzb();
            String var4 = this.getPackageName();
            zzh var2 = var10001;
            this.zzab = var10001.doRead(new zzk(var2, var4));
            this.getSupportLoaderManager().initLoader(54321, (Bundle)null, this);
            this.zzab.addOnCompleteListener(new zzp(this));
        } else {
            this.setContentView(layout.license_menu_activity_no_licenses);
        }
    }

    public static void setActivityTitle(@NonNull String var0) {
        zzx = var0;
    }

    @VisibleForTesting(
        otherwise = 2
    )
    @KeepForSdk
    static boolean fileExistsAndNotEmpty(@NonNull Context var0, @NonNull String var1) {
        InputStream var2 = null;

        try {
            Resources var3;
            String var4 = (var3 = var0.getResources()).getResourcePackageName(id.license_list);
            boolean var5 = (var2 = var3.openRawResource(var3.getIdentifier(var1, "raw", var4))).available() > 0;
            return var5;
        } catch (IOException | NotFoundException var13) {
        } finally {
            if (var2 != null) {
                try {
                    var2.close();
                } catch (IOException var12) {
                }
            }

        }

        return false;
    }

    @KeepForSdk
    public final boolean onOptionsItemSelected(MenuItem var1) {
        if (var1.getItemId() == 16908332) {
            this.finish();
            return true;
        } else {
            return super.onOptionsItemSelected(var1);
        }
    }

    @KeepForSdk
    public final void onDestroy() {
        this.getSupportLoaderManager().destroyLoader(54321);
        super.onDestroy();
    }

    @KeepForSdk
    public final Loader<List<zzc>> onCreateLoader(int var1, Bundle var2) {
        return this.zzaa ? new zzo(this, com.google.android.gms.oss.licenses.zzc.zza(this)) : null;
    }

    @KeepForSdk
    public final void onLoadFinished(Loader<List<zzc>> var1, List<zzc> var2) {
        this.zzz.clear();
        this.zzz.addAll(var2);
        this.zzz.notifyDataSetChanged();
    }

    @KeepForSdk
    public final void onLoaderReset(Loader<List<zzc>> var1) {
        this.zzz.clear();
        this.zzz.notifyDataSetChanged();
    }

    private class zza extends ArrayAdapter<zzc> {
        zza(Context var2) {
            OssLicensesMenuActivity.this.zzo;
            int var10002 = com.google.android.gms.oss.licenses.zzc.zza(OssLicensesMenuActivity.this.zzp);
            OssLicensesMenuActivity.this.zzo;
            super(var2, var10002, com.google.android.gms.oss.licenses.zzc.zzb(OssLicensesMenuActivity.this.zzp), new ArrayList());
        }

        public final View getView(int var1, View var2, ViewGroup var3) {
            if (var2 == null) {
                OssLicensesMenuActivity.this.zzo;
                LayoutInflater var10000 = OssLicensesMenuActivity.this.getLayoutInflater();
                zze var6 = OssLicensesMenuActivity.this.zzp;
                LayoutInflater var4 = var10000;
                XmlResourceParser var7 = var6.zzg.getXml(com.google.android.gms.oss.licenses.zzc.zza(var6));
                var2 = var4.inflate(var7, var3, false);
            }

            OssLicensesMenuActivity.this.zzo;
            ((TextView)var2.findViewById(com.google.android.gms.oss.licenses.zzc.zzb(OssLicensesMenuActivity.this.zzp))).setText(((zzc)this.getItem(var1)).toString());
            return var2;
        }
    }
}

我正在使用一个名为play-services-plugins的Google库在我的应用程序中包含“开源通知”。我可以毫无问题地实现它,但是我不知道如何设置显示......>

android android-studio google-play-services android-theme android-styles
1个回答
0
投票

只需对清单中的“ OssLicensesMenuActivity”进行相同的操作即可。“>

    <activity android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
            android:theme="@style/LicensesTheme" />

这应设置“显示许可证的第二项活动”的样式。

© www.soinside.com 2019 - 2024. All rights reserved.