Skip to content

Commit ea8760f

Browse files
author
DrKLO
committed
Bug fixes
1 parent 77f2395 commit ea8760f

File tree

7 files changed

+35
-43
lines changed

7 files changed

+35
-43
lines changed

TMessagesProj/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ android {
8080
defaultConfig {
8181
minSdkVersion 8
8282
targetSdkVersion 21
83-
versionCode 384
83+
versionCode 386
8484
versionName "2.0.0"
8585
}
8686
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import android.graphics.Paint;
1414
import android.util.TypedValue;
1515
import android.view.Gravity;
16-
import android.widget.FrameLayout;
1716
import android.widget.TextView;
1817

1918
import org.telegram.android.AndroidUtilities;
@@ -80,6 +79,10 @@ public void setTextAndCheck(String text, boolean checked, boolean divider) {
8079
setWillNotDraw(!divider);
8180
}
8281

82+
public void setChecked(boolean checked) {
83+
checkBox.setChecked(checked);
84+
}
85+
8386
@Override
8487
protected void onDraw(Canvas canvas) {
8588
if (needDivider) {

TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import org.telegram.ui.Cells.TextDetailSettingsCell;
4646
import org.telegram.ui.ActionBar.ActionBar;
4747
import org.telegram.ui.ActionBar.BaseFragment;
48-
import org.telegram.ui.Views.AvatarDrawable;
4948
import org.telegram.ui.Views.ColorPickerView;
5049

5150
public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
@@ -154,7 +153,6 @@ public void onItemClick(int id) {
154153
listView.setDivider(null);
155154
listView.setDividerHeight(0);
156155
listView.setVerticalScrollBarEnabled(false);
157-
AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(5));
158156
frameLayout.addView(listView);
159157
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
160158
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
@@ -164,10 +162,10 @@ public void onItemClick(int id) {
164162
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
165163
@Override
166164
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
165+
boolean enabled = false;
167166
if (i == messageAlertRow || i == groupAlertRow) {
168167
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
169168
SharedPreferences.Editor editor = preferences.edit();
170-
boolean enabled;
171169
if (i == messageAlertRow) {
172170
enabled = preferences.getBoolean("EnableAll", true);
173171
editor.putBoolean("EnableAll", !enabled);
@@ -176,12 +174,10 @@ public void onItemClick(AdapterView<?> adapterView, View view, final int i, long
176174
editor.putBoolean("EnableGroup", !enabled);
177175
}
178176
editor.commit();
179-
listView.invalidateViews();
180177
updateServerNotificationsSettings(i == groupAlertRow);
181178
} else if (i == messagePreviewRow || i == groupPreviewRow) {
182179
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
183180
SharedPreferences.Editor editor = preferences.edit();
184-
boolean enabled;
185181
if (i == messagePreviewRow) {
186182
enabled = preferences.getBoolean("EnablePreviewAll", true);
187183
editor.putBoolean("EnablePreviewAll", !enabled);
@@ -190,7 +186,6 @@ public void onItemClick(AdapterView<?> adapterView, View view, final int i, long
190186
editor.putBoolean("EnablePreviewGroup", !enabled);
191187
}
192188
editor.commit();
193-
listView.invalidateViews();
194189
updateServerNotificationsSettings(i == groupPreviewRow);
195190
} else if (i == messageSoundRow || i == groupSoundRow) {
196191
try {
@@ -263,55 +258,48 @@ public void run() {
263258
} else if (i == inappSoundRow) {
264259
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
265260
SharedPreferences.Editor editor = preferences.edit();
266-
boolean enabled = preferences.getBoolean("EnableInAppSounds", true);
261+
enabled = preferences.getBoolean("EnableInAppSounds", true);
267262
editor.putBoolean("EnableInAppSounds", !enabled);
268263
editor.commit();
269-
listView.invalidateViews();
270264
} else if (i == inappVibrateRow) {
271265
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
272266
SharedPreferences.Editor editor = preferences.edit();
273-
boolean enabled = preferences.getBoolean("EnableInAppVibrate", true);
267+
enabled = preferences.getBoolean("EnableInAppVibrate", true);
274268
editor.putBoolean("EnableInAppVibrate", !enabled);
275269
editor.commit();
276-
listView.invalidateViews();
277270
} else if (i == inappPreviewRow) {
278271
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
279272
SharedPreferences.Editor editor = preferences.edit();
280-
boolean enabled = preferences.getBoolean("EnableInAppPreview", true);
273+
enabled = preferences.getBoolean("EnableInAppPreview", true);
281274
editor.putBoolean("EnableInAppPreview", !enabled);
282275
editor.commit();
283-
listView.invalidateViews();
284276
} else if (i == contactJoinedRow) {
285277
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
286278
SharedPreferences.Editor editor = preferences.edit();
287-
boolean enabled = preferences.getBoolean("EnableContactJoined", true);
279+
enabled = preferences.getBoolean("EnableContactJoined", true);
288280
MessagesController.getInstance().enableJoined = !enabled;
289281
editor.putBoolean("EnableContactJoined", !enabled);
290282
editor.commit();
291-
listView.invalidateViews();
292283
} else if (i == pebbleAlertRow) {
293284
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
294285
SharedPreferences.Editor editor = preferences.edit();
295-
boolean enabled = preferences.getBoolean("EnablePebbleNotifications", false);
286+
enabled = preferences.getBoolean("EnablePebbleNotifications", false);
296287
editor.putBoolean("EnablePebbleNotifications", !enabled);
297288
editor.commit();
298-
listView.invalidateViews();
299289
} else if (i == badgeNumberRow) {
300290
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
301291
SharedPreferences.Editor editor = preferences.edit();
302-
boolean enabled = preferences.getBoolean("badgeNumber", true);
292+
enabled = preferences.getBoolean("badgeNumber", true);
303293
editor.putBoolean("badgeNumber", !enabled);
304294
editor.commit();
305-
listView.invalidateViews();
306295
NotificationsController.getInstance().setBadgeEnabled(!enabled);
307296
} else if (i == notificationsServiceRow) {
308297
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
309-
boolean enabled = preferences.getBoolean("pushService", true);
298+
enabled = preferences.getBoolean("pushService", true);
310299
if (!enabled) {
311300
final SharedPreferences.Editor editor = preferences.edit();
312301
editor.putBoolean("pushService", !enabled);
313302
editor.commit();
314-
listView.invalidateViews();
315303
ApplicationLoader.startPushService();
316304
} else {
317305
if (getParentActivity() == null) {
@@ -442,6 +430,9 @@ public void onClick(DialogInterface dialog, int which) {
442430
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
443431
showAlertDialog(builder);
444432
}
433+
if (view instanceof TextCheckCell) {
434+
((TextCheckCell) view).setChecked(!enabled);
435+
}
445436
}
446437
});
447438
} else {

TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ public void onFragmentDestroy() {
219219
@Override
220220
public View createView(LayoutInflater inflater, ViewGroup container) {
221221
if (fragmentView == null) {
222-
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id));
223-
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? user_id : chat_id));
222+
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? 5 : chat_id));
223+
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? 5 : chat_id));
224224
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
225225
actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
226226
if (AndroidUtilities.isTablet()) {
@@ -390,7 +390,7 @@ public void onClick(View v) {
390390
nameTextView.setLayoutParams(layoutParams);
391391

392392
onlineTextView = new TextView(getParentActivity());
393-
onlineTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 ? user_id : chat_id));
393+
onlineTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 ? 5 : chat_id));
394394
onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
395395
onlineTextView.setLines(1);
396396
onlineTextView.setMaxLines(1);
@@ -411,7 +411,7 @@ public void onClick(View v) {
411411
listView.setDivider(null);
412412
listView.setDividerHeight(0);
413413
listView.setVerticalScrollBarEnabled(false);
414-
AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id));
414+
AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(user_id != 0 ? 5 : chat_id));
415415
frameLayout.addView(listView);
416416
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
417417
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
@@ -1042,7 +1042,9 @@ private void updateProfileData() {
10421042
photo = user.photo.photo_small;
10431043
photoBig = user.photo.photo_big;
10441044
}
1045-
avatarImage.setImage(photo, "50_50", new AvatarDrawable(user, true));
1045+
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
1046+
avatarDrawable.setColor(0xff5c98cd);
1047+
avatarImage.setImage(photo, "50_50", avatarDrawable);
10461048

