Ruiyuanjb v2.7.0版本的 MD5 值为:45f663f003665a0ca2d09dcbec30071a
以下内容为反编译后的 QrCodeParseUtil.java 源代码,内容仅作参考
package im.mvtqiwsorf.ui.utils;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import im.mvtqiwsorf.messenger.AndroidUtilities;
import im.mvtqiwsorf.messenger.ChatObject;
import im.mvtqiwsorf.messenger.FileLog;
import im.mvtqiwsorf.messenger.LocaleController;
import im.mvtqiwsorf.messenger.MessagesController;
import im.mvtqiwsorf.messenger.MessagesStorage;
import im.mvtqiwsorf.messenger.NotificationCenter;
import im.mvtqiwsorf.messenger.R;
import im.mvtqiwsorf.messenger.SharedConfig;
import im.mvtqiwsorf.messenger.UserConfig;
import im.mvtqiwsorf.messenger.UserObject;
import im.mvtqiwsorf.messenger.Utilities;
import im.mvtqiwsorf.messenger.browser.Browser;
import im.mvtqiwsorf.tgnet.ConnectionsManager;
import im.mvtqiwsorf.tgnet.RequestDelegate;
import im.mvtqiwsorf.tgnet.TLObject;
import im.mvtqiwsorf.tgnet.TLRPC;
import im.mvtqiwsorf.ui.ChatActivity;
import im.mvtqiwsorf.ui.DialogsActivity;
import im.mvtqiwsorf.ui.LaunchActivity;
import im.mvtqiwsorf.ui.WebviewActivity;
import im.mvtqiwsorf.ui.actionbar.ActionBarLayout;
import im.mvtqiwsorf.ui.actionbar.AlertDialog;
import im.mvtqiwsorf.ui.actionbar.BaseFragment;
import im.mvtqiwsorf.ui.components.AlertsCreator;
import im.mvtqiwsorf.ui.components.JoinGroupAlert;
import im.mvtqiwsorf.ui.components.toast.ToastUtils;
import im.mvtqiwsorf.ui.fragments.BaseFmts;
import im.mvtqiwsorf.ui.hui.chats.NewProfileActivity;
import im.mvtqiwsorf.ui.hui.contacts.AddContactsInfoActivity;
import java.util.ArrayList;
public class QrCodeParseUtil {
public static void tryParseQrCode(Object obj, int i, String str, boolean z, boolean z2, boolean z3, boolean z4) {
tryParseQrCode(obj, i, str, true, z, z2, true, false, z3, z4);
}
public static void tryParseQrCode(Object obj, int i, String str, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7) {
String queryParameter;
String str2;
String str3;
String str4;
String str5;
checkHost(obj);
if (TextUtils.isEmpty(str)) {
return;
}
Uri parse = Uri.parse(str);
String lowerCase = parse.getScheme() != null ? parse.getScheme().toLowerCase() : "";
String str6 = getMessagesController(i).sharePrefix;
Uri parse2 = !TextUtils.isEmpty(str6) ? Uri.parse(str6) : null;
String host = parse2 != null ? parse2.getHost() : null;
if ("http".equals(lowerCase) || "https".equals(lowerCase)) {
String host2 = parse.getHost();
if (host2.equals("www.shareinstall.com.cn")) {
String queryParameter2 = parse.getQueryParameter("Key");
if (!TextUtils.isEmpty(queryParameter2)) {
String str7 = new String(Base64.decode(queryParameter2.replace("%3D", "="), 0));
String[] split = str7.split("#");
String str8 = split[0].split("=")[1];
String str9 = split[1].split("=")[1];
if (str7.contains("Uname")) {
tryToGroupOrChannelByUserName(obj, split[2].split("=")[1]);
} else {
tryToUser(obj, i, true, str8, str9, z2, z3);
}
}
} else if (host2.equals("m12345.cc") || host2.equals(host)) {
if (!TextUtils.isEmpty(str6)) {
String str10 = str6 + "&Key=";
if (str.startsWith(str10)) {
String str11 = new String(Base64.decode(str.substring(str10.length()).replace("%3D", "="), 0));
String[] split2 = str11.split("#");
String str12 = split2[0].split("=")[1];
String str13 = split2[1].split("=")[1];
if (str11.contains("Uname")) {
tryToGroupOrChannelByUserName(obj, split2[2].split("=")[1]);
} else {
tryToUser(obj, i, true, str12, str13, z2, z3);
}
}
}
String path = parse.getPath();
if (path != null && path.length() > 1) {
String substring = path.substring(1);
if (substring.startsWith("login/")) {
str4 = substring.replace("login/", "");
str2 = null;
str5 = null;
} else if (substring.startsWith("joinchat/")) {
str5 = substring.replace("joinchat/", "");
str4 = null;
str2 = null;
} else {
if (substring.startsWith("g/") || substring.startsWith("u/")) {
String str14 = new String(Base64.decode(str.substring(str.lastIndexOf("/") + 1), 0));
if (substring.startsWith("g/")) {
tryToGroupOrChannelByUserName(obj, str14.substring(str14.lastIndexOf("/") + 1));
return;
} else {
String[] split3 = str14.substring(0, str14.length() - 4).split("&", 2);
tryToUser(obj, i, true, split3[0], split3[1], z2, z3);
return;
}
}
if (substring.startsWith("authtoken/")) {
return;
}
if (substring.startsWith("socks")) {
Browser.openUrl(getContext(obj), str, z7);
return;
}
ArrayList arrayList = new ArrayList(parse.getPathSegments());
if (arrayList.size() > 0 && ((String) arrayList.get(0)).equals("s")) {
arrayList.remove(0);
}
String str15 = arrayList.size() > 0 ? (String) arrayList.get(0) : null;
String queryParameter3 = parse.getQueryParameter(TtmlNode.START);
queryParameter = parse.getQueryParameter("startgroup");
str2 = str15;
str3 = queryParameter3;
str4 = null;
str5 = null;
if (str4 == null || str2 != null || str5 != null || str3 != null || queryParameter != null) {
runLinkRequest(obj, i, true, str4, str2, str5, str3, queryParameter, z2, z3, z4, z5, 0);
return;
}
}
str3 = null;
queryParameter = null;
if (str4 == null) {
}
runLinkRequest(obj, i, true, str4, str2, str5, str3, queryParameter, z2, z3, z4, z5, 0);
return;
}
}
if (z6) {
if (SharedConfig.customTabs) {
presentFragment(obj, new WebviewActivity(str, (String) null), false, z3);
} else {
Browser.openUrl(getContext(host2), str, z7);
}
}
}
}
public static void runLinkRequest(final Object obj, final int i, final boolean z, final String str, final String str2, final String str3, final String str4, final String str5, final boolean z2, final boolean z3, final boolean z4, final boolean z5, int i2) {
AlertDialog alertDialog;
final int i3;
final AlertDialog alertDialog2;
final int i4 = 0;
if (str != null) {
if (NotificationCenter.getGlobalInstance().hasObservers(NotificationCenter.didReceiveSmsCode)) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveSmsCode, str);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(obj));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("OtherLoginCode", R.string.OtherLoginCode, str)));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(obj, builder.create());
return;
}
final AlertDialog alertDialog3 = z ? new AlertDialog(getContext(obj), 3) : null;
if (str2 != null) {
TLRPC.TL_contacts_resolveUsername tL_contacts_resolveUsername = new TLRPC.TL_contacts_resolveUsername();
tL_contacts_resolveUsername.username = str2;
i4 = ConnectionsManager.getInstance(i).sendRequest(tL_contacts_resolveUsername, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
QrCodeParseUtil.lambda$null$1(AlertDialog.this, tLObject, tL_error, r4, r5, r6, r7, r8, r9, r10, r11);
}
});
}
});
} else if (str3 != null) {
if (i2 == 0) {
TLRPC.TL_messages_checkChatInvite tL_messages_checkChatInvite = new TLRPC.TL_messages_checkChatInvite();
tL_messages_checkChatInvite.hash = str3;
alertDialog = alertDialog3;
i4 = ConnectionsManager.getInstance(i).sendRequest(tL_messages_checkChatInvite, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
QrCodeParseUtil.lambda$null$4(AlertDialog.this, tL_error, r3, tLObject, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15);
}
});
}
}, 2);
} else {
alertDialog = alertDialog3;
if (i2 == 1) {
TLRPC.TL_messages_importChatInvite tL_messages_importChatInvite = new TLRPC.TL_messages_importChatInvite();
tL_messages_importChatInvite.hash = str3;
i3 = i;
alertDialog2 = alertDialog;
ConnectionsManager.getInstance(i).sendRequest(tL_messages_importChatInvite, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
QrCodeParseUtil.lambda$runLinkRequest$7(i3, alertDialog2, obj, tLObject, tL_error);
}
}, 2);
if (i4 == 0 || !z) {
return;
}
alertDialog2.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ConnectionsManager.getInstance(i3).cancelRequest(i4, true);
}
});
try {
alertDialog2.show();
return;
} catch (Exception unused) {
return;
}
}
}
i3 = i;
alertDialog2 = alertDialog;
if (i4 == 0) {
return;
} else {
return;
}
}
i3 = i;
alertDialog2 = alertDialog3;
if (i4 == 0) {
}
}
public static void lambda$null$1(AlertDialog alertDialog, TLObject tLObject, TLRPC.TL_error tL_error, final Object obj, final int i, final String str, final boolean z, final boolean z2, final boolean z3, final boolean z4, String str2) {
int i2;
if (alertDialog != null) {
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
TLRPC.TL_contacts_resolvedPeer tL_contacts_resolvedPeer = (TLRPC.TL_contacts_resolvedPeer) tLObject;
if (tL_error == null && getActionLayout(obj) != null) {
boolean z5 = false;
MessagesController.getInstance(i).putUsers(tL_contacts_resolvedPeer.users, false);
MessagesController.getInstance(i).putChats(tL_contacts_resolvedPeer.chats, false);
MessagesStorage.getInstance(i).putUsersAndChats(tL_contacts_resolvedPeer.users, tL_contacts_resolvedPeer.chats, false, true);
if (str != null) {
final TLRPC.User user = !tL_contacts_resolvedPeer.users.isEmpty() ? tL_contacts_resolvedPeer.users.get(0) : null;
if (user == null || (user.bot && user.bot_nochats)) {
try {
ToastUtils.show(R.string.BotCantJoinGroups);
return;
} catch (Exception e2) {
FileLog.e(e2);
return;
}
}
Bundle bundle = new Bundle();
bundle.putBoolean("onlySelect", true);
bundle.putInt("dialogsType", 2);
bundle.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupTitle", R.string.AddToTheGroupTitle, UserObject.getName(user), "%1$s"));
DialogsActivity dialogsActivity = new DialogsActivity(bundle);
dialogsActivity.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override
public final void didSelectDialogs(DialogsActivity dialogsActivity2, ArrayList arrayList, CharSequence charSequence, boolean z6) {
QrCodeParseUtil.lambda$null$0(i, obj, user, str, z, z2, z3, z4, dialogsActivity2, arrayList, charSequence, z6);
}
});
presentFragment(obj, dialogsActivity, z, z2, z3, z4);
return;
}
Bundle bundle2 = new Bundle();
if (!tL_contacts_resolvedPeer.chats.isEmpty()) {
bundle2.putInt("chat_id", tL_contacts_resolvedPeer.chats.get(0).id);
i2 = -tL_contacts_resolvedPeer.chats.get(0).id;
} else {
bundle2.putInt("user_id", tL_contacts_resolvedPeer.users.get(0).id);
i2 = tL_contacts_resolvedPeer.users.get(0).id;
}
long j = i2;
if (str2 != null && tL_contacts_resolvedPeer.users.size() > 0 && tL_contacts_resolvedPeer.users.get(0).bot) {
bundle2.putString("botUser", str2);
z5 = true;
}
BaseFragment lastFragment = getLastFragment(obj);
if (lastFragment == null || MessagesController.getInstance(i).checkCanOpenChat(bundle2, lastFragment)) {
if (z5 && (lastFragment instanceof ChatActivity)) {
ChatActivity chatActivity = (ChatActivity) lastFragment;
if (chatActivity.getDialogId() == j) {
chatActivity.setBotUser(str2);
return;
}
}
presentFragment(obj, new ChatActivity(bundle2), z, z2);
return;
}
return;
}
try {
AlertsCreator.createSimpleAlert(getContext(obj), LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist)).show();
} catch (Exception e3) {
FileLog.e(e3);
}
}
public static void lambda$null$0(int i, Object obj, TLRPC.User user, String str, boolean z, boolean z2, boolean z3, boolean z4, DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z5) {
long longValue = ((Long) arrayList.get(0)).longValue();
Bundle bundle = new Bundle();
bundle.putBoolean("scrollToTopOnResume", true);
int i2 = -((int) longValue);
bundle.putInt("chat_id", i2);
if (MessagesController.getInstance(i).checkCanOpenChat(bundle, getLastFragment(obj))) {
MessagesController.getInstance(i).addUserToChat(i2, user, null, 0, str, null, null);
presentFragment(obj, new ChatActivity(bundle), z, z2, z3, z4);
}
}
public static void lambda$null$4(AlertDialog alertDialog, TLRPC.TL_error tL_error, final Object obj, TLObject tLObject, final int i, final String str, final boolean z, final String str2, final String str3, final String str4, final String str5, final boolean z2, final boolean z3, final boolean z4, final boolean z5) {
if (alertDialog != null) {
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
if (tL_error == null && getActionLayout(obj) != null) {
TLRPC.ChatInvite chatInvite = (TLRPC.ChatInvite) tLObject;
if (chatInvite.chat != null && (!ChatObject.isLeftFromChat(chatInvite.chat) || (!chatInvite.chat.kicked && !TextUtils.isEmpty(chatInvite.chat.username)))) {
MessagesController.getInstance(i).putChat(chatInvite.chat, false);
ArrayList<TLRPC.Chat> arrayList = new ArrayList<>();
arrayList.add(chatInvite.chat);
MessagesStorage.getInstance(i).putUsersAndChats(null, arrayList, false, true);
Bundle bundle = new Bundle();
bundle.putInt("chat_id", chatInvite.chat.id);
if (MessagesController.getInstance(i).checkCanOpenChat(bundle, getLastFragment(obj))) {
presentFragment(obj, new ChatActivity(bundle), false, true, true, false);
return;
}
return;
}
if (((chatInvite.chat == null && (!chatInvite.channel || chatInvite.megagroup)) || (chatInvite.chat != null && (!ChatObject.isChannel(chatInvite.chat) || chatInvite.chat.megagroup))) && !getActionLayout(obj).fragmentsStack.isEmpty()) {
BaseFragment lastFragment = getLastFragment(obj);
lastFragment.showDialog(new JoinGroupAlert(getContext(obj), chatInvite, str, lastFragment));
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(obj));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
Object[] objArr = new Object[1];
objArr[0] = chatInvite.chat != null ? chatInvite.chat.title : chatInvite.title;
builder.setMessage(LocaleController.formatString("ChannelJoinTo", R.string.ChannelJoinTo, objArr));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
QrCodeParseUtil.runLinkRequest(obj, i, z, str2, str3, str, str4, str5, z2, z3, z4, z5, 1);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(obj, builder.create());
return;
}
AlertDialog.Builder builder2 = new AlertDialog.Builder(getContext(obj));
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (tL_error.text.startsWith("FLOOD_WAIT")) {
builder2.setMessage(LocaleController.getString("FloodWait", R.string.FloodWait));
} else {
builder2.setMessage(LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
}
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(obj, builder2.create());
}
public static void lambda$runLinkRequest$7(final int i, final AlertDialog alertDialog, final Object obj, final TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tL_error == null) {
MessagesController.getInstance(i).processUpdates((TLRPC.Updates) tLObject, false);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
QrCodeParseUtil.lambda$null$6(AlertDialog.this, tL_error, obj, tLObject, i);
}
});
}
public static void lambda$null$6(AlertDialog alertDialog, TLRPC.TL_error tL_error, Object obj, TLObject tLObject, int i) {
if (alertDialog != null) {
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
if (tL_error == null) {
if (getActionLayout(obj) != null) {
TLRPC.Updates updates = (TLRPC.Updates) tLObject;
if (updates.chats.isEmpty()) {
return;
}
TLRPC.Chat chat = updates.chats.get(0);
chat.left = false;
chat.kicked = false;
MessagesController.getInstance(i).putUsers(updates.users, false);
MessagesController.getInstance(i).putChats(updates.chats, false);
Bundle bundle = new Bundle();
bundle.putInt("chat_id", chat.id);
if (MessagesController.getInstance(i).checkCanOpenChat(bundle, getLastFragment(obj))) {
presentFragment(obj, new ChatActivity(bundle), false, true, true, false);
return;
}
return;
}
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(obj));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (tL_error.text.startsWith("FLOOD_WAIT")) {
builder.setMessage(LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (tL_error.text.equals("USERS_TOO_MUCH")) {
builder.setMessage(LocaleController.getString("JoinToGroupErrorFull", R.string.JoinToGroupErrorFull));
} else {
builder.setMessage(LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(obj, builder.create());
}
private static void tryToGroupOrChannelByUserName(Object obj, String str) {
MessagesController.getInstance(UserConfig.selectedAccount).openByUserName(str, getLastFragment(obj), 1, true);
}
private static void tryToUser(final Object obj, final int i, boolean z, String str, String str2, final boolean z2, final boolean z3) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return;
}
TLRPC.TL_user tL_user = new TLRPC.TL_user();
tL_user.id = Utilities.parseInt(str).intValue();
tL_user.access_hash = Utilities.parseLong(str2).longValue();
TLRPC.UserFull userFull = getMessagesController(i).getUserFull(tL_user.id);
if (userFull != null) {
toUser(obj, i, true, userFull, z2, z3);
return;
}
TLRPC.TL_users_getFullUser tL_users_getFullUser = new TLRPC.TL_users_getFullUser();
tL_users_getFullUser.id = getMessagesController(i).getInputUser(tL_user);
AlertDialog alertDialog = null;
if (z) {
alertDialog = new AlertDialog(getContext(obj), 3);
showDialog(obj, alertDialog);
}
final int sendRequest = getConnectionsManager(i).sendRequest(tL_users_getFullUser, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
QrCodeParseUtil.lambda$null$9(TLRPC.TL_error.this, r2, r3, tLObject, r5, r6);
}
});
}
});
if (alertDialog != null) {
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
QrCodeParseUtil.getConnectionsManager(i).cancelRequest(sendRequest, false);
}
});
}
}
public static void lambda$null$9(TLRPC.TL_error tL_error, Object obj, int i, TLObject tLObject, boolean z, boolean z2) {
if (tL_error == null) {
toUser(obj, i, false, (TLRPC.UserFull) tLObject, z, z2);
} else {
ToastUtils.show(R.string.NoUsernameFound);
}
}
private static void toUser(Object obj, int i, boolean z, TLRPC.UserFull userFull, boolean z2, boolean z3) {
getMessagesController(i).putUser(userFull.user, false);
if (userFull.user.self || userFull.user.contact) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", userFull.user.id);
presentFragment(obj, new NewProfileActivity(bundle), z2, z3);
} else {
Bundle bundle2 = new Bundle();
bundle2.putInt("from_type", 1);
presentFragment(obj, new AddContactsInfoActivity(bundle2, userFull.user), z2, z3);
}
}
private static void presentFragment(Object obj, BaseFragment baseFragment, boolean z, boolean z2) {
presentFragment(obj, baseFragment, z, z2, true, false);
}
private static void presentFragment(Object obj, BaseFragment baseFragment, boolean z, boolean z2, boolean z3, boolean z4) {
ActionBarLayout actionLayout;
if (baseFragment == null || (actionLayout = getActionLayout(obj)) == null) {
return;
}
actionLayout.presentFragment(baseFragment, z, z2, z3, z4);
}
private static MessagesController getMessagesController(int i) {
return MessagesController.getInstance(i);
}
private static MessagesStorage getMessagesStorage(int i) {
return MessagesStorage.getInstance(i);
}
private static ConnectionsManager getConnectionsManager(int i) {
return ConnectionsManager.getInstance(i);
}
private static Dialog showDialog(Object obj, Dialog dialog) {
if (dialog == null) {
return null;
}
if (obj instanceof BaseFragment) {
return ((BaseFragment) obj).showDialog(dialog);
}
if (obj instanceof BaseFmts) {
return ((BaseFmts) obj).showDialog(dialog);
}
if ((obj instanceof LaunchActivity) && (dialog instanceof AlertDialog)) {
return ((LaunchActivity) obj).showAlertDialog((AlertDialog) dialog);
}
dialog.show();
return dialog;
}
private static void checkHost(Object obj) {
if (!(obj instanceof BaseFragment) && !(obj instanceof BaseFmts) && !(obj instanceof Activity) && !(obj instanceof Fragment) && !(obj instanceof View) && !(obj instanceof Context)) {
throw new IllegalArgumentException("host must be one of the BaseFragment, BaseFmts, Activity, Fragment, View");
}
}
private static BaseFragment getLastFragment(Object obj) {
ActionBarLayout actionLayout = getActionLayout(obj);
if (actionLayout != null) {
return actionLayout.getLastFragment();
}
return null;
}
private static ActionBarLayout getActionLayout(Object obj) {
if (obj instanceof BaseFragment) {
return ((BaseFragment) obj).getParentLayout();
}
if (obj instanceof BaseFmts) {
return ((BaseFmts) obj).getActionBarLayout();
}
if (obj instanceof LaunchActivity) {
return ((LaunchActivity) obj).getActionBarLayout();
}
if (obj instanceof ActionBarLayout) {
return (ActionBarLayout) obj;
}
return null;
}
private static Context getContext(Object obj) {
if (obj instanceof BaseFragment) {
return ((BaseFragment) obj).getParentActivity();
}
if (obj instanceof BaseFmts) {
return ((BaseFmts) obj).getParentActivity();
}
if (obj instanceof Activity) {
return (Activity) obj;
}
if (obj instanceof Fragment) {
return ((Fragment) obj).getActivity();
}
if (obj instanceof View) {
return ((View) obj).getContext();
}
if (obj instanceof Context) {
return (Context) obj;
}
return null;
}
}