翰林优商.apk(点击下载) / AdActivity.java


package com.sigmob.sdk.base.common;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.czhj.sdk.common.ClientMetadata;
import com.czhj.sdk.common.Constants;
import com.czhj.sdk.logger.SigmobLog;
import com.sigmob.sdk.base.models.BaseAdUnit;
import com.sigmob.sdk.base.models.IntentActions;
import com.sigmob.sdk.mraid.k;
import com.sigmob.sdk.nativead.s;
import com.sigmob.sdk.nativead.u;
import com.sigmob.sdk.videoAd.BaseAdActivity;
import com.sigmob.sdk.videoAd.l;
import java.lang.reflect.Field;
import java.util.HashMap;

public class AdActivity extends BaseAdActivity implements h {
    private g h;
    private String i;

    private g a(BaseAdUnit baseAdUnit, Bundle bundle) throws IllegalStateException {
        String stringExtra = getIntent().getStringExtra("ad_view_class_name");
        stringExtra.hashCode();
        char c = 65535;
        switch (stringExtra.hashCode()) {
            case -1961669118:
                if (stringExtra.equals(BaseAdActivity.d)) {
                    c = 0;
                    break;
                }
                break;
            case -1552818374:
                if (stringExtra.equals(BaseAdActivity.a)) {
                    c = 1;
                    break;
                }
                break;
            case -959624923:
                if (stringExtra.equals(BaseAdActivity.e)) {
                    c = 2;
                    break;
                }
                break;
            case -934326481:
                if (stringExtra.equals("reward")) {
                    c = 3;
                    break;
                }
                break;
            case 104156535:
                if (stringExtra.equals("mraid")) {
                    c = 4;
                    break;
                }
                break;
        }
        switch (c) {
            case 0:
                return new u(this, baseAdUnit, getIntent().getExtras(), bundle, this.i, this);
            case 1:
                return new s(this, baseAdUnit, getIntent().getExtras(), bundle, this.i, this);
            case 2:
                return new s(this, baseAdUnit, getIntent().getExtras(), bundle, this.i, this);
            case 3:
                return new l(this, baseAdUnit, getIntent().getExtras(), bundle, this.i, this);
            case 4:
                return new k(this, baseAdUnit, getIntent().getExtras(), bundle, this.i, this);
            default:
                return null;
        }
    }

    private static String a(Intent intent) {
        return intent.getStringExtra(Constants.BROADCAST_IDENTIFIER_KEY);
    }

    private static void a(Context context) {
        InputMethodManager inputMethodManager;
        if (context != null) {
            try {
                inputMethodManager = (InputMethodManager) context.getSystemService("input_method");
            } catch (Throwable th) {
                SigmobLog.e(th.getMessage());
                inputMethodManager = null;
            }
            if (inputMethodManager != null) {
                Field[] declaredFields = inputMethodManager.getClass().getDeclaredFields();
                for (Field field : declaredFields) {
                    try {
                        if (!field.isAccessible()) {
                            field.setAccessible(true);
                        }
                        Object obj = field.get(inputMethodManager);
                        if (obj != null) {
                            if (obj instanceof View) {
                                field.set(inputMethodManager, null);
                            }
                        }
                    } catch (Throwable th2) {
                        SigmobLog.e(th2.getMessage());
                    }
                }
            }
        }
    }

    @Override // com.sigmob.sdk.base.common.h
    public void a() {
        finish();
        overridePendingTransition(0, 0);
    }

    @Override // com.sigmob.sdk.base.common.h
    public void a(int i2) {
        setRequestedOrientation(i2);
    }

    @Override // com.sigmob.sdk.base.common.h
    public void a(Class<? extends Activity> cls, int i2, Bundle bundle) {
        if (cls != null) {
            try {
                startActivityForResult(q.a(this, cls, bundle), i2);
            } catch (Throwable unused) {
                SigmobLog.d("Activity " + cls.getName() + " not found. Did you declare it in your AndroidManifest.xml?");
            }
        }
    }

    /* access modifiers changed from: protected */
    public void onActivityResult(int i2, int i3, Intent intent) {
        g gVar = this.h;
        if (gVar != null) {
            gVar.a(i2, i3, intent);
        }
    }

    @Override // com.sigmob.sdk.base.common.h
    public void onBackPressed() {
        g gVar = this.h;
        if (gVar != null && gVar.g()) {
            super.onBackPressed();
            this.h.f();
        }
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        g gVar = this.h;
        if (gVar != null) {
            gVar.a(configuration);
        }
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        SigmobLog.i("TaskId :" + getTaskId());
        this.i = a(getIntent());
        String stringExtra = getIntent().getStringExtra("adUnit_requestId_key");
        try {
            if (ClientMetadata.getInstance() != null) {
                if (!TextUtils.isEmpty(stringExtra)) {
                    BaseAdUnit a = d.a(stringExtra);
                    if (this.i.equals("dislike_broadcastIdentifier") || a != null) {
                        g a2 = a(a, bundle);
                        this.h = a2;
                        if (a2 != null) {
                            a2.b();
                            return;
                        }
                        return;
                    }
                    HashMap hashMap = new HashMap();
                    hashMap.put("playAdUnit", "playAdUnit is null");
                    BaseBroadcastReceiver.a(this, this.i, hashMap, IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL);
                    finish();
                    return;
                }
            }
            HashMap hashMap2 = new HashMap();
            hashMap2.put("error", "uuid is empty");
            BaseBroadcastReceiver.a(this, this.i, hashMap2, IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL);
            finish();
        } catch (Throwable th) {
            SigmobLog.e("AdActivity onCreate Throwable:" + th.getMessage());
            HashMap hashMap3 = new HashMap();
            hashMap3.put("error", th.getMessage());
            BaseBroadcastReceiver.a(this, this.i, hashMap3, IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL);
            finish();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.sigmob.sdk.videoAd.BaseAdActivity
    public void onDestroy() {
        SigmobLog.d("RewardVideoAdPlayerActivity onDestroy() called");
        g gVar = this.h;
        if (gVar != null) {
            gVar.e();
        }
        this.h = null;
        super.onDestroy();
    }

    /* access modifiers changed from: protected */
    public void onPause() {
        try {
            super.onPause();
            g gVar = this.h;
            if (gVar != null) {
                gVar.c();
            }
        } catch (Throwable th) {
            SigmobLog.e(th.getMessage());
            HashMap hashMap = new HashMap();
            hashMap.put("error", th.getMessage());
            BaseBroadcastReceiver.a(this, this.i, hashMap, IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL);
            finish();
        }
    }

    /* access modifiers changed from: protected */
    public void onResume() {
        try {
            super.onResume();
            g gVar = this.h;
            if (gVar != null) {
                gVar.d();
            }
        } catch (Throwable th) {
            HashMap hashMap = new HashMap();
            hashMap.put("error", th.getMessage());
            BaseBroadcastReceiver.a(this, this.i, hashMap, IntentActions.ACTION_REWARDED_VIDEO_PLAYFAIL);
            finish();
        }
    }

    /* access modifiers changed from: protected */
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        g gVar = this.h;
        if (gVar != null) {
            gVar.a(bundle);
        }
    }

    @Override // com.sigmob.sdk.base.common.h
    public void onSetContentView(View view) {
        setContentView(view);
    }

    public void setRequestedOrientation(int i2) {
        try {
            super.setRequestedOrientation(i2);
        } catch (Exception e) {
            SigmobLog.e("setRequestedOrientation: " + e.getMessage());
        }
    }
}