APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Exported Icon Pack
版本号:1.0
包名称:ginlemon.iconpackstudio.exported

MD5 校验值:fb6e23fdb724aab8923e2df3c62d34cc

反编译源代码说明

MainActivity.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package ginlemon.iconpackstudio.exported;

import android.animation.Animator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import org.json.JSONException;
import org.json.JSONObject;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u0000 \u00182\u00020\u0001:\u0001\u0018B\u0005¢\u0006\u0002\u0010\u0002J\u0018\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0004H\u0002J\n\u0010\u000f\u001a\u0004\u0018\u00010\u0010H\u0002J\u0012\u0010\u0011\u001a\u00020\r2\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0016J\u0012\u0010\u0014\u001a\u00020\r2\b\u0010\u0015\u001a\u0004\u0018\u00010\u0010H\u0002J\b\u0010\u0016\u001a\u00020\rH\u0002J\b\u0010\u0017\u001a\u00020\rH\u0002R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u001a\u0010\t\u001a\u00020\u0004X\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u0006\"\u0004\b\u000b\u0010\b¨\u0006\u0019"}, d2 = {"Lginlemon/iconpackstudio/exported/MainActivity;", "Landroid/app/Activity;", "()V", "startButton", "Landroid/widget/TextView;", "getStartButton", "()Landroid/widget/TextView;", "setStartButton", "(Landroid/widget/TextView;)V", "themeNameTextView", "getThemeNameTextView", "setThemeNameTextView", "animateEntrance", "", "themeName", "getThemeName", "", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "setLauncher", "launcherPackageName", "showApplyDialog", "showInstructions", "Companion", "Exported Icon Pack_release"}, k = 1, mv = {1, 1, 16})
public final class MainActivity extends Activity {

    public static final Companion INSTANCE = new Companion(null);
    private HashMap _$_findViewCache;
    public TextView startButton;
    public TextView themeNameTextView;

