Skip to content

Commit ca46b69

Browse files
author
DrKLO
committed
More Android L design
1 parent 41359b1 commit ca46b69

File tree

190 files changed

+3075
-1765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+3075
-1765
lines changed

TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import android.view.View;
2525
import android.view.WindowManager;
2626
import android.view.inputmethod.InputMethodManager;
27+
import android.widget.AbsListView;
28+
import android.widget.EdgeEffect;
2729
import android.widget.EditText;
30+
import android.widget.ListView;
2831
import android.widget.TextView;
2932

3033
import org.telegram.messenger.FileLog;
@@ -466,4 +469,26 @@ public static Point getRealScreenSize() {
466469
}
467470
return size;
468471
}
472+
473+
public static void setListViewEdgeEffectColor(ListView listView, int color) {
474+
if (Build.VERSION.SDK_INT >= 21) {
475+
try {
476+
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
477+
field.setAccessible(true);
478+
EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
479+
if (mEdgeGlowTop != null) {
480+
mEdgeGlowTop.setColor(color);
481+
}
482+
483+
field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
484+
field.setAccessible(true);
485+
EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
486+
if (mEdgeGlowBottom != null) {
487+
mEdgeGlowBottom.setColor(color);
488+
}
489+
} catch (Exception e) {
490+
FileLog.e("tmessages", e);
491+
}
492+
}
493+
}
469494
}

TMessagesProj/src/main/java/org/telegram/android/MessagesController.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ private class UserActionUpdates extends TLRPC.Updates {
110110
public static final int UPDATE_MASK_USER_PRINT = 64;
111111
public static final int UPDATE_MASK_USER_PHONE = 128;
112112
public static final int UPDATE_MASK_READ_DIALOG_MESSAGE = 256;
113+
public static final int UPDATE_MASK_SELECT_DIALOG = 512;
113114
public static final int UPDATE_MASK_ALL = UPDATE_MASK_AVATAR | UPDATE_MASK_STATUS | UPDATE_MASK_NAME | UPDATE_MASK_CHAT_AVATAR | UPDATE_MASK_CHAT_NAME | UPDATE_MASK_CHAT_MEMBERS | UPDATE_MASK_USER_PRINT | UPDATE_MASK_USER_PHONE | UPDATE_MASK_READ_DIALOG_MESSAGE;
114115

115116
public static class PrintingUser {
@@ -1006,6 +1007,9 @@ public void run(TLObject response, TLRPC.TL_error error) {
10061007
}
10071008

10081009
public void deleteDialog(final long did, int offset, final boolean onlyHistory) {
1010+
if (offset == 0) {
1011+
MessagesStorage.getInstance().deleteDialog(did, onlyHistory);
1012+
}
10091013
TLRPC.TL_dialog dialog = dialogs_dict.get(did);
10101014
if (dialog != null) {
10111015
int lower_part = (int)did;
@@ -1035,7 +1039,6 @@ public void run() {
10351039
});
10361040
}
10371041
});
1038-
MessagesStorage.getInstance().deleteDialog(did, onlyHistory);
10391042
NotificationCenter.getInstance().postNotificationName(NotificationCenter.removeAllMessagesFromDialog, did);
10401043
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
10411044
}
@@ -1760,7 +1763,7 @@ public void run() {
17601763
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
17611764
if (dialog != null) {
17621765
dialog.unread_count = 0;
1763-
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
1766+
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_READ_DIALOG_MESSAGE);
17641767
}
17651768
if (!popup) {
17661769
NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id, false);
@@ -1824,7 +1827,7 @@ public void run() {
18241827
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
18251828
if (dialog != null) {
18261829
dialog.unread_count = 0;
1827-
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
1830+
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_READ_DIALOG_MESSAGE);
18281831
}
18291832
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
18301833
dialogsToUpdate.put(dialog_id, 0);
@@ -2049,6 +2052,9 @@ public void run(TLObject response, TLRPC.TL_error error) {
20492052
return;
20502053
}
20512054
final TLRPC.messages_StatedMessage res = (TLRPC.messages_StatedMessage) response;
2055+
if (user.id == UserConfig.getClientUserId()) {
2056+
res.chats = null;
2057+
}
20522058
MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true);
20532059

