Bug fixes

This commit is contained in:
DrKLO 2014-11-19 06:46:45 +03:00
parent 77f2395428
commit ea8760f9a2
7 changed files with 35 additions and 43 deletions

View File

@ -80,7 +80,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 21 targetSdkVersion 21
versionCode 384 versionCode 386
versionName "2.0.0" versionName "2.0.0"
} }
} }

View File

@ -13,7 +13,6 @@ import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.android.AndroidUtilities; import org.telegram.android.AndroidUtilities;
@ -80,6 +79,10 @@ public class TextCheckCell extends FrameLayoutFixed {
setWillNotDraw(!divider); setWillNotDraw(!divider);
} }
public void setChecked(boolean checked) {
checkBox.setChecked(checked);
}
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
if (needDivider) { if (needDivider) {

View File

@ -45,7 +45,6 @@ import org.telegram.ui.Cells.TextColorCell;
import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextDetailSettingsCell;
import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.Views.AvatarDrawable;
import org.telegram.ui.Views.ColorPickerView; import org.telegram.ui.Views.ColorPickerView;
public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
@ -154,7 +153,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
listView.setVerticalScrollBarEnabled(false); listView.setVerticalScrollBarEnabled(false);
AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(5));
frameLayout.addView(listView); frameLayout.addView(listView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
@ -164,10 +162,10 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
boolean enabled = false;
if (i == messageAlertRow || i == groupAlertRow) { if (i == messageAlertRow || i == groupAlertRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled;
if (i == messageAlertRow) { if (i == messageAlertRow) {
enabled = preferences.getBoolean("EnableAll", true); enabled = preferences.getBoolean("EnableAll", true);
editor.putBoolean("EnableAll", !enabled); editor.putBoolean("EnableAll", !enabled);
@ -176,12 +174,10 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
editor.putBoolean("EnableGroup", !enabled); editor.putBoolean("EnableGroup", !enabled);
} }
editor.commit(); editor.commit();
listView.invalidateViews();
updateServerNotificationsSettings(i == groupAlertRow); updateServerNotificationsSettings(i == groupAlertRow);
} else if (i == messagePreviewRow || i == groupPreviewRow) { } else if (i == messagePreviewRow || i == groupPreviewRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled;
if (i == messagePreviewRow) { if (i == messagePreviewRow) {
enabled = preferences.getBoolean("EnablePreviewAll", true); enabled = preferences.getBoolean("EnablePreviewAll", true);
editor.putBoolean("EnablePreviewAll", !enabled); editor.putBoolean("EnablePreviewAll", !enabled);
@ -190,7 +186,6 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
editor.putBoolean("EnablePreviewGroup", !enabled); editor.putBoolean("EnablePreviewGroup", !enabled);
} }
editor.commit(); editor.commit();
listView.invalidateViews();
updateServerNotificationsSettings(i == groupPreviewRow); updateServerNotificationsSettings(i == groupPreviewRow);
} else if (i == messageSoundRow || i == groupSoundRow) { } else if (i == messageSoundRow || i == groupSoundRow) {
try { try {
@ -263,55 +258,48 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
} else if (i == inappSoundRow) { } else if (i == inappSoundRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppSounds", true); enabled = preferences.getBoolean("EnableInAppSounds", true);
editor.putBoolean("EnableInAppSounds", !enabled); editor.putBoolean("EnableInAppSounds", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
} else if (i == inappVibrateRow) { } else if (i == inappVibrateRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppVibrate", true); enabled = preferences.getBoolean("EnableInAppVibrate", true);
editor.putBoolean("EnableInAppVibrate", !enabled); editor.putBoolean("EnableInAppVibrate", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
} else if (i == inappPreviewRow) { } else if (i == inappPreviewRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppPreview", true); enabled = preferences.getBoolean("EnableInAppPreview", true);
editor.putBoolean("EnableInAppPreview", !enabled); editor.putBoolean("EnableInAppPreview", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
} else if (i == contactJoinedRow) { } else if (i == contactJoinedRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableContactJoined", true); enabled = preferences.getBoolean("EnableContactJoined", true);
MessagesController.getInstance().enableJoined = !enabled; MessagesController.getInstance().enableJoined = !enabled;
editor.putBoolean("EnableContactJoined", !enabled); editor.putBoolean("EnableContactJoined", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
} else if (i == pebbleAlertRow) { } else if (i == pebbleAlertRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnablePebbleNotifications", false); enabled = preferences.getBoolean("EnablePebbleNotifications", false);
editor.putBoolean("EnablePebbleNotifications", !enabled); editor.putBoolean("EnablePebbleNotifications", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
} else if (i == badgeNumberRow) { } else if (i == badgeNumberRow) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("badgeNumber", true); enabled = preferences.getBoolean("badgeNumber", true);
editor.putBoolean("badgeNumber", !enabled); editor.putBoolean("badgeNumber", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
NotificationsController.getInstance().setBadgeEnabled(!enabled); NotificationsController.getInstance().setBadgeEnabled(!enabled);
} else if (i == notificationsServiceRow) { } else if (i == notificationsServiceRow) {
final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
boolean enabled = preferences.getBoolean("pushService", true); enabled = preferences.getBoolean("pushService", true);
if (!enabled) { if (!enabled) {
final SharedPreferences.Editor editor = preferences.edit(); final SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("pushService", !enabled); editor.putBoolean("pushService", !enabled);
editor.commit(); editor.commit();
listView.invalidateViews();
ApplicationLoader.startPushService(); ApplicationLoader.startPushService();
} else { } else {
if (getParentActivity() == null) { if (getParentActivity() == null) {
@ -442,6 +430,9 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder); showAlertDialog(builder);
} }
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(!enabled);
}
} }
}); });
} else { } else {

View File

@ -219,8 +219,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override @Override
public View createView(LayoutInflater inflater, ViewGroup container) { public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) { if (fragmentView == null) {
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? user_id : chat_id)); actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 ? 5 : chat_id));
actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? user_id : chat_id)); actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 ? 5 : chat_id));
actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setExtraHeight(AndroidUtilities.dp(88), false); actionBar.setExtraHeight(AndroidUtilities.dp(88), false);
if (AndroidUtilities.isTablet()) { if (AndroidUtilities.isTablet()) {
@ -390,7 +390,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
nameTextView.setLayoutParams(layoutParams); nameTextView.setLayoutParams(layoutParams);
onlineTextView = new TextView(getParentActivity()); 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.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
onlineTextView.setLines(1); onlineTextView.setLines(1);
onlineTextView.setMaxLines(1); onlineTextView.setMaxLines(1);
@ -411,7 +411,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
listView.setDivider(null); listView.setDivider(null);
listView.setDividerHeight(0); listView.setDividerHeight(0);
listView.setVerticalScrollBarEnabled(false); 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); frameLayout.addView(listView);
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
@ -1042,7 +1042,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
photo = user.photo.photo_small; photo = user.photo.photo_small;
photoBig = user.photo.photo_big; 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)); nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
onlineTextView.setText(LocaleController.formatUserStatus(user)); onlineTextView.setText(LocaleController.formatUserStatus(user));