    public void _$_clearFindViewByIdCache() {
        HashMap hashMap = this._$_findViewCache;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public View _$_findCachedViewById(int i) {
        if (this._$_findViewCache == null) {
            this._$_findViewCache = new HashMap();
        }
        View view = (View) this._$_findViewCache.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this._$_findViewCache.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final TextView getThemeNameTextView() {
        TextView textView = this.themeNameTextView;
        if (textView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("themeNameTextView");
        }
        return textView;
    }

    public final void setThemeNameTextView(TextView textView) {
        Intrinsics.checkParameterIsNotNull(textView, "<set-?>");
        this.themeNameTextView = textView;
    }

    public final TextView getStartButton() {
        TextView textView = this.startButton;
        if (textView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("startButton");
        }
        return textView;
    }

    public final void setStartButton(TextView textView) {
        Intrinsics.checkParameterIsNotNull(textView, "<set-?>");
        this.startButton = textView;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        Object obj;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        View findViewById = findViewById(R.id.themeName);
        Intrinsics.checkExpressionValueIsNotNull(findViewById, "findViewById(R.id.themeName)");
        this.themeNameTextView = (TextView) findViewById;
        View findViewById2 = findViewById(R.id.startButton);
        Intrinsics.checkExpressionValueIsNotNull(findViewById2, "findViewById(R.id.startButton)");
        this.startButton = (TextView) findViewById2;
        TextView textView = this.themeNameTextView;
        if (textView == null) {
            Intrinsics.throwUninitializedPropertyAccessException("themeNameTextView");
        }
        textView.setText(getThemeName());
        Companion companion = INSTANCE;
        Context applicationContext = getApplicationContext();
        Intrinsics.checkExpressionValueIsNotNull(applicationContext, "applicationContext");
        final String currentLauncher = companion.getCurrentLauncher(applicationContext);
        List<LauncherInfo> launchersInfo = LauncherDataProvider.getLauncherList();
        Intrinsics.checkExpressionValueIsNotNull(launchersInfo, "launchersInfo");
        Iterator<T> it = launchersInfo.iterator();
        while (true) {
            if (!it.hasNext()) {
                obj = null;
                break;
            } else {
                obj = it.next();
                if (Intrinsics.areEqual(((LauncherInfo) obj).getPackagename(), currentLauncher)) {
                    break;
                }
            }
        }
        LauncherInfo launcherInfo = (LauncherInfo) obj;
        if (launcherInfo != null && launcherInfo.getSupportApply()) {
            TextView textView2 = this.startButton;
            if (textView2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("startButton");
            }
            textView2.setText(R.string.apply);
            TextView textView3 = this.startButton;
            if (textView3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("startButton");
            }
            textView3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.this.setLauncher(currentLauncher);
                }
            });
        } else {
            TextView textView4 = this.startButton;
            if (textView4 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("startButton");
            }
            textView4.setText(R.string.how_to_apply);
            TextView textView5 = this.startButton;
            if (textView5 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("startButton");
            }
            textView5.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MainActivity.this.showInstructions();
                }
            });
        }
        TextView textView6 = this.themeNameTextView;
        if (textView6 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("themeNameTextView");
        }
        TextView textView7 = this.startButton;
        if (textView7 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("startButton");
        }
        animateEntrance(textView6, textView7);
    }

    public final void showInstructions() {
        startActivity(new Intent(this, (Class<?>) InstructionActivity.class));
    }

    private final void animateEntrance(final TextView themeName, final TextView startButton) {
        ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
        Intrinsics.checkExpressionValueIsNotNull(ofFloat, "ValueAnimator.ofFloat(0.0f, 1f)");
        ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public final void onAnimationUpdate(ValueAnimator animation) {
                Intrinsics.checkExpressionValueIsNotNull(animation, "animation");
                Object animatedValue = animation.getAnimatedValue();
                if (animatedValue == null) {
                    throw new TypeCastException("null cannot be cast to non-null type kotlin.Float");
                }
                float floatValue = ((Float) animatedValue).floatValue();
                themeName.setAlpha(floatValue);
                startButton.setAlpha(floatValue);
            }
        });
        ofFloat.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animation) {
                Intrinsics.checkParameterIsNotNull(animation, "animation");
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
                Intrinsics.checkParameterIsNotNull(animation, "animation");
            }

            @Override
            public void onAnimationStart(Animator animation) {
                Intrinsics.checkParameterIsNotNull(animation, "animation");
                themeName.setAlpha(0.0f);
                startButton.setAlpha(0.0f);
                themeName.setVisibility(0);
                startButton.setVisibility(0);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                Intrinsics.checkParameterIsNotNull(animation, "animation");
                animation.removeListener(this);
            }
        });
        ofFloat.setStartDelay(300L);
        ofFloat.setDuration(400L);
        ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
        ofFloat.start();
    }

    private final String getThemeName() {
        InputStream openRawResource = getResources().openRawResource(R.raw.config);
        Intrinsics.checkExpressionValueIsNotNull(openRawResource, "resources.openRawResource(R.raw.config)");
        StringWriter stringWriter = new StringWriter();
        char[] cArr = new char[1024];
        try {
            try {
                try {
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(openRawResource, "UTF-8"));
                    Ref.IntRef intRef = new Ref.IntRef();
                    while (true) {
                        int read = bufferedReader.read(cArr);
                        intRef.element = read;
                        if (read == -1) {
                            break;
                        }
                        stringWriter.write(cArr, 0, intRef.element);
                    }
                    openRawResource.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } catch (UnsupportedEncodingException e2) {
                e2.printStackTrace();
                openRawResource.close();
            } catch (IOException e3) {
                e3.printStackTrace();
                openRawResource.close();
            }
            try {
                return new JSONObject(stringWriter.toString()).getString("name");
            } catch (JSONException e4) {
                e4.printStackTrace();
                return null;
            }
        } catch (Throwable th) {
            try {
                openRawResource.close();
            } catch (IOException e5) {
                e5.printStackTrace();
            }
            throw th;
        }
    }

    private final void showApplyDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Custom_Dialogs);
        View inflate = LayoutInflater.from(getBaseContext()).inflate(R.layout.dialog_choose, (ViewGroup) null);
        builder.setView(inflate);
        View findViewById = inflate.findViewById(R.id.list);
        if (findViewById == null) {
            throw new TypeCastException("null cannot be cast to non-null type android.widget.ListView");
        }
        ListView listView = (ListView) findViewById;
        listView.setDivider((Drawable) null);
        final LauncherAdapter launcherAdapter = new LauncherAdapter(getBaseContext());
        listView.setAdapter((ListAdapter) launcherAdapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                MainActivity.this.setLauncher(launcherAdapter.getItem(i).getPackagename());
                MainActivity.this.finish();
            }
        });
        listView.getLayoutParams().height = (launcherAdapter.getCount() * LauncherAdapter.ROW_HEIGHT) + listView.getPaddingBottom() + listView.getPaddingTop();
        Intrinsics.checkExpressionValueIsNotNull(builder.show(), "builder.show()");
    }

    public final void setLauncher(String launcherPackageName) {
        if (launcherPackageName != null) {
            try {
                switch (launcherPackageName.hashCode()) {
                    case -2132330677:
                        if (launcherPackageName.equals("com.gtp.nextlauncher")) {
                            Intent launchIntentForPackage = getPackageManager().getLaunchIntentForPackage("com.gtp.nextlauncher");
                            if (launchIntentForPackage != null) {
                                Intent intent = new Intent("com.gau.go.launcherex.MyThemes.mythemeaction");
                                intent.putExtra("type", 1);
                                intent.putExtra("pkgname", getPackageName());
                                sendBroadcast(intent);
                                Toast.makeText(getBaseContext(), getResources().getString(R.string.finish_apply), 1).show();
                                startActivity(launchIntentForPackage);
                                return;
                            }
                            return;
                        }
                        break;
                    case -2118074130:
                        break;
                    case -2007978005:
                        break;
                    case -1927182389:
                        if (launcherPackageName.equals("com.anddoes.launcher")) {
                            Intent intent2 = new Intent("com.anddoes.launcher.SET_THEME");
                            intent2.putExtra("com.anddoes.launcher.THEME_PACKAGE_NAME", getPackageName());
                            intent2.addFlags(268435456);
                            startActivity(intent2);
                            Toast.makeText(getBaseContext(), getResources().getString(R.string.finish_apply), 1).show();
                            return;
                        }
                        break;
                    case -1802756527:
                        if (launcherPackageName.equals("com.teslacoilsw.launcher")) {
                            Intent intent3 = new Intent("com.teslacoilsw.launcher.APPLY_ICON_THEME");
                            intent3.setPackage("com.teslacoilsw.launcher");
                            intent3.putExtra("com.teslacoilsw.launcher.extra.ICON_THEME_TYPE", "GO");
                            intent3.putExtra("com.teslacoilsw.launcher.extra.ICON_THEME_PACKAGE", getPackageName());
                            startActivity(intent3);
                            return;
                        }
                        break;
                    case -1200313060:
                        if (launcherPackageName.equals("com.mobint.hololauncher")) {
                            Intent intent4 = new Intent("android.intent.action.MAIN");
                            intent4.setComponent(new ComponentName("com.mobint.hololauncher", "com.mobint.hololauncher.SettingsActivity"));
                            startActivity(intent4);
                            Toast.makeText(getBaseContext(), getResources().getString(R.string.finish_holo_apply), 1).show();
                            return;
                        }
                        break;
                    case -1108312268:
                        if (launcherPackageName.equals("ch.deletescape.lawnchair.plah")) {
                            Intent intent5 = new Intent("ch.deletescape.lawnchair.APPLY_ICONS");
                            intent5.putExtra("packageName", getPackageName());
                            startActivity(intent5);
                            return;
                        }
                        break;
                    case -572875294:
                        if (launcherPackageName.equals("com.actionlauncher.playstore")) {
                            Intent launchIntentForPackage2 = getPackageManager().getLaunchIntentForPackage("com.actionlauncher.playstore");
                            if (launchIntentForPackage2 != null) {
                                launchIntentForPackage2.putExtra("apply_icon_pack", getPackageName());
                                startActivity(launchIntentForPackage2);
                                return;
                            }
                            return;
                        }
                        break;
                    case -196839399:
                        if (launcherPackageName.equals("com.gau.go.launcherex")) {
                            Intent launchIntentForPackage3 = getPackageManager().getLaunchIntentForPackage("com.gau.go.launcherex");
                            if (launchIntentForPackage3 != null) {
                                Intent intent6 = new Intent("com.gau.go.launcherex.MyThemes.mythemeaction");
                                intent6.putExtra("type", 1);
                                intent6.putExtra("pkgname", getPackageName());
                                sendBroadcast(intent6);
                                Toast.makeText(getBaseContext(), getResources().getString(R.string.finish_apply), 1).show();
                                startActivity(launchIntentForPackage3);
                                return;
                            }
                            return;
                        }
                        break;
                    case 1081213710:
                        if (launcherPackageName.equals("com.tul.aviate")) {
                            Intent intent7 = new Intent("com.tul.aviate.SET_THEME");
                            intent7.putExtra("THEME_PACKAGE", getPackageName());
                            intent7.addFlags(268435456);
                            startActivity(intent7);
                            return;
                        }
                        break;
                    case 2146427492:
                        if (launcherPackageName.equals("org.adw.launcher")) {
                            Intent intent8 = new Intent("org.adw.launcher.SET_THEME");
                            intent8.putExtra("org.adw.launcher.theme.NAME", getPackageName());
                            try {
                                startActivity(intent8);
                            } catch (ActivityNotFoundException unused) {
                            }
                            finish();
                            return;
                        }
                        break;
                }
            } catch (ActivityNotFoundException unused2) {
                return;
            }
        }
        new Intent("android.intent.action.MAIN").setPackage(launcherPackageName);
        Toast.makeText(this, "Please set manually this icon pack in your launcher. We cannot do it automatically.", 1).show();
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, d2 = {"Lginlemon/iconpackstudio/exported/MainActivity$Companion;", "", "()V", "getCurrentLauncher", "", "context", "Landroid/content/Context;", "Exported Icon Pack_release"}, k = 1, mv = {1, 1, 16})
    public static final class Companion {
        private Companion() {
        }

        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final String getCurrentLauncher(Context context) {
            ActivityInfo activityInfo;
            Intrinsics.checkParameterIsNotNull(context, "context");
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 65536);
            if (resolveActivity == null || (activityInfo = resolveActivity.activityInfo) == null) {
                return null;
            }
            return activityInfo.packageName;
        }
    }
}