diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 66a09791..af4e323e 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 21 - versionCode 384 + versionCode 386 versionName "2.0.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java index a6323731..150c7ef4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java @@ -13,7 +13,6 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.util.TypedValue; import android.view.Gravity; -import android.widget.FrameLayout; import android.widget.TextView; import org.telegram.android.AndroidUtilities; @@ -80,6 +79,10 @@ public class TextCheckCell extends FrameLayoutFixed { setWillNotDraw(!divider); } + public void setChecked(boolean checked) { + checkBox.setChecked(checked); + } + @Override protected void onDraw(Canvas canvas) { if (needDivider) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java index 921c9781..53f473bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java @@ -45,7 +45,6 @@ import org.telegram.ui.Cells.TextColorCell; import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BaseFragment; -import org.telegram.ui.Views.AvatarDrawable; import org.telegram.ui.Views.ColorPickerView; public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { @@ -154,7 +153,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); - AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(5)); frameLayout.addView(listView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; @@ -164,10 +162,10 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, final int i, long l) { + boolean enabled = false; if (i == messageAlertRow || i == groupAlertRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled; if (i == messageAlertRow) { enabled = preferences.getBoolean("EnableAll", true); editor.putBoolean("EnableAll", !enabled); @@ -176,12 +174,10 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif editor.putBoolean("EnableGroup", !enabled); } editor.commit(); - listView.invalidateViews(); updateServerNotificationsSettings(i == groupAlertRow); } else if (i == messagePreviewRow || i == groupPreviewRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled; if (i == messagePreviewRow) { enabled = preferences.getBoolean("EnablePreviewAll", true); editor.putBoolean("EnablePreviewAll", !enabled); @@ -190,7 +186,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif editor.putBoolean("EnablePreviewGroup", !enabled); } editor.commit(); - listView.invalidateViews(); updateServerNotificationsSettings(i == groupPreviewRow); } else if (i == messageSoundRow || i == groupSoundRow) { try { @@ -263,55 +258,48 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif } else if (i == inappSoundRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("EnableInAppSounds", true); + enabled = preferences.getBoolean("EnableInAppSounds", true); editor.putBoolean("EnableInAppSounds", !enabled); editor.commit(); - listView.invalidateViews(); } else if (i == inappVibrateRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("EnableInAppVibrate", true); + enabled = preferences.getBoolean("EnableInAppVibrate", true); editor.putBoolean("EnableInAppVibrate", !enabled); editor.commit(); - listView.invalidateViews(); } else if (i == inappPreviewRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("EnableInAppPreview", true); + enabled = preferences.getBoolean("EnableInAppPreview", true); editor.putBoolean("EnableInAppPreview", !enabled); editor.commit(); - listView.invalidateViews(); } else if (i == contactJoinedRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("EnableContactJoined", true); + enabled = preferences.getBoolean("EnableContactJoined", true); MessagesController.getInstance().enableJoined = !enabled; editor.putBoolean("EnableContactJoined", !enabled); editor.commit(); - listView.invalidateViews(); } else if (i == pebbleAlertRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("EnablePebbleNotifications", false); + enabled = preferences.getBoolean("EnablePebbleNotifications", false); editor.putBoolean("EnablePebbleNotifications", !enabled); editor.commit(); - listView.invalidateViews(); } else if (i == badgeNumberRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - boolean enabled = preferences.getBoolean("badgeNumber", true); + enabled = preferences.getBoolean("badgeNumber", true); editor.putBoolean("badgeNumber", !enabled); editor.commit(); - listView.invalidateViews(); NotificationsController.getInstance().setBadgeEnabled(!enabled); } else if (i == notificationsServiceRow) { final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); - boolean enabled = preferences.getBoolean("pushService", true); + enabled = preferences.getBoolean("pushService", true); if (!enabled) { final SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("pushService", !enabled); editor.commit(); - listView.invalidateViews(); ApplicationLoader.startPushService(); } else { if (getParentActivity() == null) { @@ -442,6 +430,9 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showAlertDialog(builder); } + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!enabled); + } } }); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 689fac3c..289197cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -219,8 +219,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. @Override public View createView(LayoutInflater inflater, ViewGroup container) { if (fragmentView == null) { - actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id)); - actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? user_id : chat_id)); + actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? 5 : chat_id)); + actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? 5 : chat_id)); actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setExtraHeight(AndroidUtilities.dp(88), false); if (AndroidUtilities.isTablet()) { @@ -390,7 +390,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. nameTextView.setLayoutParams(layoutParams); onlineTextView = new TextView(getParentActivity()); - onlineTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 ? user_id : chat_id)); + onlineTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(user_id != 0 ? 5 : chat_id)); onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); onlineTextView.setLines(1); onlineTextView.setMaxLines(1); @@ -411,7 +411,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); - AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id)); + AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(user_id != 0 ? 5 : chat_id)); frameLayout.addView(listView); layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; @@ -1042,7 +1042,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. photo = user.photo.photo_small; photoBig = user.photo.photo_big; } - avatarImage.setImage(photo, "50_50", new AvatarDrawable(user, true)); + AvatarDrawable avatarDrawable = new AvatarDrawable(user, true); + avatarDrawable.setColor(0xff5c98cd); + avatarImage.setImage(photo, "50_50", avatarDrawable); nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); onlineTextView.setText(LocaleController.formatUserStatus(user)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index 6c5d09d5..87123bba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -417,8 +417,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("view_animations", !animations); editor.commit(); - if (listView != null) { - listView.invalidateViews(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!animations); } } else if (i == notificationRow) { presentFragment(new NotificationsSettingsActivity()); @@ -454,13 +454,13 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("send_by_enter", !send); editor.commit(); - if (listView != null) { - listView.invalidateViews(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!send); } } else if (i == saveToGalleryRow) { MediaController.getInstance().toggleSaveToGallery(); - if (listView != null) { - listView.invalidateViews(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery()); } } else if (i == privacyRow) { presentFragment(new PrivacySettingsActivity()); diff --git a/TMessagesProj/src/main/res/layout/chat_layout.xml b/TMessagesProj/src/main/res/layout/chat_layout.xml index 30705e1e..3f1af3dd 100644 --- a/TMessagesProj/src/main/res/layout/chat_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_layout.xml @@ -108,20 +108,18 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:id="@+id/chat_text_edit" - android:layout_marginTop="2dp" android:maxLines="4" android:textSize="18dp" android:textColorHint="#b2b2b2" - android:ems="10" android:imeOptions="flagNoExtractUi" android:inputType="textCapSentences|textMultiLine" android:maxLength="16384" + android:gravity="bottom" android:layout_marginLeft="52dp" android:layout_marginRight="2dp" - android:layout_marginBottom="4dp" - android:paddingBottom="8dp" - android:paddingTop="4dp" android:background="@null" + android:layout_marginBottom="12dp" + android:paddingTop="11dp" android:textCursorDrawable="@null" android:textColor="#000000"/> diff --git a/TMessagesProj/src/main/res/layout/popup_notification_layout.xml b/TMessagesProj/src/main/res/layout/popup_notification_layout.xml index 6786118e..664c5af3 100644 --- a/TMessagesProj/src/main/res/layout/popup_notification_layout.xml +++ b/TMessagesProj/src/main/res/layout/popup_notification_layout.xml @@ -50,20 +50,18 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:id="@+id/chat_text_edit" - android:layout_marginTop="2dp" android:maxLines="4" android:textSize="18dp" android:textColorHint="#b2b2b2" - android:ems="10" android:imeOptions="flagNoExtractUi" android:inputType="textCapSentences|textMultiLine" android:maxLength="16384" + android:gravity="bottom" android:layout_marginLeft="52dp" android:layout_marginRight="2dp" - android:layout_marginBottom="4dp" - android:paddingBottom="8dp" - android:paddingTop="4dp" android:background="@null" + android:layout_marginBottom="12dp" + android:paddingTop="11dp" android:textCursorDrawable="@null" android:textColor="#000000"/>