20542060
AndroidUtilities.runOnUIThread(new Runnable() {

TMessagesProj/src/main/java/org/telegram/ui/Animation/FloatProperty.java renamed to TMessagesProj/src/main/java/org/telegram/ui/Animation/FloatProperty10.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
package org.telegram.ui.Animation;
1717

18-
public abstract class FloatProperty<T> extends Property<T, Float> {
18+
public abstract class FloatProperty10<T> extends Property<T, Float> {
1919

20-
public FloatProperty(String name) {
20+
public FloatProperty10(String name) {
2121
super(Float.class, name);
2222
}
2323

TMessagesProj/src/main/java/org/telegram/ui/Animation/ObjectAnimator10.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
import android.view.View;
2020

21+
import org.telegram.ui.Views.ActionBar.ActionBarLayout;
22+
2123
import java.util.HashMap;
2224

2325
public final class ObjectAnimator10 extends ValueAnimator {
2426

2527
private static final HashMap<String, Property> PROXY_PROPERTIES = new HashMap<String, Property>();
2628

2729
static {
28-
Property<View, Float> ALPHA = new FloatProperty<View>("alpha") {
30+
Property<View, Float> ALPHA = new FloatProperty10<View>("alpha") {
2931
@Override
3032
public void setValue(View object, float value) {
3133
View10.wrap(object).setAlpha(value);
@@ -37,7 +39,7 @@ public Float get(View object) {
3739
}
3840
};
3941

40-
Property<View, Float> PIVOT_X = new FloatProperty<View>("pivotX") {
42+
Property<View, Float> PIVOT_X = new FloatProperty10<View>("pivotX") {
4143
@Override
4244
public void setValue(View object, float value) {
4345
View10.wrap(object).setPivotX(value);
@@ -49,7 +51,7 @@ public Float get(View object) {
4951
}
5052
};
5153

52-
Property<View, Float> PIVOT_Y = new FloatProperty<View>("pivotY") {
54+
Property<View, Float> PIVOT_Y = new FloatProperty10<View>("pivotY") {
5355
@Override
5456
public void setValue(View object, float value) {
5557
View10.wrap(object).setPivotY(value);
@@ -61,7 +63,7 @@ public Float get(View object) {
6163
}
6264
};
6365

64-
Property<View, Float> TRANSLATION_X = new FloatProperty<View>("translationX") {
66+
Property<View, Float> TRANSLATION_X = new FloatProperty10<View>("translationX") {
6567
@Override
6668
public void setValue(View object, float value) {
6769
View10.wrap(object).setTranslationX(value);
@@ -73,7 +75,7 @@ public Float get(View object) {
7375
}
7476
};
7577

76-
Property<View, Float> TRANSLATION_Y = new FloatProperty<View>("translationY") {
78+
Property<View, Float> TRANSLATION_Y = new FloatProperty10<View>("translationY") {
7779
@Override
7880
public void setValue(View object, float value) {
7981
View10.wrap(object).setTranslationY(value);
@@ -85,7 +87,7 @@ public Float get(View object) {
8587
}
8688
};
8789

88-
Property<View, Float> ROTATION = new FloatProperty<View>("rotation") {
90+
Property<View, Float> ROTATION = new FloatProperty10<View>("rotation") {
8991
@Override
9092
public void setValue(View object, float value) {
9193
View10.wrap(object).setRotation(value);
@@ -97,7 +99,7 @@ public Float get(View object) {
9799
}
98100
};
99101

100-
Property<View, Float> ROTATION_X = new FloatProperty<View>("rotationX") {
102+
Property<View, Float> ROTATION_X = new FloatProperty10<View>("rotationX") {
101103
@Override
102104
public void setValue(View object, float value) {
103105
View10.wrap(object).setRotationX(value);
@@ -109,7 +111,7 @@ public Float get(View object) {
109111
}
110112
};
111113

112-
Property<View, Float> ROTATION_Y = new FloatProperty<View>("rotationY") {
114+
Property<View, Float> ROTATION_Y = new FloatProperty10<View>("rotationY") {
113115
@Override
114116
public void setValue(View object, float value) {
115117
View10.wrap(object).setRotationY(value);
@@ -121,7 +123,7 @@ public Float get(View object) {
121123
}
122124
};
123125

124-
Property<View, Float> SCALE_X = new FloatProperty<View>("scaleX") {
126+
Property<View, Float> SCALE_X = new FloatProperty10<View>("scaleX") {
125127
@Override
126128
public void setValue(View object, float value) {
127129
View10.wrap(object).setScaleX(value);
@@ -133,7 +135,7 @@ public Float get(View object) {
133135
}
134136
};
135137

136-
Property<View, Float> SCALE_Y = new FloatProperty<View>("scaleY") {
138+
Property<View, Float> SCALE_Y = new FloatProperty10<View>("scaleY") {
137139
@Override
138140
public void setValue(View object, float value) {
139141
View10.wrap(object).setScaleY(value);
@@ -169,7 +171,7 @@ public Integer get(View object) {
169171
}
170172
};
171173

172-
Property<View, Float> X = new FloatProperty<View>("x") {
174+
Property<View, Float> X = new FloatProperty10<View>("x") {
173175
@Override
174176
public void setValue(View object, float value) {
175177
View10.wrap(object).setX(value);
@@ -181,7 +183,7 @@ public Float get(View object) {
181183
}
182184
};
183185

184-
Property<View, Float> Y = new FloatProperty<View>("y") {
186+
Property<View, Float> Y = new FloatProperty10<View>("y") {
185187
@Override
186188
public void setValue(View object, float value) {
187189
View10.wrap(object).setY(value);

TMessagesProj/src/main/java/org/telegram/ui/Animation/PropertyValuesHolder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ private Method getPropertyFunction(Class targetClass, String prefix, Class value
148148
Class args[] = null;
149149
if (valueType == null) {
150150
try {
151-
returnVal = targetClass.getMethod(methodName, args);
151+
returnVal = targetClass.getMethod(methodName);
152152
} catch (NoSuchMethodException e) {
153153
try {
154-
returnVal = targetClass.getDeclaredMethod(methodName, args);
154+
returnVal = targetClass.getDeclaredMethod(methodName);
155155
returnVal.setAccessible(true);
156156
} catch (NoSuchMethodException e2) {
157157
e2.printStackTrace();
@@ -464,7 +464,7 @@ void setupSetter(Class targetClass) {
464464
static class FloatPropertyValuesHolder extends PropertyValuesHolder {
465465

466466
private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>();
467-
private FloatProperty mFloatProperty;
467+
private FloatProperty10 mFloatProperty;
468468

469469
FloatKeyframeSet mFloatKeyframeSet;
470470
float mFloatAnimatedValue;
@@ -481,8 +481,8 @@ public FloatPropertyValuesHolder(Property property, FloatKeyframeSet keyframeSet
481481
mValueType = float.class;
482482
mKeyframeSet = keyframeSet;
483483
mFloatKeyframeSet = (FloatKeyframeSet) mKeyframeSet;
484-
if (property instanceof FloatProperty) {
485-
mFloatProperty = (FloatProperty) mProperty;
484+
if (property instanceof FloatProperty10) {
485+
mFloatProperty = (FloatProperty10) mProperty;
486486
}
487487
}
488488

@@ -494,8 +494,8 @@ public FloatPropertyValuesHolder(String propertyName, float... values) {
494494
public FloatPropertyValuesHolder(Property property, float... values) {
495495
super(property);
496496
setFloatValues(values);
497-
if (property instanceof FloatProperty) {
498-
mFloatProperty = (FloatProperty) mProperty;
497+
if (property instanceof FloatProperty10) {
498+
mFloatProperty = (FloatProperty10) mProperty;
499499
}
500500
}
501501

TMessagesProj/src/main/java/org/telegram/ui/AnimationCompat/AnimatorSetProxy.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.telegram.ui.Animation.AnimatorSet10;
1919
import org.telegram.ui.Animation.View10;
2020

21+
import java.util.ArrayList;
2122
import java.util.Arrays;
2223

2324
public class AnimatorSetProxy {
@@ -41,6 +42,22 @@ public void playTogether(Object... items) {
4142
}
4243
}
4344

45+
public void playTogether(ArrayList<Object> items) {
46+
if (View10.NEED_PROXY) {
47+
ArrayList<Animator10> animators = new ArrayList<Animator10>();
48+
for (Object obj : items) {
49+
animators.add((Animator10)obj);
50+
}
51+
((AnimatorSet10) animatorSet).playTogether(animators);
52+
} else {
53+
ArrayList<Animator> animators = new ArrayList<Animator>();
54+
for (Object obj : items) {
55+
animators.add((Animator)obj);
56+
}
57+
((AnimatorSet) animatorSet).playTogether(animators);
58+
}
59+
}
60+
4461
public AnimatorSetProxy setDuration(long duration) {
4562
if (View10.NEED_PROXY) {
4663
((AnimatorSet10) animatorSet).setDuration(duration);

TMessagesProj/src/main/java/org/telegram/ui/AnimationCompat/ObjectAnimatorProxy.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,36 @@ public void start() {
7878
((ObjectAnimator) objectAnimator).start();
7979
}
8080
}
81+
82+
public void setAutoCancel(boolean cancel) {
83+
if (View10.NEED_PROXY) {
84+
((ObjectAnimator10) objectAnimator).setAutoCancel(cancel);
85+
} else {
86+
((ObjectAnimator) objectAnimator).setAutoCancel(cancel);
87+
}
88+
}
89+
90+
public boolean isRunning() {
91+
if (View10.NEED_PROXY) {
92+
return ((ObjectAnimator10) objectAnimator).isRunning();
93+
} else {
94+
return ((ObjectAnimator) objectAnimator).isRunning();
95+
}
96+
}
97+
98+
public void end() {
99+
if (View10.NEED_PROXY) {
100+
((ObjectAnimator10) objectAnimator).end();
101+
} else {
102+
((ObjectAnimator) objectAnimator).end();
103+
}
104+
}
105+
106+
public void cancel() {
107+
if (View10.NEED_PROXY) {
108+
((ObjectAnimator10) objectAnimator).cancel();
109+
} else {
110+
((ObjectAnimator) objectAnimator).cancel();
111+
}
112+
}
81113
}

TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatContactCell.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public ChatContactCell(Context context) {
7272
addContactDrawableOut = getResources().getDrawable(R.drawable.addcontact_green);
7373
}
7474
avatarImage = new ImageReceiver(this);
75+
avatarDrawable = new AvatarDrawable();
7576
}
7677

7778
public void setContactDelegate(ChatContactCellDelegate delegate) {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This is the source code of Telegram for Android v. 1.7.x.
3+
* It is licensed under GNU GPL v. 2 or later.
4+
* You should have received a copy of the license in this archive (see LICENSE).
5+
*
6+
* Copyright Nikolai Kudashov, 2013-2014.
7+
*/
8+
9+
package org.telegram.ui.Cells;
10+
11+
import android.content.Context;
12+
import android.util.TypedValue;
13+
import android.view.Gravity;
14+
import android.widget.FrameLayout;
15+
import android.widget.TextView;
16+
17+
import org.telegram.android.AndroidUtilities;
18+
19+
public class DetailTextCell extends FrameLayout {
20+
21+
private TextView textView;
22+
23+
public DetailTextCell(Context context) {
24+
super(context);
25+
26+
textView = new TextView(context);
27+
textView.setTextColor(0xffa3a3a3);
28+
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
29+
textView.setGravity(Gravity.CENTER);
30+
textView.setPadding(0, AndroidUtilities.dp(19), 0, AndroidUtilities.dp(19));
31+
addView(textView);
32+
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
33+
layoutParams.width = LayoutParams.WRAP_CONTENT;
34+
layoutParams.height = LayoutParams.WRAP_CONTENT;
35+
layoutParams.leftMargin = AndroidUtilities.dp(17);
36+
layoutParams.rightMargin = AndroidUtilities.dp(17);
37+
layoutParams.gravity = Gravity.CENTER;
38+
textView.setLayoutParams(layoutParams);
39+
}
40+
41+
@Override
42+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
43+
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
44+
}
45+
46+
public void setText(String text) {
47+
textView.setText(text);
48+
}
49+
}

0 commit comments

Comments
 (0)