Remove some classes which are never instanced by only used for instanceof checks.

This commit is contained in:
B. Petersen
2016-11-14 14:30:01 +01:00
parent c8f1c82fa9
commit 774d18de46
9 changed files with 20 additions and 48 deletions
@@ -16,11 +16,11 @@ public class ChatObject {
public static final int CHAT_TYPE_BROADCAST = 1;
public static boolean isLeftFromChat(TLRPC.Chat chat) {
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.left || chat.deactivated;
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat.left || chat.deactivated;
}
public static boolean isNotInChat(TLRPC.Chat chat) {
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat instanceof TLRPC.TL_chatForbidden || chat instanceof TLRPC.TL_channelForbidden || chat.left || chat.kicked || chat.deactivated;
return chat == null || chat instanceof TLRPC.TL_chatEmpty || chat.left || chat.kicked || chat.deactivated;
}
public static boolean isChannel(TLRPC.Chat chat) {
@@ -901,7 +901,7 @@ public class LocaleController {
return getString("Online", R.string.Online);
}
}
if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) || user instanceof TLRPC.TL_userEmpty) {
if (user == null || user.status == null || user.status.expires == 0 || UserObject.isDeleted(user) ) {
return getString("ALongTimeAgo", R.string.ALongTimeAgo);
} else {
int currentTime = ConnectionsManager.getInstance().getCurrentTime();
@@ -222,7 +222,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public static TLRPC.InputPeer getInputPeer(int id) {
TLRPC.InputPeer inputPeer;
if (id < 0) {
/*if (id < 0) {
TLRPC.Chat chat = getInstance().getChat(-id);
if (ChatObject.isChannel(chat)) {
inputPeer = new TLRPC.TL_inputPeerChannel();
@@ -232,7 +232,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
inputPeer = new TLRPC.TL_inputPeerChat();
inputPeer.chat_id = -id;
}
} else {
} else */ {
TLRPC.User user = getInstance().getUser(id);
inputPeer = new TLRPC.TL_inputPeerUser();
inputPeer.user_id = id;
@@ -80,7 +80,7 @@ public class MrMailbox {
ret.media_unread = ret.unread;
ret.flags = 0; // posible flags: MESSAGE_FLAG_HAS_FROM_ID, however, this seems to be read only
ret.post = false; // ? true=avatar wird in gruppen nicht angezeigt, wird aber in isFromUser() auch überprüft...
ret.out = ret.from_id==1; // true=outgoing message, read eg. in MessageObject.isOutOwner()
ret.out = ret.from_id==MR_CONTACT_ID_SELF; // true=outgoing message, read eg. in MessageObject.isOutOwner()
ret.created_by_mr = true;
if( type == MrMailbox.MR_MSG_TEXT ) {
@@ -293,6 +293,7 @@ public class MrMailbox {
public final static int MR_CHAT_NORMAL = 100;
public final static int MR_CHAT_GROUP = 120;
public final static int MR_CONTACT_ID_SELF = 1;
public final static int MR_CHAT_ID_STRANGERS = 1;
public final static int MR_MSG_UNDEFINED = 0;
@@ -13,11 +13,11 @@ import org.telegram.tgnet.TLRPC;
public class UserObject {
public static boolean isDeleted(TLRPC.User user) {
return user == null /*|| user instanceof TLRPC.TL_userDeleted_old2*/ || user instanceof TLRPC.TL_userEmpty || user.deleted;
return user == null || user.deleted;
}
public static boolean isUserSelf(TLRPC.User user) {
return user instanceof TLRPC.TL_userSelf_old3 || user.self;
return user.self;
}
public static String getUserName(TLRPC.User user) {
@@ -332,12 +332,6 @@ public class TLRPC {
public static class TL_userContact_old2 extends User {
}
public static class TL_userSelf_old3 extends User {
}
public static class TL_userEmpty extends User {
}
public static class MessageAction extends TLObject {
public String title;
public String address;
@@ -695,12 +689,6 @@ public class TLRPC {
public static class TL_chatParticipant extends ChatParticipant {
}
public static class TL_chatParticipantCreator extends ChatParticipant {
}
public static class TL_chatParticipantAdmin extends ChatParticipant {
}
public static class Chat extends TLObject {
public int flags;
public boolean creator;
@@ -720,7 +708,6 @@ public class TLRPC {
public boolean verified;
public boolean megagroup;
public boolean left;
public long access_hash;
public String username;
public boolean restricted;
public boolean democracy;
@@ -731,12 +718,6 @@ public class TLRPC {
public String address;
}
public static class TL_channelForbidden extends Chat {
}
public static class TL_chatForbidden extends Chat {
}
public static class StickerSet extends TLObject {
public long id;
public long access_hash;
@@ -898,15 +879,9 @@ public class TLRPC {
public static class TL_inputPeerUser extends InputPeer {
}
public static class TL_inputPeerChat extends InputPeer {
}
public static class TL_inputPeerEmpty extends InputPeer {
}
public static class TL_inputPeerChannel extends InputPeer {
}
public static class TL_topPeer extends TLObject {
public Peer peer;
public double rating;
@@ -920,14 +895,6 @@ public class TLRPC {
public static class TL_inputPhotoCropAuto extends InputPhotoCrop {
}
public static class TL_auth_signUp extends TLObject {
public String phone_number;
public String phone_code_hash;
public String phone_code;
public String first_name;
public String last_name;
}
public static class TL_contacts_importContacts extends TLObject {
public ArrayList<TL_inputPhoneContact> contacts = new ArrayList<>();
public boolean replace;
@@ -852,7 +852,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (info != null) {
count = info.participants.participants.size();
}
if (count == 0 || currentChat.deactivated || currentChat.left || currentChat instanceof TLRPC.TL_chatForbidden || info != null && info.participants instanceof TLRPC.TL_chatParticipantsForbidden) {
if ((count == 0) || currentChat.deactivated || currentChat.left || ((info != null) && (info.participants instanceof TLRPC.TL_chatParticipantsForbidden))) {
avatarContainer.setEnabled(false);
}
}
@@ -2377,12 +2377,12 @@ public class LoginActivity extends BaseFragment {
return;
}
nextPressed = true;
TLRPC.TL_auth_signUp req = new TLRPC.TL_auth_signUp();
/*TLRPC.TL_auth_signUp req = new TLRPC.TL_auth_signUp();
req.phone_code = phoneCode;
req.phone_code_hash = phoneHash;
req.phone_number = requestPhone;
req.first_name = firstNameField.getText().toString();
req.last_name = lastNameField.getText().toString();
req.last_name = lastNameField.getText().toString();*/
needShowProgress();
/*ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
@@ -892,7 +892,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
finishFragment();
} else {
TLRPC.User user = MessagesController.getInstance().getUser(user_id);
if (user == null || user instanceof TLRPC.TL_userEmpty) {
if (user == null ) {
return;
}
Bundle args = new Bundle();
@@ -1488,12 +1488,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[1];
for (int a = 0; a < arr.size(); a++) {
MessageObject obj = arr.get(a);
/*
if (currentEncryptedChat != null && obj.messageOwner.action != null && obj.messageOwner.action instanceof TLRPC.TL_messageEncryptedAction && obj.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
TLRPC.TL_decryptedMessageActionSetMessageTTL action = (TLRPC.TL_decryptedMessageActionSetMessageTTL) obj.messageOwner.action.encryptedAction;
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
}
*/
}
}
}
@@ -1937,10 +1939,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
sectionRow = rowCount++;
settingsNotificationsRow = rowCount++;
sharedMediaRow = rowCount++;
/*
if (currentEncryptedChat instanceof TLRPC.TL_encryptedChat) {
settingsTimerRow = rowCount++;
settingsKeyRow = rowCount++;
}
*/
if (user != null && !user.bot && currentEncryptedChat == null && user.id != UserConfig.getClientUserId()) {
startSecretChatRow = rowCount++;
}
@@ -2511,13 +2515,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
userCell.setIsAdmin(0);
}
} else*/ {
if (part instanceof TLRPC.TL_chatParticipantCreator) {
/*if (part instanceof TLRPC.TL_chatParticipantCreator) {
userCell.setIsAdmin(1);
} else if (currentChat.admins_enabled && part instanceof TLRPC.TL_chatParticipantAdmin) {
userCell.setIsAdmin(2);
} else {
} else {*/
userCell.setIsAdmin(0);
}
/*}*/
}
userCell.setData(MessagesController.getInstance().getUser(part.user_id), null, null, i == emptyRowChat2 + 1 ? R.drawable.menu_newgroup : 0);
}