Commit 41359b14 authored by DrKLO's avatar DrKLO

More Android L design

parent a4d42cb9
......@@ -43,19 +43,19 @@ android {
buildTypes {
debug {
debuggable true
jniDebugBuild false
jniDebuggable true
signingConfig signingConfigs.debug
}
release {
debuggable false
jniDebugBuild false
jniDebuggable false
signingConfig signingConfigs.release
}
foss {
debuggable false
jniDebugBuild false
jniDebuggable false
signingConfig signingConfigs.release
}
}
......@@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 379
versionName "1.9.7"
versionCode 380
versionName "2.0.0"
}
}
......@@ -10,9 +10,11 @@ package org.telegram.android;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentResolver;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;
......@@ -35,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
public class ContactsController {
......@@ -48,6 +51,8 @@ public class ContactsController {
private boolean contactsBookLoaded = false;
private String lastContactsVersions = "";
private ArrayList<Integer> delayedContactsUpdate = new ArrayList<Integer>();
private String inviteText;
private boolean updatingInviteText = false;
public static class Contact {
public int id;
......@@ -75,8 +80,7 @@ public class ContactsController {
public HashMap<Integer, Contact> contactsBook = new HashMap<Integer, Contact>();
public HashMap<String, Contact> contactsBookSPhones = new HashMap<String, Contact>();
public HashMap<String, ArrayList<Contact>> contactsSectionsDict = new HashMap<String, ArrayList<Contact>>();
public ArrayList<String> sortedContactsSectionsArray = new ArrayList<String>();
public ArrayList<Contact> phoneBookContacts = new ArrayList<Contact>();
public ArrayList<TLRPC.TL_contact> contacts = new ArrayList<TLRPC.TL_contact>();
public SparseArray<TLRPC.TL_contact> contactsDict = new SparseArray<TLRPC.TL_contact>();
......@@ -102,8 +106,7 @@ public class ContactsController {
public void cleanup() {
contactsBook.clear();
contactsBookSPhones.clear();
contactsSectionsDict.clear();
sortedContactsSectionsArray.clear();
phoneBookContacts.clear();
contacts.clear();
contactsDict.clear();
usersSectionsDict.clear();
......@@ -118,6 +121,45 @@ public class ContactsController {
lastContactsVersions = "";
}
public void checkInviteText() {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
inviteText = preferences.getString("invitetext", null);
int time = preferences.getInt("invitetexttime", 0);
if (!updatingInviteText && (inviteText == null || time + 86400 < (int)(System.currentTimeMillis() / 1000))) {
updatingInviteText = true;
TLRPC.TL_help_getInviteText req = new TLRPC.TL_help_getInviteText();
req.lang_code = LocaleController.getLocaleString(Locale.getDefault());
if (req.lang_code == null || req.lang_code.length() == 0) {
req.lang_code = "en";
}
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
if (error == null) {
final TLRPC.TL_help_inviteText res = (TLRPC.TL_help_inviteText)response;
if (res.message.length() != 0) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
updatingInviteText = false;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString("invitetext", res.message);
editor.putInt("invitetexttime", (int) (System.currentTimeMillis() / 1000));
editor.commit();
}
});
}
}
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
}
}
public String getInviteText() {
return inviteText != null ? inviteText : LocaleController.getString("InviteText", R.string.InviteText);
}
public void checkAppAccount() {
AccountManager am = AccountManager.get(ApplicationLoader.applicationContext);
Account[] accounts = am.getAccountsByType("org.telegram.account");
......@@ -989,8 +1031,7 @@ public class ContactsController {
contactsPhonesShort.put(user.phone, value);
}
final HashMap<String, ArrayList<Contact>> sectionsPhoneDict = new HashMap<String, ArrayList<Contact>>();
final ArrayList<String> sortedSectionsPhoneArray = new ArrayList<String>();
final ArrayList<Contact> sortedPhoneBookContacts = new ArrayList<Contact>();
for (HashMap.Entry<Integer, Contact> pair : contactsBook.entrySet()) {
Contact value = pair.getValue();
int id = pair.getKey();
......@@ -1007,61 +1048,24 @@ public class ContactsController {
continue;
}
String key = value.first_name;
if (key.length() == 0) {
key = value.last_name;
}
if (key.length() == 0) {
key = "#";
if (value.phones.size() != 0) {
value.first_name = "+" + value.phones.get(0);
}
} else {
key = key.toUpperCase();
}
if (key.length() > 1) {
key = key.substring(0, 1);
}
ArrayList<Contact> arr = sectionsPhoneDict.get(key);
if (arr == null) {
arr = new ArrayList<Contact>();
sectionsPhoneDict.put(key, arr);
sortedSectionsPhoneArray.add(key);
}
arr.add(value);
sortedPhoneBookContacts.add(value);
}
for (HashMap.Entry<String, ArrayList<Contact>> entry : sectionsPhoneDict.entrySet()) {
Collections.sort(entry.getValue(), new Comparator<Contact>() {
@Override
public int compare(Contact contact, Contact contact2) {
String toComapre1 = contact.first_name;
if (toComapre1.length() == 0) {
toComapre1 = contact.last_name;
}
String toComapre2 = contact2.first_name;
if (toComapre2.length() == 0) {
toComapre2 = contact2.last_name;
}
return toComapre1.compareTo(toComapre2);
}
});
}
Collections.sort(sortedSectionsPhoneArray, new Comparator<String>() {
Collections.sort(sortedPhoneBookContacts, new Comparator<Contact>() {
@Override
public int compare(String s, String s2) {
char cv1 = s.charAt(0);
char cv2 = s2.charAt(0);
if (cv1 == '#') {
return 1;
} else if (cv2 == '#') {
return -1;
public int compare(Contact contact, Contact contact2) {
String toComapre1 = contact.first_name;
if (toComapre1.length() == 0) {
toComapre1 = contact.last_name;
}
return s.compareTo(s2);
String toComapre2 = contact2.first_name;
if (toComapre2.length() == 0) {
toComapre2 = contact2.last_name;
}
return toComapre1.compareTo(toComapre2);
}
});
contactsSectionsDict = sectionsPhoneDict;
sortedContactsSectionsArray = sortedSectionsPhoneArray;
phoneBookContacts = sortedPhoneBookContacts;
}
private void buildContactsSectionsArrays(boolean sort) {
......
......@@ -45,6 +45,7 @@ public class NotificationCenter {
public static final int wallpapersDidLoaded = 171;
public static final int closeOtherAppActivities = 702;
public static final int didUpdatedConnectionState = 703;
public static final int didReceiveSmsCode = 998;
public static final int emojiDidLoaded = 999;
public static final int appDidLogout = 1234;
......
......@@ -48,7 +48,7 @@ public class SmsListener extends BroadcastReceiver {
if (matcher.find()) {
String str = matcher.group(0);
if (str.length() >= 3) {
NotificationCenter.getInstance().postNotificationName(998, matcher.group(0));
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didReceiveSmsCode, matcher.group(0));
}
}
} catch (Exception e) {
......
......@@ -640,7 +640,7 @@ public class Utilities {
builder.append(" ");
}
query.trim();
builder.append(Html.fromHtml("<font color=\"#357aa8\">" + query + "</font>"));
builder.append(Html.fromHtml("<font color=\"#548ab6\">" + query + "</font>"));
lastIndex = end;
}
......
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Adapters;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
public abstract class BaseSectionsAdapter extends BaseFragmentAdapter {
private SparseArray<Integer> sectionPositionCache;
private SparseArray<Integer> sectionCache;
private SparseArray<Integer> sectionCountCache;
private int sectionCount;
private int count;
private void cleanupCache() {
sectionCache = new SparseArray<Integer>();
sectionPositionCache = new SparseArray<Integer>();
sectionCountCache = new SparseArray<Integer>();
count = -1;
sectionCount = -1;
}
public BaseSectionsAdapter() {
super();
cleanupCache();
}
@Override
public void notifyDataSetChanged() {
cleanupCache();
super.notifyDataSetChanged();
}
@Override
public void notifyDataSetInvalidated() {
cleanupCache();
super.notifyDataSetInvalidated();
}
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
return isRowEnabled(getSectionForPosition(position), getPositionInSectionForPosition(position));
}
@Override
public final long getItemId(int position) {
return position;
}
@Override
public final int getCount() {
if (count >= 0) {
return count;
}
count = 0;
for (int i = 0; i < internalGetSectionCount(); i++) {
count += internalGetCountForSection(i);
}
return count;
}
@Override
public final Object getItem(int position) {
return getItem(getSectionForPosition(position), getPositionInSectionForPosition(position));
}
@Override
public final int getItemViewType(int position) {
return getItemViewType(getSectionForPosition(position), getPositionInSectionForPosition(position));
}
@Override
public final View getView(int position, View convertView, ViewGroup parent) {
return getItemView(getSectionForPosition(position), getPositionInSectionForPosition(position), convertView, parent);
}
private int internalGetCountForSection(int section) {
Integer cachedSectionCount = sectionCountCache.get(section);
if (cachedSectionCount != null) {
return cachedSectionCount;
}
int sectionCount = getCountForSection(section);
sectionCountCache.put(section, sectionCount);
return sectionCount;
}
private int internalGetSectionCount() {
if (sectionCount >= 0) {
return sectionCount;
}
sectionCount = getSectionCount();
return sectionCount;
}
public final int getSectionForPosition(int position) {
Integer cachedSection = sectionCache.get(position);
if (cachedSection != null) {
return cachedSection;
}
int sectionStart = 0;
for (int i = 0; i < internalGetSectionCount(); i++) {
int sectionCount = internalGetCountForSection(i);
int sectionEnd = sectionStart + sectionCount;
if (position >= sectionStart && position < sectionEnd) {
sectionCache.put(position, i);
return i;
}
sectionStart = sectionEnd;
}
return 0;
}
public int getPositionInSectionForPosition(int position) {
Integer cachedPosition = sectionPositionCache.get(position);
if (cachedPosition != null) {
return cachedPosition;
}
int sectionStart = 0;
for (int i = 0; i < internalGetSectionCount(); i++) {
int sectionCount = internalGetCountForSection(i);
int sectionEnd = sectionStart + sectionCount;
if (position >= sectionStart && position < sectionEnd) {
int positionInSection = position - sectionStart;
sectionPositionCache.put(position, positionInSection);
return positionInSection;
}
sectionStart = sectionEnd;
}
return 0;
}
public abstract int getSectionCount();
public abstract int getCountForSection(int section);
public abstract boolean isRowEnabled(int section, int row);
public abstract int getItemViewType(int section, int position);
public abstract Object getItem(int section, int position);
public abstract View getItemView(int section, int position, View convertView, ViewGroup parent);
public abstract View getSectionHeaderView(int section, View convertView, ViewGroup parent);
}
......@@ -22,8 +22,8 @@ import org.telegram.messenger.FileLog;
import org.telegram.android.MessagesController;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Views.SettingsSectionLayout;
import org.telegram.ui.Cells.GreySectionCell;
import org.telegram.ui.Cells.ProfileSearchCell;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -197,16 +197,15 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
public View getView(int i, View view, ViewGroup viewGroup) {
if (i == searchResult.size()) {
if (view == null) {
view = new SettingsSectionLayout(mContext);
((SettingsSectionLayout) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
view = new GreySectionCell(mContext);
((GreySectionCell) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
}
} else {
if (view == null) {
view = new ChatOrUserCell(mContext);
((ChatOrUserCell) view).usePadding = false;
view = new ProfileSearchCell(mContext);
}
((ChatOrUserCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
TLRPC.User user = getItem(i);
if (user != null) {
CharSequence username = null;
......@@ -221,20 +220,20 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
}
} else if (i > searchResult.size() && user.username != null) {
try {
username = Html.fromHtml(String.format("<font color=\"#357aa8\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
username = Html.fromHtml(String.format("<font color=\"#548ab6\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
} catch (Exception e) {
username = user.username;
FileLog.e("tmessages", e);
}
}
((ChatOrUserCell) view).setData(user, null, null, name, username);
((ProfileSearchCell) view).setData(user, null, null, name, username);
if (ignoreUsers != null) {
if (ignoreUsers.containsKey(user.id)) {
((ChatOrUserCell) view).drawAlpha = 0.5f;
((ProfileSearchCell) view).drawAlpha = 0.5f;
} else {
((ChatOrUserCell) view).drawAlpha = 1.0f;
((ProfileSearchCell) view).drawAlpha = 1.0f;
}
}
}
......
......@@ -18,8 +18,8 @@ import org.telegram.android.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Cells.DrawerActionCell;
import org.telegram.ui.Cells.DrawerDividerCell;
import org.telegram.ui.Cells.DrawerEmptyCell;
import org.telegram.ui.Cells.DividerCell;
import org.telegram.ui.Cells.EmptyCell;
import org.telegram.ui.Cells.DrawerProfileCell;
public class DrawerLayoutAdapter extends BaseAdapter {
......@@ -37,12 +37,12 @@ public class DrawerLayoutAdapter extends BaseAdapter {
@Override
public boolean isEnabled(int i) {
return !(i == 0 || i == 1 || i == 5 || i == 6 || i == 7);
return !(i == 0 || i == 1 || i == 5);
}
@Override
public int getCount() {
return UserConfig.isClientActivated() ? 12 : 0;
return UserConfig.isClientActivated() ? 10 : 0;
}
@Override
......@@ -70,11 +70,11 @@ public class DrawerLayoutAdapter extends BaseAdapter {
((DrawerProfileCell) view).setUser(MessagesController.getInstance().getUser(UserConfig.getClientUserId()));
} else if (type == 1) {
if (view == null) {
view = new DrawerEmptyCell(mContext);
view = new EmptyCell(mContext, 8);
}
} else if (type == 2) {
if (view == null) {
view = new DrawerDividerCell(mContext);
view = new DividerCell(mContext);
}
} else if (type == 3) {
if (view == null) {
......@@ -87,13 +87,13 @@ public class DrawerLayoutAdapter extends BaseAdapter {
actionCell.setTextAndIcon(LocaleController.getString("NewSecretChat", R.string.NewSecretChat), R.drawable.menu_secret);
} else if (i == 4) {
actionCell.setTextAndIcon(LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList), R.drawable.menu_broadcast);
} else if (i == 8) {
} else if (i == 6) {
actionCell.setTextAndIcon(LocaleController.getString("Contacts", R.string.Contacts), R.drawable.menu_contacts);
} else if (i == 9) {
} else if (i == 7) {
actionCell.setTextAndIcon(LocaleController.getString("InviteFriends", R.string.InviteFriends), R.drawable.menu_invite);
} else if (i == 10) {
} else if (i == 8) {
actionCell.setTextAndIcon(LocaleController.getString("Settings", R.string.Settings), R.drawable.menu_settings);
} else if (i == 11) {
} else if (i == 9) {
actionCell.setTextAndIcon(LocaleController.getString("TelegramFaq", R.string.TelegramFaq), R.drawable.menu_help);
}
}
......@@ -105,9 +105,9 @@ public class DrawerLayoutAdapter extends BaseAdapter {
public int getItemViewType(int i) {
if (i == 0) {
return 0;
} else if (i == 1 || i == 5 || i == 7) {
} else if (i == 1) {
return 1;
} else if (i == 6) {
} else if (i == 5) {
return 2;
}
return 3;
......
......@@ -30,9 +30,9 @@ import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Cells.DialogCell;
import org.telegram.ui.Views.SettingsSectionLayout;
import org.telegram.ui.Cells.GreySectionCell;
import org.telegram.ui.Cells.ProfileSearchCell;
import java.util.ArrayList;
import java.util.Timer;
......@@ -113,7 +113,7 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
}
private void searchDialogsInternal(final String query, final boolean needEncrypted) {
private void searchDialogsInternal(final String query, final boolean serverOnly) {
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
@Override
public void run() {
......@@ -162,7 +162,7 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
}
cursor.dispose();
if (needEncrypted) {
if (!serverOnly) {
cursor = MessagesStorage.getInstance().getDatabase().queryFinalized("SELECT q.data, u.name, q.user, q.g, q.authkey, q.ttl, u.data, u.status, q.layer, q.seq_in, q.seq_out FROM enc_chats as q INNER JOIN dialogs as d ON (q.uid << 32) = d.did INNER JOIN users as u ON q.user = u.uid");
while (cursor.next()) {
String name = cursor.stringValue(1);
......@@ -219,7 +219,7 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
ByteBufferDesc data = MessagesStorage.getInstance().getBuffersStorage().getFreeBuffer(cursor.byteArrayLength(0));
if (data != null && cursor.byteBufferValue(0, data.buffer) != 0) {
TLRPC.Chat chat = (TLRPC.Chat) TLClassStore.Instance().TLdeserialize(data, data.readInt32());
if (!needEncrypted && chat.id < 0) {
if (serverOnly && chat.id < 0) {
continue;
}
resultArrayNames.add(Utilities.generateSearchName(chat.title, null, q));
......@@ -367,17 +367,16 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
if (type == 1) {
if (view == null) {
view = new SettingsSectionLayout(mContext);
view.setPadding(AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11), 0);
view = new GreySectionCell(mContext);
}
if (!globalSearch.isEmpty() && i == searchResult.size()) {
((SettingsSectionLayout) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
((GreySectionCell) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
} else {
((SettingsSectionLayout) view).setText(LocaleController.getString("SearchMessages", R.string.SearchMessages));
((GreySectionCell) view).setText(LocaleController.getString("SearchMessages", R.string.SearchMessages));
}
} else if (type == 0) {
if (view == null) {
view = new ChatOrUserCell(mContext);
view = new ProfileSearchCell(mContext);
}
TLRPC.User user = null;
......@@ -385,9 +384,9 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
TLRPC.EncryptedChat encryptedChat = null;
int localCount = searchResult.size();
int globalCount = globalSearch.isEmpty() ? -1 : globalSearch.size() + 1;
int globalCount = globalSearch.isEmpty() ? 0 : globalSearch.size() + 1;
((ChatOrUserCell) view).useSeparator = (i != getCount() - 1 && i != localCount - 1 && i != localCount + globalCount - 1);
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != localCount - 1 && i != localCount + globalCount - 1);
Object obj = getItem(i);
if (obj instanceof TLRPC.User) {
user = MessagesController.getInstance().getUser(((TLRPC.User) obj).id);
......@@ -413,14 +412,14 @@ public class MessagesActivitySearchAdapter extends BaseContactsSearchAdapter {
}
} else if (i > searchResult.size() && user != null && user.username != null) {
try {
username = Html.fromHtml(String.format("<font color=\"#357aa8\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
username = Html.fromHtml(String.format("<font color=\"#548ab6\">@%s</font>%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length())));
} catch (Exception e) {
username = user.username;
FileLog.e("tmessages", e);
}
}
((ChatOrUserCell) view).setData(user, chat, encryptedChat, name, username);
((ProfileSearchCell) view).setData(user, chat, encryptedChat, name, username);
} else if (type == 2) {
if (view == null) {
view = new DialogCell(mContext);
......
......@@ -70,7 +70,6 @@ public class DialogCell extends BaseCell {
private int nameLeft;
private int nameTop = AndroidUtilities.dp(13);
private StaticLayout nameLayout;
private boolean drawNameLock;
private boolean drawNameGroup;
......@@ -142,13 +141,13 @@ public class DialogCell extends BaseCell {
countPaint.setColor(0xffffffff);
countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
lockDrawable = getResources().getDrawable(R.drawable.ic_lock_green);
lockDrawable = getResources().getDrawable(R.drawable.list_secret);
checkDrawable = getResources().getDrawable(R.drawable.dialogs_check);
halfCheckDrawable = getResources().getDrawable(R.drawable.dialogs_halfcheck);
clockDrawable = getResources().getDrawable(R.drawable.msg_clock);
errorDrawable = getResources().getDrawable(R.drawable.dialogs_warning);
countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
groupDrawable = getResources().getDrawable(R.drawable.grouplist);
groupDrawable = getResources().getDrawable(R.drawable.list_group);
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast);
}
}
......@@ -217,7 +216,7 @@ public class DialogCell extends BaseCell {
if (encryptedChat != null) {
drawNameLock = true;
nameLockTop = AndroidUtilities.dp(15);
nameLockTop = AndroidUtilities.dp(16.5f);
if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(72);
nameLeft = AndroidUtilities.dp(76) + lockDrawable.getIntrinsicWidth();
......@@ -229,10 +228,12 @@ public class DialogCell extends BaseCell {
if (chat != null) {
if (chat.id < 0) {
drawNameBroadcast = true;
nameLockTop = AndroidUtilities.dp(16.5f);
} else {
drawNameGroup = true;
nameLockTop = AndroidUtilities.dp(17.5f);
}
nameLockTop = AndroidUtilities.dp(16);
if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(72);
nameLeft = AndroidUtilities.dp(76) + (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
......@@ -655,7 +656,7 @@ public class DialogCell extends BaseCell {
if (nameLayout != null) {
canvas.save();
canvas.translate(nameLeft, nameTop);
canvas.translate(nameLeft, AndroidUtilities.dp(13));
nameLayout.draw(canvas);
canvas.restore();
}
......
......@@ -9,17 +9,28 @@
package org.telegram.ui.Cells;
import android.content.Context;
import android.widget.FrameLayout;
import android.graphics.Canvas;
import android.graphics.Paint;
public class DrawerDividerCell extends FrameLayout {
import org.telegram.android.AndroidUtilities;
public DrawerDividerCell(Context context) {
public class DividerCell extends BaseCell {
Paint paint = new Paint();
public DividerCell(Context context) {
super(context);
setBackgroundColor(0xffd9d9d9);
paint.setColor(0xffd9d9d9);
paint.setStrokeWidth(1);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(1, MeasureSpec.EXACTLY));
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), AndroidUtilities.dp(16) + 1);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawLine(getPaddingLeft(), AndroidUtilities.dp(8), getWidth() - getPaddingRight(), AndroidUtilities.dp(8), paint);
}
}
......@@ -30,13 +30,13 @@ public class DrawerActionCell extends FrameLayout {
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setGravity(Gravity.LEFT | Gravity.CENTER);
textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
textView.setCompoundDrawablePadding(AndroidUtilities.dp(34));
addView(textView);
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.MATCH_PARENT;
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
layoutParams.gravity = Gravity.LEFT;
layoutParams.leftMargin = AndroidUtilities.dp(14);
layoutParams.rightMargin = AndroidUtilities.dp(16);
textView.setLayoutParams(layoutParams);
......
......@@ -13,14 +13,17 @@ import android.widget.FrameLayout;
import org.telegram.android.AndroidUtilities;
public class DrawerEmptyCell extends FrameLayout {
public class EmptyCell extends FrameLayout {
public DrawerEmptyCell(Context context) {
int cellHeight;
public EmptyCell(Context context, int height) {
super(context);
cellHeight = height;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(8), MeasureSpec.EXACTLY));
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(cellHeight), MeasureSpec.EXACTLY));
}
}
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Cells;
import android.content.Context;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
public class GreySectionCell extends FrameLayout {
private TextView textView;
private void init() {
setBackgroundColor(0xfff2f2f2);
textView = new TextView(getContext());
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setTextColor(0xff8a8a8a);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)textView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.leftMargin = AndroidUtilities.dp(16);
layoutParams.rightMargin = AndroidUtilities.dp(16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
textView.setLayoutParams(layoutParams);
}
public GreySectionCell(Context context) {
super(context);
init();
}
public GreySectionCell(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public GreySectionCell(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public GreySectionCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(36), MeasureSpec.EXACTLY));
}
public void setText(String text) {
textView.setText(text);
}
}
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Cells;
import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
public class LetterSectionCell extends FrameLayout {
private TextView textView;
public LetterSectionCell(Context context) {
super(context);
setLayoutParams(new ViewGroup.LayoutParams(AndroidUtilities.dp(54), AndroidUtilities.dp(64)));
textView = new TextView(getContext());
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 22);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setTextColor(0xff808080);
textView.setGravity(Gravity.CENTER);
addView(textView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)textView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
textView.setLayoutParams(layoutParams);
}
public void setLetter(String letter) {
textView.setText(letter.toUpperCase());
}
}
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Cells;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
public class TextCell extends FrameLayout {
private TextView textView;
private TextView valueTextView;
private ImageView imageView;
private ImageView valueImageView;
public TextCell(Context context) {
super(context);
textView = new TextView(context);
textView.setTextColor(0xff000000);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView);
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.MATCH_PARENT;
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 71);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 71 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
textView.setLayoutParams(layoutParams);
valueTextView = new TextView(context);
valueTextView.setTextColor(0xff2f8cc9);
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
valueTextView.setLines(1);
valueTextView.setMaxLines(1);
valueTextView.setSingleLine(true);
valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
addView(valueTextView);
layoutParams = (LayoutParams) valueTextView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT;
valueTextView.setLayoutParams(layoutParams);
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER);
addView(imageView);
layoutParams = (LayoutParams) imageView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
imageView.setLayoutParams(layoutParams);
valueImageView = new ImageView(context);
valueImageView.setScaleType(ImageView.ScaleType.CENTER);
addView(valueImageView);
layoutParams = (LayoutParams) valueImageView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL;
valueImageView.setLayoutParams(layoutParams);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY));
}
public void setTextColor(int color) {
textView.setTextColor(color);
}
public void setText(String text) {
textView.setText(text);
imageView.setVisibility(GONE);
valueTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
}
public void setTextAndIcon(String text, int resId) {
textView.setText(text);
imageView.setImageResource(resId);
imageView.setVisibility(VISIBLE);
valueTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
}
public void setTextAndValue(String text, String value) {
textView.setText(text);
valueTextView.setText(value);
valueTextView.setVisibility(VISIBLE);
imageView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
}
public void setTextAndValueDrawable(String text, Drawable drawable) {
textView.setText(text);
valueImageView.setVisibility(VISIBLE);
valueImageView.setImageDrawable(drawable);
valueTextView.setVisibility(GONE);
imageView.setVisibility(GONE);
}
}
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Cells;
import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
public class TextDetailCell extends FrameLayout {
private TextView textView;
private TextView valueTextView;
private ImageView imageView;
public TextDetailCell(Context context) {
super(context);
textView = new TextView(context);
textView.setTextColor(0xff000000);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.topMargin = AndroidUtilities.dp(11);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 71);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 71 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
textView.setLayoutParams(layoutParams);
valueTextView = new TextView(context);
valueTextView.setTextColor(0xff8a8a8a);
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
valueTextView.setLines(1);
valueTextView.setMaxLines(1);
valueTextView.setSingleLine(true);
valueTextView.setGravity((LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL);
addView(valueTextView);
layoutParams = (FrameLayout.LayoutParams) valueTextView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.topMargin = AndroidUtilities.dp(36);
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 71);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 71 : 16);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
valueTextView.setLayoutParams(layoutParams);
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER);
addView(imageView);
layoutParams = (LayoutParams) imageView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.WRAP_CONTENT;
layoutParams.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 16);
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
imageView.setLayoutParams(layoutParams);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64), View.MeasureSpec.EXACTLY));
}
public void setTextAndValue(String text, String value) {
textView.setText(text);
valueTextView.setText(value);
imageView.setVisibility(GONE);
}
public void setTextAndValueAndIcon(String text, String value, int resId) {
textView.setText(text);
valueTextView.setText(value);
imageView.setVisibility(VISIBLE);
imageView.setImageResource(resId);
}
}
......@@ -436,7 +436,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (currentEncryptedChat != null) {
MediaController.getInstance().stopMediaObserver();
}
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
AndroidUtilities.unlockOrientation(getParentActivity());
MediaController.getInstance().stopAudio();
}
......@@ -555,7 +555,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (currentEncryptedChat != null) {
args.putLong("dialog_id", dialog_id);
}
presentFragment(new UserProfileActivity(args));
presentFragment(new ProfileActivity(args));
} else if (currentChat != null) {
if (info != null && info instanceof TLRPC.TL_chatParticipantsForbidden) {
return;
......@@ -2383,6 +2383,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void onResume() {
super.onResume();
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setStatusBarColor(0xff54759e);
}
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
checkActionBarMenu();
......@@ -2459,7 +2462,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void onPause() {
super.onPause();
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
actionBarLayer.hideActionMode();
chatActivityEnterView.hideEmojiPopup();
paused = true;
......@@ -3127,7 +3129,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (user != null && user.id != UserConfig.getClientUserId()) {
Bundle args = new Bundle();
args.putInt("user_id", user.id);
presentFragment(new UserProfileActivity(args));
presentFragment(new ProfileActivity(args));
}
}
......@@ -3315,7 +3317,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (uid != UserConfig.getClientUserId()) {
Bundle args = new Bundle();
args.putInt("user_id", uid);
presentFragment(new UserProfileActivity(args));
presentFragment(new ProfileActivity(args));
}
}
});
......
......@@ -36,7 +36,7 @@ import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.android.MessageObject;
import org.telegram.ui.Adapters.BaseFragmentAdapter;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.Views.ActionBar.ActionBarLayer;
import org.telegram.ui.Views.ActionBar.ActionBarMenu;
import org.telegram.ui.Views.AvatarDrawable;
......@@ -257,7 +257,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
}
Bundle args = new Bundle();
args.putInt("user_id", user_id);
presentFragment(new UserProfileActivity(args));
presentFragment(new ProfileActivity(args));
} else if (i == settingsNotificationsRow) {
Bundle args = new Bundle();
args.putLong("dialog_id", -chat_id);
......@@ -403,8 +403,8 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof ChatOrUserCell) {
((ChatOrUserCell) child).update(mask);
if (child instanceof UserCell) {
((UserCell) child).update(mask);
}
}
}
......@@ -476,7 +476,6 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
Bundle args = new Bundle();
args.putBoolean("onlyUsers", true);
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("usersAsSections", true);
args.putBoolean("returnAsResult", true);
//args.putBoolean("allowUsernameSearch", false);
if (chat_id > 0) {
......@@ -633,7 +632,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
}
if (count != 0 && onlineCount > 1) {
onlineText.setText(Html.fromHtml(String.format("%s, <font color='#357aa8'>%s</font>", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount))));
onlineText.setText(Html.fromHtml(String.format("%s, <font color='#548ab6'>%s</font>", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount))));
} else {
onlineText.setText(LocaleController.formatPluralString("Members", count));
}
......@@ -685,12 +684,11 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
TLRPC.User user = MessagesController.getInstance().getUser(part.user_id);
if (view == null) {
view = new ChatOrUserCell(mContext);
((ChatOrUserCell)view).usePadding = false;
((ChatOrUserCell)view).useSeparator = true;
view = new UserCell(mContext);
((UserCell)view).useSeparator = true;
}
((ChatOrUserCell)view).setData(user, null, null, null, null);
((UserCell)view).setData(user, null, null);
} else if (type == 4) {
if (view == null) {
LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
......
......@@ -568,7 +568,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
holder.messageTextView.setText(LocaleController.formatUserStatus(user));
if (user.status != null && user.status.expires > ConnectionsManager.getInstance().getCurrentTime()) {
holder.messageTextView.setTextColor(0xff357aa8);
holder.messageTextView.setTextColor(0xff548ab6);
} else {
holder.messageTextView.setTextColor(0xff808080);
}
......
......@@ -30,7 +30,7 @@ import org.telegram.messenger.FileLog;
import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.Views.ActionBar.ActionBarLayer;
import org.telegram.ui.Views.ActionBar.ActionBarMenu;
import org.telegram.ui.Views.AvatarDrawable;
......@@ -64,6 +64,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
public GroupCreateFinalActivity(Bundle args) {
super(args);
isBroadcast = args.getBoolean("broadcast", false);
avatarDrawable = new AvatarDrawable();
}
@SuppressWarnings("unchecked")
......@@ -339,8 +340,8 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof ChatOrUserCell) {
((ChatOrUserCell) child).update(mask);
if (child instanceof UserCell) {
((UserCell) child).update(mask);
}
}
}
......@@ -390,12 +391,11 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(position));
if (convertView == null) {
convertView = new ChatOrUserCell(mContext);
((ChatOrUserCell)convertView).usePadding = false;
convertView = new UserCell(mContext);
}
((ChatOrUserCell)convertView).setData(user, null, null, null, null);
((ChatOrUserCell) convertView).useSeparator = position != selectedContacts.size() - 1;
((UserCell)convertView).setData(user, null, null);
((UserCell) convertView).useSeparator = position != selectedContacts.size() - 1;
return convertView;
}
......
......@@ -17,6 +17,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -27,7 +28,7 @@ import org.telegram.android.MessagesController;
import org.telegram.messenger.R;
import org.telegram.ui.Views.ActionBar.ActionBarLayer;
import org.telegram.ui.Views.ActionBar.BaseFragment;
import org.telegram.ui.Views.IdenticonView;
import org.telegram.ui.Views.IdenticonDrawable;
public class IdenticonActivity extends BaseFragment {
private int chat_id;
......@@ -60,11 +61,13 @@ public class IdenticonActivity extends BaseFragment {
});
fragmentView = inflater.inflate(R.layout.identicon_layout, container, false);
IdenticonView identiconView = (IdenticonView) fragmentView.findViewById(R.id.identicon_view);
ImageView identiconView = (ImageView) fragmentView.findViewById(R.id.identicon_view);
TextView textView = (TextView)fragmentView.findViewById(R.id.identicon_text);
TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance().getEncryptedChat(chat_id);
if (encryptedChat != null) {
identiconView.setBytes(encryptedChat.auth_key);
IdenticonDrawable drawable = new IdenticonDrawable();
identiconView.setImageDrawable(drawable);
drawable.setBytes(encryptedChat.auth_key);
TLRPC.User user = MessagesController.getInstance().getUser(encryptedChat.user_id);
textView.setText(Html.fromHtml(LocaleController.formatString("EncryptionKeyDescription", R.string.EncryptionKeyDescription, user.first_name, user.first_name)));
}
......
......@@ -39,6 +39,7 @@ import android.widget.Toast;
import org.telegram.android.AndroidUtilities;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.android.ContactsController;
import org.telegram.android.SendMessagesHelper;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog;
......@@ -204,7 +205,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
Bundle args = new Bundle();
args.putBoolean("onlyUsers", true);
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("usersAsSections", true);
args.putBoolean("createSecretChat", true);
presentFragment(new ContactsActivity(args));
}
......@@ -268,7 +268,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
Bundle args = new Bundle();
args.putBoolean("onlyUsers", true);
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("usersAsSections", true);
args.putBoolean("createSecretChat", true);
presentFragment(new ContactsActivity(args));
drawerLayoutContainer.closeDrawer(false);
......@@ -277,15 +276,29 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
args.putBoolean("broadcast", true);
presentFragment(new GroupCreateActivity(args));
drawerLayoutContainer.closeDrawer(false);
} else if (position == 8) {
} else if (position == 6) {
presentFragment(new ContactsActivity(null));
drawerLayoutContainer.closeDrawer(false);
} else if (position == 9) {
} else if (position == 7) {
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, ContactsController.getInstance().getInviteText());
startActivity(intent);
} catch (Exception e) {
FileLog.e("tmessages", e);
}
drawerLayoutContainer.closeDrawer(false);
} else if (position == 10) {
} else if (position == 8) {
presentFragment(new SettingsActivity());
drawerLayoutContainer.closeDrawer(false);
} else if (position == 11) {
} else if (position == 9) {
try {
Intent pickIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl)));
startActivity(pickIntent);
} catch (Exception e) {
FileLog.e("tmessages", e);
}
drawerLayoutContainer.closeDrawer(false);
}
}
......
......@@ -144,7 +144,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
}
codeField.setText("");
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getInstance().addObserver(this, 998);
NotificationCenter.getInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
currentParams = params;
waitingForSms = true;
String phone = params.getString("phone");
......@@ -279,7 +279,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
nextPressed = true;
waitingForSms = false;
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
final TLRPC.TL_auth_signIn req = new TLRPC.TL_auth_signIn();
req.phone_number = requestPhone;
req.phone_code = codeField.getText().toString();
......@@ -353,7 +353,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
destroyCodeTimer();
currentParams = null;
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
waitingForSms = false;
}
......@@ -361,7 +361,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
public void onDestroyActivity() {
super.onDestroyActivity();
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
destroyTimer();
destroyCodeTimer();
waitingForSms = false;
......@@ -378,7 +378,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
@Override
public void didReceivedNotification(int id, final Object... args) {
if (id == 998) {
if (id == NotificationCenter.didReceiveSmsCode) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
......
......@@ -259,6 +259,9 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
@Override
public void onResume() {
super.onResume();
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setStatusBarColor(0xff54759e);
}
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
......
......@@ -44,7 +44,7 @@ import org.telegram.ui.Adapters.MessagesActivityAdapter;
import org.telegram.ui.Adapters.MessagesActivitySearchAdapter;
import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy;
import org.telegram.ui.AnimationCompat.ViewProxy;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.Cells.DialogCell;
import org.telegram.ui.Views.ActionBar.ActionBarLayer;
import org.telegram.ui.Views.ActionBar.ActionBarMenu;
......@@ -266,9 +266,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putBoolean("onlyUsers", true);
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("usersAsSections", true);
presentFragment(new ContactsActivity(args));
}
});
......@@ -613,8 +611,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
}
}
cell.update(mask);
} else if (child instanceof ChatOrUserCell) {
((ChatOrUserCell) child).update(mask);
} else if (child instanceof UserCell) {
((UserCell) child).update(mask);
}
}
}
......
......@@ -253,6 +253,14 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
return fragmentView;
}
@Override
public void onResume() {
super.onResume();
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setStatusBarColor(0xff54759e);
}
}
public void updateServerNotificationsSettings() {
if ((int)dialog_id == 0) {
return;
......
......@@ -27,7 +27,7 @@ import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Adapters.BaseFragmentAdapter;
import org.telegram.ui.Cells.ChatOrUserCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.Views.ActionBar.ActionBarLayer;
import org.telegram.ui.Views.ActionBar.ActionBarMenu;
import org.telegram.ui.Views.ActionBar.BaseFragment;
......@@ -72,7 +72,6 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
Bundle args = new Bundle();
args.putBoolean("onlyUsers", true);
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("usersAsSections", true);
args.putBoolean("returnAsResult", true);
ContactsActivity fragment = new ContactsActivity(args);
fragment.setDelegate(SettingsBlockedUsersActivity.this);
......@@ -111,7 +110,7 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
if (i < MessagesController.getInstance().blockedUsers.size()) {
Bundle args = new Bundle();
args.putInt("user_id", MessagesController.getInstance().blockedUsers.get(i));
presentFragment(new UserProfileActivity(args));
presentFragment(new ProfileActivity(args));
}
}
});
......@@ -177,8 +176,8 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof ChatOrUserCell) {
((ChatOrUserCell) child).update(mask);
if (child instanceof UserCell) {
((UserCell) child).update(mask);
}
}
}
......@@ -244,12 +243,11 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
int type = getItemViewType(i);
if (type == 0) {
if (view == null) {
view = new ChatOrUserCell(mContext);
((ChatOrUserCell)view).usePadding = false;
((ChatOrUserCell)view).useSeparator = true;
view = new UserCell(mContext);
((UserCell)view).useSeparator = true;
}
TLRPC.User user = MessagesController.getInstance().getUser(MessagesController.getInstance().blockedUsers.get(i));
((ChatOrUserCell)view).setData(user, null, null, null, user.phone != null && user.phone.length() != 0 ? PhoneFormat.getInstance().format("+" + user.phone) : LocaleController.getString("NumberUnknown", R.string.NumberUnknown));
((UserCell)view).setData(user, null, user.phone != null && user.phone.length() != 0 ? PhoneFormat.getInstance().format("+" + user.phone) : LocaleController.getString("NumberUnknown", R.string.NumberUnknown));
} else if (type == 1) {
if (view == null) {
LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
......
......@@ -16,6 +16,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
......@@ -222,7 +223,8 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
if (requestCode == 10) {
Utilities.addMediaToGallery(currentPicturePath);
try {
Bitmap bitmap = ImageLoader.loadBitmap(currentPicturePath, null, AndroidUtilities.dp(320), AndroidUtilities.dp(480));
Point screenSize = AndroidUtilities.getRealScreenSize();
Bitmap bitmap = ImageLoader.loadBitmap(currentPicturePath, null, screenSize.x, screenSize.y);
File toFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "wallpaper-temp.jpg");
FileOutputStream stream = new FileOutputStream(toFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
......@@ -238,7 +240,8 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
return;
}
try {
Bitmap bitmap = ImageLoader.loadBitmap(null, data.getData(), AndroidUtilities.dp(320), AndroidUtilities.dp(480));
Point screenSize = AndroidUtilities.getRealScreenSize();
Bitmap bitmap = ImageLoader.loadBitmap(null, data.getData(), screenSize.x, screenSize.y);
File toFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "wallpaper-temp.jpg");
FileOutputStream stream = new FileOutputStream(toFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
......
......@@ -26,11 +26,14 @@ public class AvatarDrawable extends Drawable {
private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private static TextPaint namePaint;
private static int[] arrColors = {0xffe56555, 0xfff28c48, 0xffeec764, 0xff76c84d, 0xff5fbed5, 0xff549cdd, 0xff8e85ee, 0xfff2749a};
private static int[] arrColorsProfiles = {0xffd86f65, 0xffdc9663, 0xffdebc68, 0xff67b35d, 0xff56a2bb, 0xff5c98cd, 0xff8c79d2, 0xffda738e};
private static int[] arrColorsProfilesBack = {0xffca6056, 0xffcf8550, 0xffcfa742, 0xff56a14c, 0xff4492ac, 0xff4c84b6, 0xff7d6ac4, 0xffc9637e};
private int color;
private StaticLayout textLayout;
private float textWidth;
private float textHeight;
private boolean isProfile;
public AvatarDrawable() {
super();
......@@ -56,10 +59,28 @@ public class AvatarDrawable extends Drawable {
}
}
public AvatarDrawable(TLRPC.User user, boolean profile) {
this(user);
isProfile = profile;
}
public AvatarDrawable(TLRPC.Chat chat, boolean profile) {
this(chat);
isProfile = profile;
}
public static int getColorForId(int id) {
return arrColors[Math.abs(id) % arrColors.length];
}
public static int getProfileColorForId(int id) {
return arrColorsProfiles[Math.abs(id) % arrColorsProfiles.length];
}
public static int getProfileBackColorForId(int id) {
return arrColorsProfilesBack[Math.abs(id) % arrColorsProfilesBack.length];
}
public void setInfo(TLRPC.User user) {
if (user != null) {
setInfo(user.id, user.first_name, user.last_name, false);
......@@ -77,7 +98,11 @@ public class AvatarDrawable extends Drawable {
}
public void setInfo(int id, String firstName, String lastName, boolean isBroadcast) {
color = arrColors[Math.abs(id) % arrColors.length];
if (isProfile) {
color = arrColorsProfiles[Math.abs(id) % arrColors.length];
} else {
color = arrColors[Math.abs(id) % arrColors.length];
}
String text = "";
if (firstName != null && firstName.length() > 0) {
......
/*
* This is the source code of Telegram for Android v. 1.3.2.
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import android.graphics.drawable.Drawable;
import org.telegram.android.AndroidUtilities;
import org.telegram.messenger.Utilities;
public class IdenticonView extends View {
public class IdenticonDrawable extends Drawable {
private byte[] data;
private Paint paint = new Paint();
private int colors[] = {
......@@ -26,18 +26,6 @@ public class IdenticonView extends View {
0xff2f99c9
};
public IdenticonView(Context context) {
super(context);
}
public IdenticonView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public IdenticonView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
int get_bits(int bitOffset, int numBits) {
numBits = (int)Math.pow(2, numBits) - 1;
int offset = bitOffset / 8;
......@@ -56,20 +44,19 @@ public class IdenticonView extends View {
System.arraycopy(data, 0, temp, 0, data.length);
data = temp;
}
invalidate();
invalidateSelf();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
public void draw(Canvas canvas) {
if (data == null) {
return;
}
int bitPointer = 0;
float rectSize = (float)Math.floor(Math.min(getWidth(), getHeight()) / 8.0f);
float xOffset = Math.max(0, (getWidth() - rectSize * 8) / 2);
float yOffset = Math.max(0, (getHeight() - rectSize * 8) / 2);
float rectSize = (float)Math.floor(Math.min(getBounds().width(), getBounds().height()) / 8.0f);
float xOffset = Math.max(0, (getBounds().width() - rectSize * 8) / 2);
float yOffset = Math.max(0, (getBounds().height() - rectSize * 8) / 2);
for (int iy = 0; iy < 8; iy++) {
for (int ix = 0; ix < 8; ix++) {
int byteValue = get_bits(bitPointer, 2);
......@@ -80,4 +67,29 @@ public class IdenticonView extends View {
}
}
}
@Override
public void setAlpha(int alpha) {
}
@Override
public void setColorFilter(ColorFilter cf) {
}
@Override
public int getOpacity() {
return 0;
}
@Override
public int getIntrinsicWidth() {
return AndroidUtilities.dp(32);
}
@Override
public int getIntrinsicHeight() {
return AndroidUtilities.dp(32);
}
}
......@@ -8,7 +8,6 @@
package org.telegram.ui.Views;
import android.database.DataSetObserver;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
......@@ -223,11 +222,4 @@ public abstract class SectionedBaseAdapter extends BaseFragmentAdapter implement
mSectionCount = getSectionCount();
return mSectionCount;
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
if (observer != null) {
super.unregisterDataSetObserver(observer);
}
}
}
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import org.telegram.messenger.FileLog;
import org.telegram.ui.Adapters.BaseSectionsAdapter;
import java.util.ArrayList;
public class SectionsListView extends ListView implements AbsListView.OnScrollListener {
private ArrayList<View> headers = new ArrayList<View>();
private ArrayList<View> headersCache = new ArrayList<View>();
private OnScrollListener mOnScrollListener;
private BaseSectionsAdapter mAdapter;
private int currentFirst = -1;
private int currentVisible = -1;
private int startSection;
private int sectionsCount;
public SectionsListView(Context context) {
super(context);
super.setOnScrollListener(this);
}
public SectionsListView(Context context, AttributeSet attrs) {
super(context, attrs);
super.setOnScrollListener(this);
}
public SectionsListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
super.setOnScrollListener(this);
}
@Override
public void setAdapter(ListAdapter adapter) {
if (mAdapter == adapter) {
return;
}
headers.clear();
headersCache.clear();
if (adapter instanceof BaseSectionsAdapter) {
mAdapter = (BaseSectionsAdapter) adapter;
} else {
mAdapter = null;
}
super.setAdapter(adapter);
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (mOnScrollListener != null) {
mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
if (mAdapter == null) {
return;
}
headersCache.addAll(headers);
headers.clear();
if (mAdapter.getCount() == 0) {
return;
}
if (currentFirst != firstVisibleItem || currentVisible != visibleItemCount) {
currentFirst = firstVisibleItem;
currentVisible = visibleItemCount;
sectionsCount = 1;
startSection = mAdapter.getSectionForPosition(firstVisibleItem);
int itemNum = firstVisibleItem + mAdapter.getCountForSection(startSection) - mAdapter.getPositionInSectionForPosition(firstVisibleItem);
while (true) {
if (itemNum >= firstVisibleItem + visibleItemCount) {
break;
}
itemNum += mAdapter.getCountForSection(startSection + sectionsCount);
sectionsCount++;
}
}
int itemNum = firstVisibleItem;
for (int a = startSection; a < startSection + sectionsCount; a++) {
View header = null;
if (!headersCache.isEmpty()) {
header = headersCache.get(0);
headersCache.remove(0);
}
header = getSectionHeaderView(a, header);
headers.add(header);
int count = mAdapter.getCountForSection(a);
if (a == startSection) {
int pos = mAdapter.getPositionInSectionForPosition(itemNum);
if (pos == count - 1) {
header.setTag(-header.getHeight());
} else if (pos == count - 2) {
View child = getChildAt(itemNum - firstVisibleItem);
int headerTop = child.getTop();
if (headerTop < 0) {
header.setTag(headerTop);
} else {
header.setTag(0);
}
} else {
header.setTag(0);
}
itemNum += count - mAdapter.getPositionInSectionForPosition(firstVisibleItem);
} else {
View child = getChildAt(itemNum - firstVisibleItem);
header.setTag(child.getTop());
itemNum += count;
}
}
invalidate();
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (mOnScrollListener != null) {
mOnScrollListener.onScrollStateChanged(view, scrollState);
}
}
private View getSectionHeaderView(int section, View oldView) {
boolean shouldLayout = oldView == null;
View view = mAdapter.getSectionHeaderView(section, oldView, this);
if (shouldLayout) {
ensurePinnedHeaderLayout(view, false);
}
return view;
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mAdapter == null || headers.isEmpty()) {
return;
}
for (View header : headers) {
ensurePinnedHeaderLayout(header, true);
}
}
private void ensurePinnedHeaderLayout(View header, boolean forceLayout) {
if (header.isLayoutRequested() || forceLayout) {
ViewGroup.LayoutParams layoutParams = header.getLayoutParams();
int heightSpec = MeasureSpec.makeMeasureSpec(layoutParams.height, MeasureSpec.EXACTLY);
int widthSpec = MeasureSpec.makeMeasureSpec(layoutParams.width, MeasureSpec.EXACTLY);
try {
header.measure(widthSpec, heightSpec);
} catch (Exception e) {
FileLog.e("tmessages", e);
}
header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight());
}
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mAdapter == null || headers.isEmpty()) {
return;
}
for (View header : headers) {
int saveCount = canvas.save();
int top = (Integer)header.getTag();
canvas.translate(0, top);
canvas.clipRect(0, 0, getWidth(), header.getMeasuredHeight());
if (top < 0) {
canvas.saveLayerAlpha(0, top, header.getWidth(), top + canvas.getHeight(), (int)(255 * (1.0f + (float)top / (float)header.getMeasuredHeight())), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
}
header.draw(canvas);
canvas.restoreToCount(saveCount);
}
}
@Override
public void setOnScrollListener(OnScrollListener l) {
mOnScrollListener = l;
}
public void setOnItemClickListener(SectionsListView.OnItemClickListener listener) {
super.setOnItemClickListener(listener);
}
public static abstract class OnItemClickListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int rawPosition, long id) {
SectionedBaseAdapter adapter = (SectionedBaseAdapter) adapterView.getAdapter();
int section = adapter.getSectionForPosition(rawPosition);
int position = adapter.getPositionInSectionForPosition(rawPosition);
onItemClick(adapterView, view, section, position, id);
}
public abstract void onItemClick(AdapterView<?> adapterView, View view, int section, int position, long id);
}
}
TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png

1.3 KB | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png

1.43 KB | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-hdpi/popup_fixed.9.png
  • 2-up
  • Swipe
  • Onion skin
TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png

961 Bytes | W: | H:

TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png

1.28 KB | W: | H:

TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-mdpi/popup_fixed.9.png
  • 2-up
  • Swipe
  • Onion skin
TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png

2.39 KB | W: | H:

TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png

1.7 KB | W: | H:

TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xhdpi/popup_fixed.9.png
  • 2-up
  • Swipe
  • Onion skin
TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png

3.57 KB | W: | H:

TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png

2.14 KB | W: | H:

TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png
TMessagesProj/src/main/res/drawable-xxhdpi/popup_fixed.9.png
  • 2-up
  • Swipe
  • Onion skin
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical|right"
android:layout_gravity="top|right"/>
<org.telegram.ui.Views.IdenticonView
android:id="@+id/identicon_view"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_gravity="left|center_vertical"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>
\ No newline at end of file
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<org.telegram.ui.Views.PinnedHeaderListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:clipToPadding="false"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:paddingLeft="16dp"
android:paddingRight="30dp"
android:dividerHeight="0dp"
android:divider="@null"
android:paddingBottom="16dp"
android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true"
android:scrollbarStyle="outsideOverlay"
android:layout_gravity="top"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#808080"
android:gravity="center"
android:textSize="24dp"
android:id="@+id/searchEmptyView"
android:visibility="invisible"
android:layout_gravity="top"/>
</FrameLayout>
......@@ -15,9 +15,10 @@
android:paddingTop="20dp"
android:paddingBottom="20dp">
<org.telegram.ui.Views.IdenticonView
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:id="@+id/identicon_view"/>
</FrameLayout>
......
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:layout_gravity="top"/>
<org.telegram.ui.Views.IdenticonView
android:id="@+id/identicon_view"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_gravity="right|center_vertical"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>
\ No newline at end of file
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:background="#fafafa"
android:orientation="vertical">
<ListView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:id="@+id/listView"
android:clipToPadding="false"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:dividerHeight="0dp"
android:divider="@null"
android:scrollbars="none"
android:paddingBottom="16dp"
android:layout_gravity="top"
android:layout_weight="1"/>
<FrameLayout
android:layout_height="48dp"
android:layout_width="fill_parent"
android:background="@drawable/gray_button"
android:id="@+id/start_secret_button">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18dp"
android:textColor="#444444"
android:layout_gravity="center"
android:drawableLeft="@drawable/bigtimer"
android:gravity="center"
android:id="@+id/start_secret_button_text"/>
</FrameLayout>
</LinearLayout>
......@@ -187,11 +187,11 @@
<string name="BlockContact">Block</string>
<string name="EditContact">Edit</string>
<string name="DeleteContact">Delete</string>
<string name="PhoneHome">HOME</string>
<string name="PhoneMobile">MOBILE</string>
<string name="PhoneWork">WORK</string>
<string name="PhoneOther">OTHER</string>
<string name="PhoneMain">MAIN</string>
<string name="PhoneHome">Home</string>
<string name="PhoneMobile">Mobile</string>
<string name="PhoneWork">Work</string>
<string name="PhoneOther">Other</string>
<string name="PhoneMain">Main</string>
<string name="ContactInfo">Contact Info</string>
<string name="PHONE">PHONE</string>
<string name="StartEncryptedChat">Start Secret Chat</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment