花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e
以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考
package com.huaban.android.modules.main;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.FragmentManager;
import com.afollestad.materialdialogs.f;
import com.bytedance.msdk.api.activity.TTDelegateActivity;
import com.google.android.gms.common.internal.r;
import com.huaban.android.R;
import com.huaban.android.base.BaseActivity;
import com.huaban.android.base.BaseRootTabFragment;
import com.huaban.android.common.Models.HBApps;
import com.huaban.android.common.Models.HBBoard;
import com.huaban.android.common.Models.HBBoardResult;
import com.huaban.android.common.Models.HBConfig;
import com.huaban.android.common.Models.HBExtra;
import com.huaban.android.common.Models.HBPin;
import com.huaban.android.common.Models.HBPinResult;
import com.huaban.android.common.Models.HBUser;
import com.huaban.android.common.Models.HBVersion;
import com.huaban.android.dialog.AddImageDialog;
import com.huaban.android.g.v;
import com.huaban.android.modules.account.login.LoginActivity;
import com.huaban.android.modules.board.BoardFragment;
import com.huaban.android.modules.board.create.BoardEditingActivity;
import com.huaban.android.modules.common.ImageCollectGuideActivity;
import com.huaban.android.modules.discover.DiscoverFragment;
import com.huaban.android.modules.discover.DiscoverPinFragment;
import com.huaban.android.modules.explore.ExploreFragment;
import com.huaban.android.modules.home.HomeFragment;
import com.huaban.android.modules.home.HomePinFragment;
import com.huaban.android.modules.job.JobActivity;
import com.huaban.android.modules.pin.create.CreatePinActivity;
import com.huaban.android.modules.pin.detail.PinDetailFragment;
import com.huaban.android.modules.search.SearchFragment;
import com.huaban.android.modules.search.SearchTabFragment;
import com.huaban.android.modules.splash.SplashActivity;
import com.huaban.android.modules.users.profile.UserFragment;
import com.huaban.android.modules.users.profile.UserViewPagerFragment;
import com.huaban.android.services.PollingService;
import com.huaban.android.views.BottomNavigationBar;
import com.huawei.hms.support.api.entity.core.CommonCode;
import com.umeng.analytics.MobclickAgent;
import com.vector.update_app.service.DownloadService;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.c0;
import kotlin.f0;
import kotlin.f2;
import kotlin.h3.b0;
import kotlin.o2.b1;
import kotlin.o2.x;
import kotlin.q0;
import kotlin.x2.w.k0;
import kotlin.x2.w.m0;
import kotlin.x2.w.w;
import kotlin.z;
import me.yokeyword.fragmentation.SupportFragment;
import org.greenrobot.eventbus.ThreadMode;
import retrofit2.Call;
import retrofit2.Response;
@f0(bv = {1, 0, 3}, d1 = {"\u0000Ú\u0001\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\n\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0000\n\u0002\u0010\u0015\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u0000 \u0081\u00012\u00020\u00012\u00020\u0002:\u0004\u0081\u0001\u0082\u0001B\b¢\u0006\u0005\b\u0080\u0001\u0010\u0005J\u000f\u0010\u0004\u001a\u00020\u0003H\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u000f\u0010\u0006\u001a\u00020\u0003H\u0002¢\u0006\u0004\b\u0006\u0010\u0005J\u0017\u0010\t\u001a\u00020\u00032\u0006\u0010\b\u001a\u00020\u0007H\u0002¢\u0006\u0004\b\t\u0010\nJ\u000f\u0010\u000b\u001a\u00020\u0003H\u0002¢\u0006\u0004\b\u000b\u0010\u0005J\u0017\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\r\u001a\u00020\fH\u0016¢\u0006\u0004\b\u000f\u0010\u0010J\u0017\u0010\u0013\u001a\u00020\u00032\u0006\u0010\u0012\u001a\u00020\u0011H\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u0017\u0010\u0015\u001a\u00020\u00032\u0006\u0010\u0012\u001a\u00020\u0011H\u0002¢\u0006\u0004\b\u0015\u0010\u0014J\u0017\u0010\u0016\u001a\u00020\u00032\u0006\u0010\u0012\u001a\u00020\u0011H\u0002¢\u0006\u0004\b\u0016\u0010\u0014J\u0017\u0010\u0018\u001a\u00020\u00032\u0006\u0010\u0017\u001a\u00020\u0011H\u0002¢\u0006\u0004\b\u0018\u0010\u0014J\u000f\u0010\u0019\u001a\u00020\u0003H\u0002¢\u0006\u0004\b\u0019\u0010\u0005J\u0017\u0010\u001a\u001a\u00020\u00032\u0006\u0010\b\u001a\u00020\u0007H\u0002¢\u0006\u0004\b\u001a\u0010\nJ\u000f\u0010\u001b\u001a\u00020\u0003H\u0002¢\u0006\u0004\b\u001b\u0010\u0005J\u0017\u0010\u001e\u001a\u00020\u000e2\u0006\u0010\u001d\u001a\u00020\u001cH\u0002¢\u0006\u0004\b\u001e\u0010\u001fJ\u0017\u0010\"\u001a\u00020\u00032\u0006\u0010!\u001a\u00020 H\u0007¢\u0006\u0004\b\"\u0010#J\u0017\u0010!\u001a\u00020\u00032\u0006\u0010!\u001a\u00020$H\u0007¢\u0006\u0004\b!\u0010%J\u0017\u0010(\u001a\u00020\u00032\u0006\u0010'\u001a\u00020&H\u0007¢\u0006\u0004\b(\u0010)J)\u0010.\u001a\u00020\u00032\u0006\u0010+\u001a\u00020*2\u0006\u0010,\u001a\u00020*2\b\u0010-\u001a\u0004\u0018\u00010\u0007H\u0014¢\u0006\u0004\b.\u0010/J\u000f\u00100\u001a\u00020\u0003H\u0016¢\u0006\u0004\b0\u0010\u0005J\u0019\u00103\u001a\u00020\u00032\b\u00102\u001a\u0004\u0018\u000101H\u0014¢\u0006\u0004\b3\u00104J\u000f\u00105\u001a\u00020\u0003H\u0014¢\u0006\u0004\b5\u0010\u0005J\u000f\u00106\u001a\u00020\u0003H\u0002¢\u0006\u0004\b6\u0010\u0005J\u0017\u00107\u001a\u00020\u00032\u0006\u0010\b\u001a\u00020\u0007H\u0014¢\u0006\u0004\b7\u0010\nJ\u0017\u0010:\u001a\u00020\u00032\u0006\u00109\u001a\u000208H\u0007¢\u0006\u0004\b:\u0010;J/\u0010@\u001a\u00020\u00032\u0006\u0010+\u001a\u00020*2\u000e\u0010=\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00110<2\u0006\u0010?\u001a\u00020>H\u0016¢\u0006\u0004\b@\u0010AJ\u000f\u0010B\u001a\u00020\u0003H\u0014¢\u0006\u0004\bB\u0010\u0005J\r\u0010C\u001a\u00020\u0003¢\u0006\u0004\bC\u0010\u0005J\u0015\u0010F\u001a\u00020\u00032\u0006\u0010E\u001a\u00020D¢\u0006\u0004\bF\u0010GJ\u0017\u0010I\u001a\u00020\u00032\u0006\u00109\u001a\u00020HH\u0007¢\u0006\u0004\bI\u0010JJ\u000f\u0010K\u001a\u00020\u0003H\u0002¢\u0006\u0004\bK\u0010\u0005J\u001f\u0010P\u001a\u00020\u00032\u0006\u0010M\u001a\u00020L2\u0006\u0010O\u001a\u00020NH\u0002¢\u0006\u0004\bP\u0010QJ\u0017\u0010S\u001a\u00020\u00032\u0006\u00109\u001a\u00020RH\u0007¢\u0006\u0004\bS\u0010TJ\u0015\u0010U\u001a\u00020\u00032\u0006\u0010E\u001a\u00020D¢\u0006\u0004\bU\u0010GR\u0016\u0010V\u001a\u00020\u00118\u0002@\u0002X\u0082D¢\u0006\u0006\n\u0004\bV\u0010WR\u0018\u0010X\u001a\u0004\u0018\u00010L8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bX\u0010YR\u001d\u0010_\u001a\u00020Z8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\b[\u0010\\\u001a\u0004\b]\u0010^R\u001e\u0010a\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010`0<8\u0002@\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\ba\u0010bR\u001d\u0010g\u001a\u00020c8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\bd\u0010\\\u001a\u0004\be\u0010fR\u001d\u0010l\u001a\u00020h8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\bi\u0010\\\u001a\u0004\bj\u0010kR%\u0010r\u001a\n n*\u0004\u0018\u00010m0m8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\bo\u0010\\\u001a\u0004\bp\u0010qR\u001d\u0010w\u001a\u00020s8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\bt\u0010\\\u001a\u0004\bu\u0010vR\u001c\u0010y\u001a\b\u0012\u0004\u0012\u00020D0x8\u0002@\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\by\u0010zR\u001d\u0010\u007f\u001a\u00020{8B@\u0002X\u0082\u0084\u0002¢\u0006\f\n\u0004\b|\u0010\\\u001a\u0004\b}\u0010~¨\u0006\u0083\u0001"}, d2 = {"Lcom/huaban/android/modules/main/MainActivity;", "com/huaban/android/base/BaseRootTabFragment$a", "Lcom/huaban/android/base/BaseActivity;", "", "checkJob", "()V", "checkLicense", "Landroid/content/Intent;", CommonCode.Resolution.HAS_RESOLUTION_FROM_APK, "checkOpenUrlInBrowser", "(Landroid/content/Intent;)V", "checkVersion", "Landroid/view/MotionEvent;", "ev", "", "dispatchTouchEvent", "(Landroid/view/MotionEvent;)Z", "", "id", "gotoBoardDetail", "(Ljava/lang/String;)V", "gotoExploreDetail", "gotoPinDetail", "idString", "gotoUserDetail", "handleMessageAlias", "handlerRouter", "initBottomNavigation", "", "date", "isToday", "(J)Z", "Lcom/huaban/android/common/Services/LoginEvent;", "logoutEvent", "loginEvent", "(Lcom/huaban/android/common/Services/LoginEvent;)V", "Lcom/huaban/android/common/Services/LogoutEvent;", "(Lcom/huaban/android/common/Services/LogoutEvent;)V", "Lcom/huaban/android/common/Services/NeedLoginEvent;", "needLoginEvent", "needLogin", "(Lcom/huaban/android/common/Services/NeedLoginEvent;)V", "", "requestCode", "resultCode", "data", "onActivityResult", "(IILandroid/content/Intent;)V", "onBackToFirstFragment", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "(Landroid/os/Bundle;)V", "onDestroy", "onLogoutTrigger", "onNewIntent", "Lcom/huaban/android/events/MessagesServiceEvent;", "event", "onNewUnreadEvent", "(Lcom/huaban/android/events/MessagesServiceEvent;)V", "", TTDelegateActivity.INTENT_PERMISSIONS, "", "grantResults", "onRequestPermissionsResult", "(I[Ljava/lang/String;[I)V", "onStart", "onUserAddClicked", "Lcom/huaban/android/modules/main/MainActivity$OnMainActivityTouchListener;", r.a.a, "registerTouchListener", "(Lcom/huaban/android/modules/main/MainActivity$OnMainActivityTouchListener;)V", "Lcom/huaban/android/common/Services/NetworkNotAvailableEvent;", "showNetworkNotAvailableError", "(Lcom/huaban/android/common/Services/NetworkNotAvailableEvent;)V", "showSetJob", "Lcom/huaban/android/common/Models/HBVersion;", "versionInfo", "Landroid/content/Context;", "context", "showUpdateDialog", "(Lcom/huaban/android/common/Models/HBVersion;Landroid/content/Context;)V", "Lcom/huaban/android/events/TriggerNavigationBarEvent;", "triggerNavigationBar", "(Lcom/huaban/android/events/TriggerNavigationBarEvent;)V", "unRegisterTouchListener", "SP_KEY_SHOW_SET_JOB_DATE", "Ljava/lang/String;", "mAppVersion", "Lcom/huaban/android/common/Models/HBVersion;", "Lcom/huaban/android/modules/discover/DiscoverFragment;", "mDiscoverFragment$delegate", "Lkotlin/Lazy;", "getMDiscoverFragment", "()Lcom/huaban/android/modules/discover/DiscoverFragment;", "mDiscoverFragment", "Lme/yokeyword/fragmentation/SupportFragment;", "mFragments", "[Lme/yokeyword/fragmentation/SupportFragment;", "Lcom/huaban/android/modules/home/HomeFragment;", "mHomeFragment$delegate", "getMHomeFragment", "()Lcom/huaban/android/modules/home/HomeFragment;", "mHomeFragment", "Lcom/huaban/android/vendors/ImagePickerUtil;", "mImagePickUtil$delegate", "getMImagePickUtil", "()Lcom/huaban/android/vendors/ImagePickerUtil;", "mImagePickUtil", "Lcom/ashokvarma/bottomnavigation/ShapeBadgeItem;", "kotlin.jvm.PlatformType", "mMsgBadgeItem$delegate", "getMMsgBadgeItem", "()Lcom/ashokvarma/bottomnavigation/ShapeBadgeItem;", "mMsgBadgeItem", "Lcom/huaban/android/modules/search/SearchTabFragment;", "mSearchFragment$delegate", "getMSearchFragment", "()Lcom/huaban/android/modules/search/SearchTabFragment;", "mSearchFragment", "", "mTouchEventListenerList", "Ljava/util/List;", "Lcom/huaban/android/modules/users/profile/UserFragment;", "mUserFragment$delegate", "getMUserFragment", "()Lcom/huaban/android/modules/users/profile/UserFragment;", "mUserFragment", "<init>", "Companion", "OnMainActivityTouchListener", "container.HuabanApp_release"}, k = 1, mv = {1, 1, 15}, pn = "", xi = 0, xs = "")
public final class MainActivity extends BaseActivity implements BaseRootTabFragment.a {
private static final int n = 0;
@h.c.a.d
public static final String s = "routerPortal";
private final String c = "SP_KEY_SHOW_SET_JOB_DATE";
private final z f9050d;
private final z f9051e;
private final z f9052f;
private final z f9053g;
private final SupportFragment[] f9054h;
private final z f9055i;
private final z j;
private HBVersion k;
private final List<b> l;
private HashMap m;
@h.c.a.d
public static final a t = new a(null);
private static final int o = 1;
private static final int p = 2;
private static final int q = 3;
private static final int r = 4;
public static final class a {
private a() {
}
public final int a() {
return MainActivity.p;
}
public final int b() {
return MainActivity.o;
}
public final int c() {
return MainActivity.n;
}
public final int d() {
return MainActivity.r;
}
public final int e() {
return MainActivity.q;
}
public a(w wVar) {
this();
}
}
public interface b {
void onTouchEvent(@h.c.a.d MotionEvent motionEvent);
}
static final class c implements f.n {
c() {
}
@Override
public final void a(@h.c.a.d com.afollestad.materialdialogs.f fVar, @h.c.a.d com.afollestad.materialdialogs.b bVar) {
k0.p(fVar, "dialog");
k0.p(bVar, "which");
new com.huaban.android.vendors.l(MainActivity.this).y(com.huaban.android.vendors.l.f9177h.e(), true);
}
}
static final class d implements f.n {
d() {
}
@Override
public final void a(@h.c.a.d com.afollestad.materialdialogs.f fVar, @h.c.a.d com.afollestad.materialdialogs.b bVar) {
k0.p(fVar, "dialog");
k0.p(bVar, "which");
MainActivity.this.finish();
}
}
public static final class e extends m0 implements kotlin.x2.v.p<Throwable, Response<HBConfig>, f2> {
e() {
super(2);
}
public final void a(@h.c.a.e Throwable th, @h.c.a.e Response<HBConfig> response) {
if (th != null || response == null || response.body() == null) {
return;
}
HBConfig body = response.body();
k0.o(body, "response.body()");
if (body.getApps() == null) {
return;
}
MainActivity mainActivity = MainActivity.this;
HBConfig body2 = response.body();
k0.o(body2, "response.body()");
HBApps apps = body2.getApps();
k0.o(apps, "response.body().apps");
mainActivity.k = apps.getAndroid();
HBVersion hBVersion = MainActivity.this.k;
if (hBVersion == null || MainActivity.this.isFinishing()) {
return;
}
String str = MainActivity.this.getPackageManager().getPackageInfo(MainActivity.this.getPackageName(), 0).versionName;
k0.o(str, "packageManager.getPackag… ).versionName");
if (!com.huaban.android.g.o.b(hBVersion, str) || com.huaban.android.g.o.a(hBVersion, MainActivity.this)) {
return;
}
MainActivity mainActivity2 = MainActivity.this;
mainActivity2.E0(hBVersion, mainActivity2);
}
@Override
public f2 invoke(Throwable th, Response<HBConfig> response) {
a(th, response);
return f2.a;
}
}
public static final class f extends m0 implements kotlin.x2.v.p<Throwable, Response<HBBoardResult>, f2> {
f() {
super(2);
}
public final void a(@h.c.a.e Throwable th, @h.c.a.e Response<HBBoardResult> response) {
if (th != null || response == null || response.body() == null) {
return;
}
HBBoardResult body = response.body();
k0.o(body, "response.body()");
if (body.getBoard() != null) {
BoardFragment.a aVar = BoardFragment.Companion;
HBBoardResult body2 = response.body();
k0.o(body2, "response.body()");
HBBoard board = body2.getBoard();
k0.o(board, "response.body().board");
aVar.b(board, MainActivity.this.n0());
}
}
@Override
public f2 invoke(Throwable th, Response<HBBoardResult> response) {
a(th, response);
return f2.a;
}
}
public static final class g<T> implements i.r.b<HBPinResult> {
g() {
}
@Override
public final void call(HBPinResult hBPinResult) {
if (hBPinResult == null || hBPinResult.getPin() == null) {
return;
}
PinDetailFragment.a aVar = PinDetailFragment.Companion;
HomeFragment n0 = MainActivity.this.n0();
HBPin pin = hBPinResult.getPin();
k0.o(pin, "result.pin");
aVar.h(n0, pin);
}
}
public static final class h<T> implements i.r.b<Throwable> {
public static final h a = new h();
h() {
}
@Override
public final void call(Throwable th) {
}
}
public static final class i implements BottomNavigationBar.b {
i() {
}
@Override
public void a(int i2) {
FragmentManager childFragmentManager;
SupportFragment supportFragment = MainActivity.this.f9054h[i2];
int backStackEntryCount = (supportFragment == null || (childFragmentManager = supportFragment.getChildFragmentManager()) == null) ? 1 : childFragmentManager.getBackStackEntryCount();
if (backStackEntryCount <= 1) {
if (backStackEntryCount == 1) {
org.greenrobot.eventbus.c.f().q(new com.huaban.android.f.p(i2));
}
} else if (supportFragment instanceof HomeFragment) {
supportFragment.popToChild(HomePinFragment.class, false);
} else if (supportFragment instanceof DiscoverFragment) {
supportFragment.popToChild(DiscoverPinFragment.class, false);
} else if (supportFragment instanceof UserFragment) {
supportFragment.popToChild(UserViewPagerFragment.class, false);
} else if (supportFragment instanceof SearchTabFragment) {
supportFragment.popToChild(SearchFragment.class, false);
}
}
@Override
public void b(int i2, int i3) {
Map j0;
Context applicationContext = MainActivity.this.getApplicationContext();
String n = com.huaban.android.vendors.p.L0.n();
j0 = b1.j0(new q0("index", String.valueOf(i2)));
MobclickAgent.onEvent(applicationContext, n, j0);
MainActivity mainActivity = MainActivity.this;
mainActivity.G(mainActivity.f9054h[i2], MainActivity.this.f9054h[i3]);
if (i2 == 3) {
MainActivity.this.p0().f();
}
}
@Override
public boolean c(int i2) {
if (i2 == MainActivity.t.d() || i2 == MainActivity.t.a()) {
com.huaban.android.c.a.d p = com.huaban.android.c.a.d.p();
k0.o(p, "HBAuthManager.sharedManager()");
if (!p.i()) {
LoginActivity.f8921f.a(MainActivity.this);
return false;
}
}
return true;
}
@Override
public boolean d(int i2) {
if (i2 == MainActivity.t.a()) {
MainActivity.this.B0();
return true;
}
return false;
}
}
static final class j extends m0 implements kotlin.x2.v.a<DiscoverFragment> {
public static final j a = new j();
j() {
super(0);
}
@Override
@h.c.a.d
public final DiscoverFragment invoke() {
return DiscoverFragment.Companion.a();
}
}
static final class k extends m0 implements kotlin.x2.v.a<HomeFragment> {
public static final k a = new k();
k() {
super(0);
}
@Override
@h.c.a.d
public final HomeFragment invoke() {
return HomeFragment.Companion.a();
}
}
static final class l extends m0 implements kotlin.x2.v.a<com.huaban.android.vendors.d> {
l() {
super(0);
}
@Override
@h.c.a.d
public final com.huaban.android.vendors.d invoke() {
return new com.huaban.android.vendors.d(MainActivity.this);
}
}
static final class m extends m0 implements kotlin.x2.v.a<com.ashokvarma.bottomnavigation.d> {
m() {
super(0);
}
@Override
public final com.ashokvarma.bottomnavigation.d invoke() {
return new com.ashokvarma.bottomnavigation.d().F(0).I(R.color.unread_messages_bg).J(MainActivity.this, 8, 8);
}
}
static final class n extends m0 implements kotlin.x2.v.a<SearchTabFragment> {
public static final n a = new n();
n() {
super(0);
}
@Override
@h.c.a.d
public final SearchTabFragment invoke() {
return SearchTabFragment.Companion.a();
}
}
static final class o extends m0 implements kotlin.x2.v.a<UserFragment> {
public static final o a = new o();
o() {
super(0);
}
@Override
@h.c.a.d
public final UserFragment invoke() {
return UserFragment.Companion.b();
}
}
static final class p extends m0 implements kotlin.x2.v.l<String, f2> {
p() {
super(1);
}
public final void a(@h.c.a.d String str) {
ArrayList<String> r;
k0.p(str, "filePath");
CreatePinActivity.a aVar = CreatePinActivity.B;
MainActivity mainActivity = MainActivity.this;
r = x.r(str);
String string = MainActivity.this.getString(R.string.pin_from_camera);
k0.o(string, "getString(\n … )");
aVar.g(mainActivity, r, string);
}
@Override
public f2 invoke(String str) {
a(str);
return f2.a;
}
}
public static final class q implements AddImageDialog.a {
final AddImageDialog b;
q(AddImageDialog addImageDialog) {
this.b = addImageDialog;
}
@Override
public void a(int i2) {
boolean z;
boolean U1;
boolean z2 = true;
if (i2 == 1) {
MobclickAgent.onEvent(MainActivity.this, com.huaban.android.vendors.p.L0.d0());
com.huaban.android.c.a.d p = com.huaban.android.c.a.d.p();
k0.o(p, "HBAuthManager.sharedManager()");
if (p.i()) {
HBUser c = com.huaban.android.c.a.d.p().c();
String tel = c != null ? c.getTel() : null;
if (tel != null) {
U1 = b0.U1(tel);
if (!U1) {
z2 = false;
}
}
z = z2;
} else {
z = true;
}
com.huaban.android.vendors.d.s(MainActivity.this.o0(), z, false, null, 4, null);
} else if (i2 == 2) {
MobclickAgent.onEvent(MainActivity.this, com.huaban.android.vendors.p.L0.f0());
MainActivity.this.o0().q();
} else if (i2 == 3) {
MobclickAgent.onEvent(MainActivity.this, com.huaban.android.vendors.p.L0.g0());
ImageCollectGuideActivity.f9017d.a(MainActivity.this);
} else if (i2 == 4) {
MobclickAgent.onEvent(MainActivity.this, com.huaban.android.vendors.p.L0.e0());
BoardEditingActivity.a.b(BoardEditingActivity.f8972g, MainActivity.this, null, 2, null);
}
this.b.dismiss();
}
}
public static final class r implements View.OnClickListener {
final Dialog b;
r(Dialog dialog) {
this.b = dialog;
}
@Override
public final void onClick(View view) {
if (DownloadService.f13522i) {
Toast makeText = Toast.makeText(MainActivity.this, "正在下载", 0);
makeText.show();
k0.h(makeText, "Toast\n .makeText(… show()\n }");
return;
}
MainActivity mainActivity = MainActivity.this;
HBVersion hBVersion = mainActivity.k;
String url = hBVersion != null ? hBVersion.getUrl() : null;
HBVersion hBVersion2 = MainActivity.this.k;
com.huaban.android.j.g.b(mainActivity, url, hBVersion2 != null ? hBVersion2.getMd5() : null);
this.b.dismiss();
}
}
public static final class s implements View.OnClickListener {
final HBVersion b;
final Dialog c;
s(HBVersion hBVersion, Dialog dialog) {
this.b = hBVersion;
this.c = dialog;
}
@Override
public final void onClick(View view) {
com.huaban.android.vendors.l lVar = new com.huaban.android.vendors.l(MainActivity.this);
String a = com.huaban.android.vendors.l.f9177h.a();
String version = this.b.getVersion();
k0.o(version, "versionInfo.version");
lVar.w(a, version);
this.c.dismiss();
}
}
public static final class t implements View.OnClickListener {
final Dialog a;
t(Dialog dialog) {
this.a = dialog;
}
@Override
public final void onClick(View view) {
this.a.dismiss();
}
}
public MainActivity() {
z c2;
z c3;
z c4;
z c5;
z c6;
z c7;
c2 = c0.c(o.a);
this.f9050d = c2;
c3 = c0.c(j.a);
this.f9051e = c3;
c4 = c0.c(n.a);
this.f9052f = c4;
c5 = c0.c(k.a);
this.f9053g = c5;
this.f9054h = new SupportFragment[5];
c6 = c0.c(new m());
this.f9055i = c6;
c7 = c0.c(new l());
this.j = c7;
this.l = new ArrayList();
}
private final void A0() {
int mSelectedPosition = ((BottomNavigationBar) N(R.id.bottom_navigation)).getMSelectedPosition();
com.huaban.android.c.a.d p2 = com.huaban.android.c.a.d.p();
k0.o(p2, "HBAuthManager.sharedManager()");
if (p2.i()) {
return;
}
if (mSelectedPosition == q || mSelectedPosition == r) {
((BottomNavigationBar) N(R.id.bottom_navigation)).d(n);
}
}
private final void D0() {
com.huaban.android.vendors.l lVar = new com.huaban.android.vendors.l(this);
long n2 = com.huaban.android.vendors.l.n(lVar, this.c, 0L, 2, null);
if (n2 != 0 || z0(n2)) {
return;
}
lVar.v(this.c, System.currentTimeMillis());
startActivity(new Intent(this, JobActivity.class));
}
public final void E0(HBVersion hBVersion, Context context) {
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dialog_update);
dialog.setCanceledOnTouchOutside(false);
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawableResource(17170445);
}
dialog.show();
View findViewById = dialog.findViewById(R.id.tv_update);
k0.o(findViewById, "dialog.findViewById(R.id.tv_update)");
View findViewById2 = dialog.findViewById(R.id.tv_version);
k0.o(findViewById2, "dialog.findViewById(R.id.tv_version)");
View findViewById3 = dialog.findViewById(R.id.tv_update_info);
k0.o(findViewById3, "dialog.findViewById(R.id.tv_update_info)");
View findViewById4 = dialog.findViewById(R.id.tv_no_tip);
k0.o(findViewById4, "dialog.findViewById(R.id.tv_no_tip)");
View findViewById5 = dialog.findViewById(R.id.tv_cancel);
k0.o(findViewById5, "dialog.findViewById(R.id.tv_cancel)");
((TextView) findViewById2).setText(hBVersion.getVersion());
((TextView) findViewById3).setText(hBVersion.getChangelog());
((TextView) findViewById).setOnClickListener(new r(dialog));
((TextView) findViewById4).setOnClickListener(new s(hBVersion, dialog));
((TextView) findViewById5).setOnClickListener(new t(dialog));
}
private final void i0() {
HBExtra extra;
HBUser c2 = com.huaban.android.c.a.d.p().c();
if (c2 == null || (extra = c2.getExtra()) == null || extra.getJobId() != null) {
return;
}
D0();
}
private final void j0() {
if (new com.huaban.android.vendors.l(this).f(com.huaban.android.vendors.l.f9177h.e(), false)) {
return;
}
WebView webView = new WebView(this);
webView.loadUrl("https://download.huaban.com/docs/privacy-policy/index.html");
new f.e(this).m1("用户协议与隐私政策").J(webView, true).a1("同意并继续").K0("拒绝").I0(R.color.g_40).t(false).U0(new c()).S0(new d()).g1();
}
private final void k0(Intent intent) {
boolean z;
boolean U1;
String stringExtra = intent.getStringExtra(SplashActivity.f9130f.a());
if (stringExtra != null) {
U1 = b0.U1(stringExtra);
if (!U1) {
z = false;
if (z) {
Intent intent2 = new Intent();
intent2.setAction("android.intent.action.VIEW");
intent2.setData(Uri.parse(stringExtra));
startActivity(intent2);
return;
}
return;
}
}
z = true;
if (z) {
}
}
private final void l0() {
Call<HBConfig> a2 = ((com.huaban.android.c.a.a.h) com.huaban.android.c.a.f.k(com.huaban.android.c.a.a.h.class)).a();
k0.o(a2, "HBServiceGenerator.creat…class.java).fetchConfig()");
v.a(a2, new e());
}
private final DiscoverFragment m0() {
return (DiscoverFragment) this.f9051e.getValue();
}
public final HomeFragment n0() {
return (HomeFragment) this.f9053g.getValue();
}
public final com.huaban.android.vendors.d o0() {
return (com.huaban.android.vendors.d) this.j.getValue();
}
public final com.ashokvarma.bottomnavigation.d p0() {
return (com.ashokvarma.bottomnavigation.d) this.f9055i.getValue();
}
private final SearchTabFragment q0() {
return (SearchTabFragment) this.f9052f.getValue();
}
private final UserFragment r0() {
return (UserFragment) this.f9050d.getValue();
}
private final void s0(String str) {
Call<HBBoardResult> e2 = ((com.huaban.android.c.a.a.c) com.huaban.android.c.a.f.k(com.huaban.android.c.a.a.c.class)).e(Long.parseLong(str));
k0.o(e2, "HBServiceGenerator.creat…java).fetchBoard(boardId)");
v.a(e2, new f());
}
private final void t0(String str) {
ExploreFragment.Companion.b(str, n0());
}
private final void u0(String str) {
((com.huaban.android.c.a.a.q) com.huaban.android.c.a.f.k(com.huaban.android.c.a.a.q.class)).x(Long.parseLong(str)).t5(new g(), h.a);
}
private final void v0(String str) {
UserViewPagerFragment.Companion.c(Long.parseLong(str), n0());
}
private final void w0() {
HBExtra extra;
String gdId;
HBUser c2 = com.huaban.android.c.a.d.p().c();
if (c2 != null && (extra = c2.getExtra()) != null && (gdId = extra.getGdId()) != null) {
com.gaoding.shadowinterface.f.a.j().setAlias(gdId);
} else {
com.gaoding.shadowinterface.f.a.j().deleteAlias();
}
}
private final void x0(Intent intent) {
ArrayList r2;
boolean J1;
String stringExtra = intent.getStringExtra(s);
if (stringExtra == null || stringExtra.length() == 0) {
return;
}
Uri parse = Uri.parse(stringExtra);
k0.o(parse, "uri");
String host = parse.getHost();
r2 = x.r("pins", "boards", "explore", "users");
J1 = kotlin.o2.f0.J1(r2, host);
if (J1) {
String str = parse.getPathSegments().get(0);
if (str == null || host == null) {
return;
}
switch (host.hashCode()) {
case -1383797171:
if (host.equals("boards")) {
s0(str);
return;
}
return;
case -1309148525:
if (host.equals("explore")) {
t0(str);
return;
}
return;
case 3441022:
if (host.equals("pins")) {
u0(str);
return;
}
return;
case 111578632:
if (host.equals("users")) {
v0(str);
return;
}
return;
default:
return;
}
}
defpackage.c.a(this, stringExtra);
}
private final void y0() {
((BottomNavigationBar) N(R.id.bottom_navigation)).d(n);
F(this.f9054h[n]);
((BottomNavigationBar) N(R.id.bottom_navigation)).setTabSelectedListener(new i());
}
private final boolean z0(long j2) {
Date date = new Date(j2);
Date date2 = new Date();
return date2.getYear() == date.getYear() && date2.getMonth() == date.getMonth() && date2.getDate() == date.getDate();
}
public final void B0() {
AddImageDialog addImageDialog = new AddImageDialog();
addImageDialog.setOnMenuSelectListener(new q(addImageDialog));
addImageDialog.show(getSupportFragmentManager(), "AddImageDialog");
}
public final void C0(@h.c.a.d b bVar) {
k0.p(bVar, r.a.a);
this.l.add(bVar);
}
public final void F0(@h.c.a.d b bVar) {
k0.p(bVar, r.a.a);
this.l.remove(bVar);
}
@Override
public void M() {
HashMap hashMap = this.m;
if (hashMap != null) {
hashMap.clear();
}
}
@Override
public View N(int i2) {
if (this.m == null) {
this.m = new HashMap();
}
View view = (View) this.m.get(Integer.valueOf(i2));
if (view == null) {
View findViewById = findViewById(i2);
this.m.put(Integer.valueOf(i2), findViewById);
return findViewById;
}
return view;
}
@Override
public boolean dispatchTouchEvent(@h.c.a.d MotionEvent motionEvent) {
k0.p(motionEvent, "ev");
try {
for (b bVar : this.l) {
bVar.onTouchEvent(motionEvent);
}
return super.dispatchTouchEvent(motionEvent);
} catch (IllegalArgumentException e2) {
e2.printStackTrace();
return false;
}
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void loginEvent(@h.c.a.d com.huaban.android.c.a.g gVar) {
HBExtra extra;
String gdId;
k0.p(gVar, "logoutEvent");
HBUser c2 = com.huaban.android.c.a.d.p().c();
if (c2 == null || (extra = c2.getExtra()) == null || (gdId = extra.getGdId()) == null) {
return;
}
com.gaoding.shadowinterface.f.a.j().setAlias(gdId);
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void logoutEvent(@h.c.a.d com.huaban.android.c.a.h hVar) {
k0.p(hVar, "logoutEvent");
A0();
com.gaoding.shadowinterface.f.a.j().deleteAlias();
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void needLogin(@h.c.a.d com.huaban.android.c.a.i iVar) {
k0.p(iVar, "needLoginEvent");
Toast makeText = Toast.makeText(this, "登录信息已过期,请重新登录", 0);
makeText.show();
k0.h(makeText, "Toast\n .makeText(… show()\n }");
S();
}
@Override
public void o() {
((BottomNavigationBar) N(R.id.bottom_navigation)).d(n);
}
@Override
public void onActivityResult(int i2, int i3, @h.c.a.e Intent intent) {
boolean U1;
super.onActivityResult(i2, i3, intent);
if (i2 == com.huaban.android.vendors.d.j.b()) {
if (intent != null) {
CreatePinActivity.B.g(this, o0().l(intent), "");
}
} else if (i2 == com.huaban.android.vendors.d.j.a()) {
if (i3 == -1) {
o0().e(new p());
}
} else if (i2 == CreatePinActivity.B.d()) {
if (i3 == CreatePinActivity.B.e()) {
com.huaban.android.c.a.d p2 = com.huaban.android.c.a.d.p();
k0.o(p2, "HBAuthManager.sharedManager()");
boolean z = true;
if (p2.i()) {
HBUser c2 = com.huaban.android.c.a.d.p().c();
String tel = c2 != null ? c2.getTel() : null;
if (tel != null) {
U1 = b0.U1(tel);
if (!U1) {
z = false;
}
}
}
o0().r(z, false, intent != null ? intent.getStringArrayListExtra(CreatePinActivity.B.a()) : null);
}
} else if (i2 == CreatePinActivity.B.c() && i3 == CreatePinActivity.B.e()) {
o0().q();
}
}
@Override
public void onCreate(@h.c.a.e Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_main);
if (bundle == null) {
this.f9054h[n] = n0();
this.f9054h[o] = m0();
this.f9054h[q] = q0();
this.f9054h[r] = r0();
int i2 = R.id.main_fragments_container;
int i3 = n;
SupportFragment[] supportFragmentArr = this.f9054h;
w(i2, i3, supportFragmentArr[i3], supportFragmentArr[o], supportFragmentArr[q], supportFragmentArr[r]);
} else {
this.f9054h[n] = (SupportFragment) s(HomeFragment.class);
this.f9054h[o] = (SupportFragment) s(DiscoverFragment.class);
this.f9054h[q] = (SupportFragment) s(SearchTabFragment.class);
this.f9054h[r] = (SupportFragment) s(UserFragment.class);
}
y0();
org.greenrobot.eventbus.c.f().v(this);
com.huaban.android.vendors.k.a(this, 10, PollingService.class, PollingService.ACTION);
l0();
Intent intent = getIntent();
k0.o(intent, CommonCode.Resolution.HAS_RESOLUTION_FROM_APK);
k0(intent);
i0();
Intent intent2 = getIntent();
k0.o(intent2, CommonCode.Resolution.HAS_RESOLUTION_FROM_APK);
x0(intent2);
w0();
}
@Override
protected void onDestroy() {
super.onDestroy();
org.greenrobot.eventbus.c.f().A(this);
com.huaban.android.vendors.k.b(this, PollingService.class, PollingService.ACTION);
}
@Override
public void onNewIntent(@h.c.a.d Intent intent) {
k0.p(intent, CommonCode.Resolution.HAS_RESOLUTION_FROM_APK);
super.onNewIntent(intent);
x0(intent);
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void onNewUnreadEvent(@h.c.a.d com.huaban.android.f.f fVar) {
k0.p(fVar, "event");
if (((BottomNavigationBar) N(R.id.bottom_navigation)).getMSelectedPosition() != r) {
p0().p();
}
}
@Override
public void onRequestPermissionsResult(int i2, @h.c.a.d String[] strArr, @h.c.a.d int[] iArr) {
k0.p(strArr, TTDelegateActivity.INTENT_PERMISSIONS);
k0.p(iArr, "grantResults");
super.onRequestPermissionsResult(i2, strArr, iArr);
o0().o(i2, strArr, iArr);
}
@Override
public void onStart() {
super.onStart();
A0();
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void showNetworkNotAvailableError(@h.c.a.d com.huaban.android.c.a.j jVar) {
k0.p(jVar, "event");
es.dmoral.toasty.b.t(this, "网络无法连接,请检查你的网络设置", 0, true).show();
}
@org.greenrobot.eventbus.l(threadMode = ThreadMode.MAIN)
public final void triggerNavigationBar(@h.c.a.d com.huaban.android.f.q qVar) {
k0.p(qVar, "event");
if (qVar.d()) {
BottomNavigationBar bottomNavigationBar = (BottomNavigationBar) N(R.id.bottom_navigation);
k0.o(bottomNavigationBar, "bottom_navigation");
bottomNavigationBar.setVisibility(0);
return;
}
BottomNavigationBar bottomNavigationBar2 = (BottomNavigationBar) N(R.id.bottom_navigation);
k0.o(bottomNavigationBar2, "bottom_navigation");
bottomNavigationBar2.setVisibility(8);
}
}