10471049
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
10481050
onlineTextView.setText(LocaleController.formatUserStatus(user));

TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ public void onClick(DialogInterface dialog, int which) {
417417
SharedPreferences.Editor editor = preferences.edit();
418418
editor.putBoolean("view_animations", !animations);
419419
editor.commit();
420-
if (listView != null) {
421-
listView.invalidateViews();
420+
if (view instanceof TextCheckCell) {
421+
((TextCheckCell) view).setChecked(!animations);
422422
}
423423
} else if (i == notificationRow) {
424424
presentFragment(new NotificationsSettingsActivity());
@@ -454,13 +454,13 @@ public void onClick(DialogInterface dialogInterface, int i) {
454454
SharedPreferences.Editor editor = preferences.edit();
455455
editor.putBoolean("send_by_enter", !send);
456456
editor.commit();
457-
if (listView != null) {
458-
listView.invalidateViews();
457+
if (view instanceof TextCheckCell) {
458+
((TextCheckCell) view).setChecked(!send);
459459
}
460460
} else if (i == saveToGalleryRow) {
461461
MediaController.getInstance().toggleSaveToGallery();
462-
if (listView != null) {
463-
listView.invalidateViews();
462+
if (view instanceof TextCheckCell) {
463+
((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery());
464464
}
465465
} else if (i == privacyRow) {
466466
presentFragment(new PrivacySettingsActivity());

TMessagesProj/src/main/res/layout/chat_layout.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,18 @@
108108
android:layout_height="wrap_content"
109109
android:layout_gravity="bottom"
110110
android:id="@+id/chat_text_edit"
111-
android:layout_marginTop="2dp"
112111
android:maxLines="4"
113112
android:textSize="18dp"
114113
android:textColorHint="#b2b2b2"
115-
android:ems="10"
116114
android:imeOptions="flagNoExtractUi"
117115
android:inputType="textCapSentences|textMultiLine"
118116
android:maxLength="16384"
117+
android:gravity="bottom"
119118
android:layout_marginLeft="52dp"
120119
android:layout_marginRight="2dp"
121-
android:layout_marginBottom="4dp"
122-
android:paddingBottom="8dp"
123-
android:paddingTop="4dp"
124120
android:background="@null"
121+
android:layout_marginBottom="12dp"
122+
android:paddingTop="11dp"
125123
android:textCursorDrawable="@null"
126124
android:textColor="#000000"/>
127125

TMessagesProj/src/main/res/layout/popup_notification_layout.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,18 @@
5050
android:layout_height="wrap_content"
5151
android:layout_gravity="bottom"
5252
android:id="@+id/chat_text_edit"
53-
android:layout_marginTop="2dp"
5453
android:maxLines="4"
5554
android:textSize="18dp"
5655
android:textColorHint="#b2b2b2"
57-
android:ems="10"
5856
android:imeOptions="flagNoExtractUi"
5957
android:inputType="textCapSentences|textMultiLine"
6058
android:maxLength="16384"
59+
android:gravity="bottom"
6160
android:layout_marginLeft="52dp"
6261
android:layout_marginRight="2dp"
63-
android:layout_marginBottom="4dp"
64-
android:paddingBottom="8dp"
65-
android:paddingTop="4dp"
6662
android:background="@null"
63+
android:layout_marginBottom="12dp"
64+
android:paddingTop="11dp"
6765
android:textCursorDrawable="@null"
6866
android:textColor="#000000"/>
6967

0 commit comments

Comments
 (0)