View File

@ -417,8 +417,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("view_animations", !animations); editor.putBoolean("view_animations", !animations);
editor.commit(); editor.commit();
if (listView != null) { if (view instanceof TextCheckCell) {
listView.invalidateViews(); ((TextCheckCell) view).setChecked(!animations);
} }
} else if (i == notificationRow) { } else if (i == notificationRow) {
presentFragment(new NotificationsSettingsActivity()); presentFragment(new NotificationsSettingsActivity());
@ -454,13 +454,13 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("send_by_enter", !send); editor.putBoolean("send_by_enter", !send);
editor.commit(); editor.commit();
if (listView != null) { if (view instanceof TextCheckCell) {
listView.invalidateViews(); ((TextCheckCell) view).setChecked(!send);
} }
} else if (i == saveToGalleryRow) { } else if (i == saveToGalleryRow) {
MediaController.getInstance().toggleSaveToGallery(); MediaController.getInstance().toggleSaveToGallery();
if (listView != null) { if (view instanceof TextCheckCell) {
listView.invalidateViews(); ((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery());
} }
} else if (i == privacyRow) { } else if (i == privacyRow) {
presentFragment(new PrivacySettingsActivity()); presentFragment(new PrivacySettingsActivity());

View File

@ -108,20 +108,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:id="@+id/chat_text_edit" android:id="@+id/chat_text_edit"
android:layout_marginTop="2dp"
android:maxLines="4" android:maxLines="4"
android:textSize="18dp" android:textSize="18dp"
android:textColorHint="#b2b2b2" android:textColorHint="#b2b2b2"
android:ems="10"
android:imeOptions="flagNoExtractUi" android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:maxLength="16384" android:maxLength="16384"
android:gravity="bottom"
android:layout_marginLeft="52dp" android:layout_marginLeft="52dp"
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:layout_marginBottom="4dp"
android:paddingBottom="8dp"
android:paddingTop="4dp"
android:background="@null" android:background="@null"
android:layout_marginBottom="12dp"
android:paddingTop="11dp"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textColor="#000000"/> android:textColor="#000000"/>

View File

@ -50,20 +50,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:id="@+id/chat_text_edit" android:id="@+id/chat_text_edit"
android:layout_marginTop="2dp"
android:maxLines="4" android:maxLines="4"
android:textSize="18dp" android:textSize="18dp"
android:textColorHint="#b2b2b2" android:textColorHint="#b2b2b2"
android:ems="10"
android:imeOptions="flagNoExtractUi" android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:maxLength="16384" android:maxLength="16384"
android:gravity="bottom"
android:layout_marginLeft="52dp" android:layout_marginLeft="52dp"
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:layout_marginBottom="4dp"
android:paddingBottom="8dp"
android:paddingTop="4dp"
android:background="@null" android:background="@null"
android:layout_marginBottom="12dp"
android:paddingTop="11dp"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textColor="#000000"/> android:textColor="#000000"/>