diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 2177b7f0..102f997e 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -82,8 +82,8 @@ android { applicationId "org.telegram.plus" minSdkVersion 8 targetSdkVersion 22 - versionCode 594 - versionName "3.1.3.0" + versionCode 597 + versionName "3.1.3.3" multiDexEnabled true } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java index b6451e5c..8ffff8a8 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java @@ -1089,6 +1089,7 @@ public class AndroidUtilities { } public static int setDarkColor(int color, int factor){ + int alpha = Color.alpha(color); int red = Color.red(color) - factor; int green = Color.green(color) - factor; int blue = Color.blue(color) - factor; @@ -1112,8 +1113,37 @@ public class AndroidUtilities { blue = factor; } } - return Color.argb(0xff, red, green, blue); + //return Color.argb(0xff, red, green, blue); + return Color.argb(alpha, red, green, blue); } + //Same as setDarkColor but maintains alpha + /*public static int setDarkWithAlphaColor(int color, int factor){ + int alpha = Color.alpha(color); + int red = Color.red(color) - factor; + int green = Color.green(color) - factor; + int blue = Color.blue(color) - factor; + if(factor < 0){ + red = (red > 0xff) ? 0xff : red; + green = (green > 0xff) ? 0xff : green; + blue = (blue > 0xff) ? 0xff : blue; + if(red == 0xff && green == 0xff && blue == 0xff){ + red = factor; + green = factor; + blue = factor; + } + } + if(factor > 0){ + red = (red < 0) ? 0 : red; + green = (green < 0) ? 0 : green; + blue = (blue < 0) ? 0 : blue; + if(red == 0 && green == 0 && blue == 0){ + red = factor; + green = factor; + blue = factor; + } + } + return Color.argb(alpha, red, green, blue); + }*/ public static void setIntColor(String key, int value){ SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(THEME_PREFS, THEME_PREFS_MODE); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java index 725beea4..316876da 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java @@ -19,6 +19,7 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.AsyncTask; import android.os.Build; import android.os.Handler; @@ -126,7 +127,32 @@ public class ApplicationLoader extends MultiDexApplication { if (selectedColor == 0) { selectedColor = -2693905; } + cachedWallpaper = new ColorDrawable(selectedColor); + + } + + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int orientation = themePrefs.getInt("chatGradientBG", 0); + if(orientation > 0 && themePrefs.getBoolean("chatSolidBGColorCheck", false)) { + GradientDrawable.Orientation go; + switch(orientation) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int mainColor = selectedColor = themePrefs.getInt("chatSolidBGColor", 0xffffffff); + int gradColor = themePrefs.getInt("chatGradientBGColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + cachedWallpaper = new GradientDrawable(go, colors); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java index 732e4ae3..fd7a0a43 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java @@ -10,9 +10,11 @@ package org.telegram.ui.ActionBar; import android.app.Activity; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.view.Gravity; import android.view.MotionEvent; @@ -25,6 +27,7 @@ import android.widget.FrameLayout; import android.widget.ListView; import org.telegram.android.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.R; import org.telegram.android.AnimationCompat.AnimatorListenerAdapterProxy; @@ -451,7 +454,38 @@ public class DrawerLayoutContainer extends FrameLayout { child.measure(drawerWidthSpec, drawerHeightSpec); } } - getDrawerLayout().setBackgroundColor(AndroidUtilities.getIntDef("drawerListColor",0xffffffff)); //Plus + //getDrawerLayout().setBackgroundColor(AndroidUtilities.getIntDef("drawerListColor",0xffffffff)); //Plus + updateListBG(); + } + + private void updateListBG(){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("drawerListColor", 0xffffffff); + int value = themePrefs.getInt("drawerRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("drawerRowGradientListCheck", false); + if(value > 0 && b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("drawerRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + getDrawerLayout().setBackgroundDrawable(gd); + }else{ + getDrawerLayout().setBackgroundColor(mainColor); + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java index 0141a97d..2f4fb794 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java @@ -12,6 +12,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.view.View; import android.view.ViewGroup; @@ -199,6 +200,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { convertView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 28 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 28), 0); convertView.setTag("contactsRowColor"); //Plus } + updateViewColor(convertView); } else if (type == 3) { if (convertView == null) { convertView = new GreySectionCell(mContext); @@ -207,10 +209,12 @@ public class ContactsAdapter extends BaseSectionsAdapter { ((GreySectionCell) convertView).setBackgroundColor(themePrefs.getInt("contactsRowColor", 0xffffffff)); ((GreySectionCell) convertView).setTextColor(cColorGrey); } + updateViewColor(convertView); } else if (type == 2) { if (convertView == null) { convertView = new TextCell(mContext); } + updateViewColor(convertView); TextCell actionCell = (TextCell) convertView; actionCell.setTextColor(cColorBlack); if (needPhonebook) { @@ -247,6 +251,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { ((TextCell) convertView).setTextColor(cColorBlack); ((TextCell) convertView).setTextSize(themePrefs.getInt("contactsNameSize", 16)); } + updateViewColor(convertView); ContactsController.Contact contact = ContactsController.getInstance().phoneBookContacts.get(position); if (contact.first_name != null && contact.last_name != null) { ((TextCell) convertView).setText(contact.first_name + " " + contact.last_name); @@ -260,7 +265,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { convertView = new UserCell(mContext, 58); convertView.setTag("Contacts"); } - + updateViewColor(convertView); ArrayList arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section - (onlyUsers && !isAdmin ? 0 : 1))); TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id); ((UserCell) convertView).setData(user, null, null, 0); @@ -281,10 +286,72 @@ public class ContactsAdapter extends BaseSectionsAdapter { //((UserCell) convertView).setStatusSize(themePrefs.getInt("contactsStatusSize", 14)); //((UserCell) convertView).setAvatarRadius(themePrefs.getInt("contactsAvatarRadius", 32)); } - parent.setBackgroundColor(themePrefs.getInt("contactsRowColor", 0xffffffff)); //Plus + //parent.setBackgroundColor(themePrefs.getInt("contactsRowColor", 0xffffffff)); //Plus + updateListBG(parent); return convertView; } + private void updateListBG(ViewGroup vg){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("contactsRowColor", 0xffffffff); + int value = themePrefs.getInt("contactsRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("contactsRowGradientListCheck", false); + if(value > 0 && b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("contactsRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + vg.setBackgroundDrawable(gd); + }else{ + vg.setBackgroundColor(mainColor); + } + } + + private void updateViewColor(View v){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("contactsRowColor", 0xffffffff); + int value = themePrefs.getInt("contactsRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("contactsRowGradientListCheck", false); + if(value > 0 && !b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("contactsRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + v.setBackgroundDrawable(gd); + } else if(b){ + v.setBackgroundColor(0x00000000); + } + if(value > 0)v.setTag("Contacts00"); + } + @Override public int getItemViewType(int section, int position) { if (onlyUsers && !isAdmin) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java index 14be9bad..127fc6f3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java @@ -10,6 +10,7 @@ package org.telegram.ui.Adapters; import android.content.Context; import android.content.SharedPreferences; +import android.graphics.drawable.GradientDrawable; import android.view.View; import android.view.ViewGroup; @@ -96,8 +97,35 @@ public class DialogsAdapter extends RecyclerView.Adapter { } else if (viewType == 1) { view = new LoadingCell(mContext); } + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); - viewGroup.setBackgroundColor(themePrefs.getInt("chatsRowColor", 0xffffffff)); + int mainColor = themePrefs.getInt("chatsRowColor", 0xffffffff); + int value = themePrefs.getInt("chatsRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("chatsRowGradientListCheck", false); + if(value > 0 && b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("chatsRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + viewGroup.setBackgroundDrawable(gd); + }else{ + viewGroup.setBackgroundColor(mainColor); + } + //viewGroup.setBackgroundColor(mainColor); return new Holder(view); } @@ -112,8 +140,36 @@ public class DialogsAdapter extends RecyclerView.Adapter { cell.setDialogSelected(dialog.id == openedDialogId); } } + //Plus + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("chatsRowColor", 0xffffffff); + //cell.setBackgroundColor(mainColor); + int value = themePrefs.getInt("chatsRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("chatsRowGradientListCheck", false); + if(value > 0 && !b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("chatsRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + cell.setBackgroundDrawable(gd); + } + // cell.setDialog(dialog, i, dialogsType); - } + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java index b656b1e0..02ff5d75 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java @@ -13,6 +13,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; @@ -94,15 +95,18 @@ public class DrawerLayoutAdapter extends BaseAdapter { if (view == null) { view = new EmptyCell(mContext, AndroidUtilities.dp(8)); } + updateViewColor(view); } else if (type == 2) { if (view == null) { view = new DividerCell(mContext); view.setTag("drawerListDividerColor"); } + updateViewColor(view); } else if (type == 3) { if (view == null) { view = new DrawerActionCell(mContext); } + updateViewColor(view); DrawerActionCell actionCell = (DrawerActionCell) view; //actionCell.setTextColor(themePrefs.getInt("drawerOptionColor", 0xff444444)); //actionCell.setTextSize(themePrefs.getInt("drawerOptionSize", 15)); @@ -143,6 +147,7 @@ public class DrawerLayoutAdapter extends BaseAdapter { }*/ } else if (type == versionType) { view = new TextInfoCell(mContext); + updateViewColor(view); if (i == versionRow) { try { PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); @@ -157,6 +162,34 @@ public class DrawerLayoutAdapter extends BaseAdapter { return view; } + private void updateViewColor(View v){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("drawerListColor", 0xffffffff); + int value = themePrefs.getInt("drawerRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("drawerRowGradientListCheck", false); + if(value > 0 && !b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("drawerRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + v.setBackgroundDrawable(gd); + } + } + @Override public int getItemViewType(int i) { if (i == 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 19336c64..4f5b9039 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -388,7 +388,7 @@ public class DialogCell extends BaseCell { } checkMessage = false; SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); - int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); + //int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); //String hexColor = String.format("#%08X", (0xffffffff & defColor)); String hexMsgColor = String.format("#%08X", (0xffffffff & themePrefs.getInt("chatsMessageColor", 0xff808080))); int darkColor = themePrefs.getInt("chatsMemberColor", AndroidUtilities.getIntDarkerColor("themeColor", 0x15)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DividerCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DividerCell.java index 95cba497..9ec3fb7f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DividerCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DividerCell.java @@ -34,6 +34,9 @@ public class DividerCell extends BaseCell { if(key != null){ int color = AndroidUtilities.getIntDef(key, 0xffd9d9d9); paint.setColor(color); + if(key.contains("00")){ + paint.setColor(0x00000000); + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java index eb437acb..c3878bac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java @@ -18,6 +18,7 @@ import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.util.TypedValue; import android.view.Gravity; @@ -270,8 +271,32 @@ public class DrawerProfileCell extends FrameLayout implements PhotoViewer.PhotoV private void updateTheme(){ SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int tColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); - int dColor = AndroidUtilities.getIntDarkerColor("themeColor",-0x40); - setBackgroundColor(themePrefs.getInt("drawerHeaderColor", tColor)); + int dColor = AndroidUtilities.getIntDarkerColor("themeColor", -0x40); + + int hColor = themePrefs.getInt("drawerHeaderColor", tColor); + setBackgroundColor(hColor); + int value = themePrefs.getInt("drawerHeaderGradient", 0); + if(value > 0) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("drawerHeaderGradientColor", tColor); + int[] colors = new int[]{hColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + setBackgroundDrawable(gd); + } + nameTextView.setTextColor(themePrefs.getInt("drawerNameColor", 0xffffffff)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, themePrefs.getInt("drawerNameSize", 15)); phoneTextView.setTextColor(themePrefs.getInt("drawerPhoneColor", dColor)); @@ -296,4 +321,8 @@ public class DrawerProfileCell extends FrameLayout implements PhotoViewer.PhotoV avatarImageView.setImage(photo, "50_50", avatarDrawable); } + + private void updateHeaderBG(){ + + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java index d6bdee23..6144ccec 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java @@ -117,12 +117,13 @@ public class UserCell extends FrameLayout { setStatusSize(themePrefs.getInt("contactsStatusSize", 14)); setAvatarRadius(themePrefs.getInt("contactsAvatarRadius", 32)); }else if(tag.contains("Profile")){ - setStatusColors(themePrefs.getInt("profileSummaryColor", 0xff8a8a8a), AndroidUtilities.getIntDarkerColor("themeColor", -0x40)); + setStatusColors(themePrefs.getInt("profileSummaryColor", 0xff8a8a8a), themePrefs.getInt("profileOnlineColor", AndroidUtilities.getIntDarkerColor("themeColor", -0x40))); nameColor = themePrefs.getInt("profileTitleColor", 0xff212121); nameTextView.setTextColor(nameColor); nameTextView.setTextSize(17); setStatusSize(14); - setAvatarRadius(32); + //setAvatarRadius(32); + setAvatarRadius(themePrefs.getInt("profileRowAvatarRadius", 32)); if(currentDrawable != 0) { int dColor = themePrefs.getInt("profileIconsColor", 0xff737373); Drawable d = getResources().getDrawable(currentDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index b17cbe20..5ba8481e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -21,6 +21,7 @@ import android.graphics.Bitmap; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.media.ExifInterface; import android.net.Uri; import android.os.Build; @@ -3090,6 +3091,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (onlineTextView == null) { return; } + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int lightColor = AndroidUtilities.getIntDarkerColor("themeColor", -0x40); + onlineTextView.setTextColor(themePrefs.getInt("chatStatusColor", lightColor)); CharSequence printString = MessagesController.getInstance().printingStrings.get(dialog_id); if (printString != null) { printString = TextUtils.replace(printString, new String[]{"..."}, new String[]{""}); @@ -3129,6 +3133,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not lastStatus = newStatus; onlineTextView.setText(newStatus); } + + if(newStatus.equals(LocaleController.getString("Online", R.string.Online))){ + onlineTextView.setTextColor(themePrefs.getInt("chatOnlineColor", themePrefs.getInt("chatStatusColor", lightColor))); + } } lastPrintString = null; } else { @@ -4744,10 +4752,34 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not try{ SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int def = themePrefs.getInt("themeColor", AndroidUtilities.defColor); - actionBar.setBackgroundColor(themePrefs.getInt("chatHeaderColor", def)); + + int hColor = themePrefs.getInt("chatHeaderColor", def); + actionBar.setBackgroundColor(hColor); + int val = themePrefs.getInt("chatHeaderGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("chatHeaderGradientColor", def); + int[] colors = new int[]{hColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + actionBar.setBackgroundDrawable(gd); + } + nameTextView.setTextColor(themePrefs.getInt("chatNameColor", 0xffffffff)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, themePrefs.getInt("chatNameSize", 18)); - onlineTextView.setTextColor(themePrefs.getInt("chatStatusColor", AndroidUtilities.getIntDarkerColor("themeColor", -0x40))); + //onlineTextView.setTextColor(themePrefs.getInt("chatStatusColor", AndroidUtilities.getIntDarkerColor("themeColor", -0x40))); onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, themePrefs.getInt("chatStatusSize", 14)); int iColor = themePrefs.getInt("chatHeaderIconsColor", 0xffffffff); Drawable mute = getParentActivity().getResources().getDrawable(R.drawable.mute_blue); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index c0e98fad..f66f8967 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -13,6 +13,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.media.AudioManager; import android.os.PowerManager; import android.text.Editable; @@ -523,9 +524,33 @@ public class ChatActivityEnterView extends FrameLayoutFixed implements Notificat messageEditText.setTextColor(themePrefs.getInt("chatEditTextColor", 0xff000000)); messageEditText.setHintTextColor(AndroidUtilities.getIntAlphaColor("chatEditTextColor", 0xff000000, 0.35f)); messageEditText.setTextSize(themePrefs.getInt("chatEditTextSize", 18)); + int color = themePrefs.getInt("chatEditTextBGColor", 0xffffffff); setBackgroundColor(color); textFieldContainer.setBackgroundColor(color); + int val = themePrefs.getInt("chatEditTextBGGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("chatEditTextBGGradientColor", 0xffffffff); + int[] colors = new int[]{color, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + setBackgroundDrawable(gd); + textFieldContainer.setBackgroundDrawable(gd); + } + } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox.java index 95707a7f..febe5b37 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBox.java @@ -9,6 +9,7 @@ package org.telegram.ui.Components; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; @@ -19,6 +20,8 @@ import android.view.View; import org.telegram.android.AndroidUtilities; import org.telegram.android.AnimationCompat.ObjectAnimatorProxy; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.R; public class CheckBox extends View { @@ -65,6 +68,10 @@ public class CheckBox extends View { backgroundPaint.setColor(0xffffffff); backgroundPaint.setStyle(Paint.Style.STROKE); backgroundPaint.setStrokeWidth(AndroidUtilities.dp(2)); + if(resId == R.drawable.checkbig){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + backgroundPaint.setColor(themePrefs.getInt("chatAttachBGColor", 0xffffffff)); + } } checkDrawable = context.getResources().getDrawable(resId); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java index 9ea304ed..97e39a59 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java @@ -14,6 +14,7 @@ import android.content.SharedPreferences; import android.database.DataSetObserver; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; @@ -425,6 +426,27 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific //setBackgroundColor(0xfff5f6f7); setBackgroundColor(bgColor); + int val = themePrefs.getInt("chatEmojiViewBGGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("chatEmojiViewBGGradientColor", 0xfff5f6f7); + int[] colors = new int[]{bgColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + setBackgroundDrawable(gd); + } pager = new ViewPager(context) { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java index ccfc1f93..93c5adf8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java @@ -15,6 +15,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -527,7 +528,31 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter private void updateTheme(){ SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int def = themePrefs.getInt("themeColor", AndroidUtilities.defColor); - actionBar.setBackgroundColor(themePrefs.getInt("contactsHeaderColor", def)); + + int hColor = themePrefs.getInt("contactsHeaderColor", def); + actionBar.setBackgroundColor(hColor); + int val = themePrefs.getInt("contactsHeaderGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("contactsHeaderGradientColor", def); + int[] colors = new int[]{hColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + actionBar.setBackgroundDrawable(gd); + } + actionBar.setTitleColor(themePrefs.getInt("contactsHeaderTitleColor", 0xffffffff)); Drawable search = getParentActivity().getResources().getDrawable(R.drawable.ic_ab_search); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 147fb1d4..cb316393 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -25,6 +25,7 @@ import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -898,7 +899,31 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat actionBar.setBackgroundColor(0x7F000000); SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int def = themePrefs.getInt("themeColor", AndroidUtilities.defColor); - actionBar.setBackgroundColor(themePrefs.getInt("chatHeaderColor", def)); + + int hColor = themePrefs.getInt("chatHeaderColor", def); + actionBar.setBackgroundColor(hColor); + int val = themePrefs.getInt("chatHeaderGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("chatHeaderGradientColor", def); + int[] colors = new int[]{hColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + actionBar.setBackgroundDrawable(gd); + } + actionBar.setOccupyStatusBar(false); actionBar.setItemsBackground(R.drawable.bar_selector_white); //actionBar.setBackButtonImage(R.drawable.ic_ab_back); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index bd3ab8df..35118d19 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -22,6 +22,7 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -1401,7 +1402,33 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int def = themePrefs.getInt("themeColor", AndroidUtilities.defColor); int dark = themePrefs.getInt("profileStatusColor", AndroidUtilities.getIntDarkerColor("themeColor", -0x40)); - actionBar.setBackgroundColor(themePrefs.getInt("profileHeaderColor", def)); + + //actionBar.setBackgroundColor(themePrefs.getInt("profileHeaderColor", def)); + + int hColor = themePrefs.getInt("profileHeaderColor", def); + actionBar.setBackgroundColor(hColor); + int val = themePrefs.getInt("profileHeaderGradient", 0); + if(val > 0) { + GradientDrawable.Orientation go; + switch(val) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + int gradColor = themePrefs.getInt("profileHeaderGradientColor", def); + int[] colors = new int[]{hColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + actionBar.setBackgroundDrawable(gd); + } + nameTextView.setTextColor(themePrefs.getInt("profileNameColor", 0xffffffff)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, themePrefs.getInt("profileNameSize", 18)); onlineTextView.setTextColor(dark); @@ -1547,6 +1574,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (view == null) { view = new EmptyCell(mContext); } + if (i == overscrollRow) { ((EmptyCell) view).setHeight(AndroidUtilities.dp(88)); } else if (i == emptyRowChat || i == emptyRowChat2) { @@ -1554,17 +1582,20 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } else { ((EmptyCell) view).setHeight(AndroidUtilities.dp(36)); } + updateViewColor(view); } else if (type == 1) { if (view == null) { view = new DividerCell(mContext); view.setPadding(AndroidUtilities.dp(72), 0, 0, 0); view.setTag("profileRowColor"); } + updateViewColor(view); } else if (type == 2) { final TLRPC.User user = MessagesController.getInstance().getUser(user_id); if (view == null) { view = new TextDetailCell(mContext); } + updateViewColor(view); TextDetailCell textDetailCell = (TextDetailCell) view; textDetailCell.setTextColor(tColor); textDetailCell.setValueColor(themePrefs.getInt("profileSummaryColor", 0xff8a8a8a)); @@ -1592,6 +1623,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. if (view == null) { view = new TextCell(mContext); } + updateViewColor(view); TextCell textCell = (TextCell) view; //textCell.setTextColor(0xff212121); textCell.setTextColor(tColor); @@ -1644,7 +1676,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. view = new UserCell(mContext, 61); view.setTag("Profile"); } - + updateViewColor(view); TLRPC.TL_chatParticipant part = info.participants.get(sortedUsers.get(i - emptyRowChat2 - 1)); //((UserCell)view).setData(MessagesController.getInstance().getUser(part.user_id), null, null, i == emptyRowChat2 + 1 ? R.drawable.menu_newgroup : 0); int icon = 0; @@ -1661,6 +1693,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. view = new ShadowSectionCell(mContext, false); } view.setBackgroundColor(themePrefs.getInt("profileRowColor", 0xffffffff)); + updateViewColor(view); } else if (type == 6) { if (view == null) { view = new AddMemberCell(mContext); @@ -1670,10 +1703,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. ((AddMemberCell) view).setText(LocaleController.getString("AddRecipient", R.string.AddRecipient)); } } + updateViewColor(view); ((AddMemberCell) view).setTextColor(tColor); ((AddMemberCell) view).setDrawableColor(dColor); } - viewGroup.setBackgroundColor(themePrefs.getInt("profileRowColor", 0xffffffff)); + //viewGroup.setBackgroundColor(themePrefs.getInt("profileRowColor", 0xffffffff)); + updateListBG(viewGroup); return view; } @@ -1707,4 +1742,65 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. return false; } } + + private void updateListBG(ViewGroup vg){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("profileRowColor", 0xffffffff); + int value = themePrefs.getInt("profileRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("profileRowGradientListCheck", false); + if(value > 0 && b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("profileRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + vg.setBackgroundDrawable(gd); + }else{ + vg.setBackgroundColor(mainColor); + } + } + + private void updateViewColor(View v){ + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int mainColor = themePrefs.getInt("profileRowColor", 0xffffffff); + int value = themePrefs.getInt("profileRowGradient", 0); + boolean b = true;//themePrefs.getBoolean("profileRowGradientListCheck", false); + if(value > 0 && !b) { + GradientDrawable.Orientation go; + switch(value) { + case 2: + go = GradientDrawable.Orientation.LEFT_RIGHT; + break; + case 3: + go = GradientDrawable.Orientation.TL_BR; + break; + case 4: + go = GradientDrawable.Orientation.BL_TR; + break; + default: + go = GradientDrawable.Orientation.TOP_BOTTOM; + } + + int gradColor = themePrefs.getInt("profileRowGradientColor", 0xffffffff); + int[] colors = new int[]{mainColor, gradColor}; + GradientDrawable gd = new GradientDrawable(go, colors); + v.setBackgroundDrawable(gd); + } else if(b){ + v.setBackgroundColor(0x00000000); + } + if(value > 0)v.setTag("Profile00"); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatActivity.java index e411cb5c..c963a6df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatActivity.java @@ -37,11 +37,15 @@ import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextColorCell; +import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.ColorSelectorDialog; import org.telegram.ui.Components.NumberPicker; +import java.util.ArrayList; +import java.util.List; + import static org.telegram.ui.Components.ColorSelectorDialog.OnColorChangedListener; public class ThemingChatActivity extends BaseFragment { @@ -101,6 +105,19 @@ public class ThemingChatActivity extends BaseFragment { private int showOwnAvatar; private int showOwnAvatarGroup; private int showUsernameCheckRow; + private int gradientBGRow; + private int gradientBGColorRow; + + private int headerGradientRow; + private int headerGradientColorRow; + private int onlineColorRow; + + private int editTextBGGradientRow; + private int editTextBGGradientColorRow; + private int attachBGGradientRow; + private int attachBGGradientColorRow; + private int emojiViewBGGradientRow; + private int emojiViewBGGradientColorRow; private int rowCount; @@ -113,6 +130,8 @@ public class ThemingChatActivity extends BaseFragment { rowCount = 0; headerSection2Row = rowCount++; headerColorRow = rowCount++; + headerGradientRow = rowCount++; + headerGradientColorRow = rowCount++; headerIconsColorRow = rowCount++; //muteColorRow = rowCount++; @@ -120,6 +139,7 @@ public class ThemingChatActivity extends BaseFragment { nameColorRow = rowCount++; statusSizeRow = rowCount++; statusColorRow = rowCount++; + onlineColorRow = rowCount++; rowsSectionRow = rowCount++; rowsSection2Row = rowCount++; @@ -127,6 +147,9 @@ public class ThemingChatActivity extends BaseFragment { solidBGColorCheckRow = rowCount++; solidBGColorRow = rowCount++; + //gradientBGRow = rowCount++; + //gradientBGColorRow = rowCount++; + showContactAvatar = rowCount++; avatarAlignTopRow = rowCount++; showOwnAvatar = rowCount++; @@ -168,12 +191,18 @@ public class ThemingChatActivity extends BaseFragment { editTextSizeRow = rowCount++; editTextColorRow = rowCount++; editTextBGColorRow = rowCount++; + editTextBGGradientRow = rowCount++; + editTextBGGradientColorRow = rowCount++; editTextIconsColorRow = rowCount++; attachBGColorRow = rowCount++; + attachBGGradientRow = rowCount++; + attachBGGradientColorRow = rowCount++; attachTextColorRow = rowCount++; emojiViewBGColorRow = rowCount++; + emojiViewBGGradientRow = rowCount++; + emojiViewBGGradientColorRow = rowCount++; emojiViewTabIconColorRow = rowCount++; emojiViewTabColorRow = rowCount++; @@ -234,6 +263,7 @@ public class ThemingChatActivity extends BaseFragment { SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); int darkColor = AndroidUtilities.getIntDarkerColor("themeColor", 0x15); + int lightColor = AndroidUtilities.getIntDarkerColor("themeColor", -0x40); final String key = view.getTag() != null ? view.getTag().toString() : ""; if (i == headerColorRow) { @@ -254,6 +284,112 @@ public class ThemingChatActivity extends BaseFragment { },themePrefs.getInt("chatHeaderColor", defColor), CENTER, 0, false); colorDialog.show(); + } else if (i == headerGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatHeaderGradientColor", color); + } + + },themePrefs.getInt("chatHeaderGradientColor", defColor), CENTER, 0, true); + colorDialog.show(); + } else if (i == headerGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatHeaderGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == editTextBGGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatEditTextBGGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == attachBGGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatAttachBGGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == emojiViewBGGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatEmojiViewBGGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (i == solidBGColorCheckRow) { boolean b = themePrefs.getBoolean( key, true); SharedPreferences.Editor editor = themePrefs.edit(); @@ -358,6 +494,44 @@ public class ThemingChatActivity extends BaseFragment { },themePrefs.getInt("chatSolidBGColor", 0xffffffff), CENTER, 0, true); colorDialog.show(); + } else if (i == gradientBGColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatGradientBGColor", color); + ApplicationLoader.reloadWallpaper(); + } + },themePrefs.getInt( "chatGradientBGColor", 0xffffffff), CENTER, 0, false); + colorDialog.show(); + } else if (i == gradientBGRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatGradientBG", which).commit(); + ApplicationLoader.reloadWallpaper(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (i == memberColorRow) { if (getParentActivity() == null) { return; @@ -647,11 +821,8 @@ public class ThemingChatActivity extends BaseFragment { if (getParentActivity() == null) { return; } - LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - li.inflate(R.layout.colordialog, null, false); - ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { @Override public void colorChanged(int color) { @@ -659,7 +830,20 @@ public class ThemingChatActivity extends BaseFragment { } },themePrefs.getInt("chatEditTextBGColor", 0xffffffff), CENTER, 0, true); + colorDialog.show(); + } else if (i == editTextBGGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatEditTextBGGradientColor", color); + } + },themePrefs.getInt("chatEditTextBGGradientColor", 0xffffffff), CENTER, 0, true); colorDialog.show(); } else if (i == attachBGColorRow) { if (getParentActivity() == null) { @@ -673,7 +857,21 @@ public class ThemingChatActivity extends BaseFragment { commitInt("chatAttachBGColor", color); } - },themePrefs.getInt("chatAttachBGColor", 0xffffffff), CENTER, 0, true); + },themePrefs.getInt("chatAttachBGColor", 0xffffffff), CENTER, 0, false); + colorDialog.show(); + } else if (i == attachBGGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatAttachBGGradientColor", color); + } + + },themePrefs.getInt("chatAttachBGGradientColor", 0xffffffff), CENTER, 0, false); colorDialog.show(); } else if (i == attachTextColorRow) { if (getParentActivity() == null) { @@ -708,19 +906,28 @@ public class ThemingChatActivity extends BaseFragment { if (getParentActivity() == null) { return; } - LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - li.inflate(R.layout.colordialog, null, false); - ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { @Override public void colorChanged(int color) { commitInt("chatEmojiViewBGColor", color); } - },themePrefs.getInt("chatEmojiViewBGColor", 0xfff5f6f7), CENTER, 0, true); - + },themePrefs.getInt("chatEmojiViewBGColor", 0xfff5f6f7), CENTER, 0, false); + colorDialog.show(); + } else if (i == emojiViewBGGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatEmojiViewBGGradientColor", color); + } + },themePrefs.getInt("chatEmojiViewBGGradientColor", 0xfff5f6f7), CENTER, 0, false); colorDialog.show(); } else if (i == emojiViewTabIconColorRow) { if (getParentActivity() == null) { @@ -733,25 +940,20 @@ public class ThemingChatActivity extends BaseFragment { public void colorChanged(int color) { commitInt("chatEmojiViewTabIconColor", color); } - },themePrefs.getInt("chatEmojiViewTabIconColor", 0xffa8a8a8), CENTER, 0, true); colorDialog.show(); } else if (i == emojiViewTabColorRow) { if (getParentActivity() == null) { return; } - LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - li.inflate(R.layout.colordialog, null, false); - ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { @Override public void colorChanged(int color) { commitInt("chatEmojiViewTabColor", color); } - - },themePrefs.getInt("chatEmojiViewTabColor", AndroidUtilities.getIntDarkerColor("themeColor",-0x15)), CENTER, 0, true); + },themePrefs.getInt("chatEmojiViewTabColor", darkColor), CENTER, 0, true); colorDialog.show(); } else if (i == statusColorRow) { @@ -766,10 +968,23 @@ public class ThemingChatActivity extends BaseFragment { commitInt("chatStatusColor", color); } - },themePrefs.getInt("chatStatusColor", AndroidUtilities.getIntDarkerColor("themeColor",-0x40)), CENTER, 0, false); + },themePrefs.getInt("chatStatusColor", lightColor), CENTER, 0, false); colorDialog.show(); - } else if (i == dateColorRow) { + } else if (i == onlineColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("chatOnlineColor", color); + } + },themePrefs.getInt("chatOnlineColor", themePrefs.getInt("chatStatusColor", lightColor)), CENTER, 0, false); + colorDialog.show(); + } else if (i == dateColorRow) { if (getParentActivity() == null) { return; } @@ -1006,9 +1221,18 @@ public class ThemingChatActivity extends BaseFragment { //if(view.getTag() != null)resetPref(view.getTag().toString()); if (i == headerColorRow) { resetPref("chatHeaderColor"); + } else if (i == headerGradientRow) { + resetPref("chatHeaderGradient"); + } else if (i == headerGradientColorRow) { + resetPref("chatHeaderGradientColor"); } else if (i == solidBGColorRow) { resetPref("chatSolidBGColor"); ApplicationLoader.reloadWallpaper(); + } else if (i == gradientBGColorRow) { + resetPref("chatGradientBGColor"); + ApplicationLoader.reloadWallpaper(); + } else if (i == gradientBGRow) { + resetPref("chatGradientBG"); } else if (i == memberColorRow) { resetPref("chatMemberColor"); } else if (i == contactNameColorRow) { @@ -1023,6 +1247,8 @@ public class ThemingChatActivity extends BaseFragment { resetPref("chatNameSize"); } else if (i == statusColorRow) { resetPref("chatStatusColor"); + } else if (i == onlineColorRow) { + resetPref("chatOnlineColor"); } else if (i == statusSizeRow) { resetPref("chatStatusSize"); } else if (i == rTimeColorRow) { @@ -1049,12 +1275,24 @@ public class ThemingChatActivity extends BaseFragment { resetPref("chatEditTextSize"); } else if (i == editTextBGColorRow) { resetPref("chatEditTextBGColor"); + } else if (i == editTextBGGradientColorRow) { + resetPref("chatEditTextBGGradentColor"); + } else if (i == editTextBGGradientRow) { + resetPref("chatEditTextBGGradient"); } else if (i == attachBGColorRow) { resetPref("chatAttachBGColor"); + } else if (i == attachBGGradientRow) { + resetPref("chatAttachBGGradient"); + } else if (i == attachBGGradientColorRow) { + resetPref("chatAttachBGGradientColor"); } else if (i == attachTextColorRow) { resetPref("chatAttachTextColor"); } else if (i == emojiViewBGColorRow) { resetPref("chatEmojiViewBGColor"); + } else if (i == emojiViewBGGradientRow) { + resetPref("chatEmojiViewBGGradient"); + } else if (i == emojiViewBGGradientColorRow) { + resetPref("chatEmojiViewBGGradientColor"); } else if (i == emojiViewTabIconColorRow) { resetPref("chatEmojiViewTabIconColor"); } else if (i == emojiViewTabColorRow) { @@ -1168,12 +1406,14 @@ public class ThemingChatActivity extends BaseFragment { @Override public boolean isEnabled(int i) { - return i == headerColorRow || i == muteColorRow || i == headerIconsColorRow || i == rBubbleColorRow || i == lBubbleColorRow || i == bubblesRow || - i == solidBGColorCheckRow || AndroidUtilities.getBoolPref("chatSolidBGColorCheck") && i == solidBGColorRow || i == avatarRadiusRow || i == avatarSizeRow || i == avatarMarginLeftRow || i == avatarAlignTopRow || i == ownAvatarAlignTopRow || i == showContactAvatar || i == showOwnAvatar || i == showOwnAvatarGroup || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == statusSizeRow || + boolean b = AndroidUtilities.getBoolPref("chatSolidBGColorCheck"); + int g = AndroidUtilities.getIntDef("chatGradientBG", 0); + return i == headerColorRow || i == headerGradientRow || AndroidUtilities.getIntDef("chatHeaderGradient", 0) != 0 && i == headerGradientColorRow || i == muteColorRow || i == headerIconsColorRow || i == rBubbleColorRow || i == lBubbleColorRow || i == bubblesRow || + i == solidBGColorCheckRow || b && i == solidBGColorRow || b && i == gradientBGRow || (g != 0 && i == gradientBGColorRow) || i == avatarRadiusRow || i == avatarSizeRow || i == avatarMarginLeftRow || i == avatarAlignTopRow || i == ownAvatarAlignTopRow || i == showContactAvatar || i == showOwnAvatar || i == showOwnAvatarGroup || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == onlineColorRow || i == statusSizeRow || i == textSizeRow || i == timeSizeRow || i == dateColorRow || i == dateSizeRow || i == dateBubbleColorRow || i == rTextColorRow || i == rLinkColorRow || i == lTextColorRow || i == lLinkColorRow || i == rTimeColorRow|| i == lTimeColorRow || i == checksColorRow || i == memberColorCheckRow || AndroidUtilities.getBoolPref("chatMemberColorCheck") && i == memberColorRow || i == contactNameColorRow || i == forwardRightNameColorRow || i == forwardLeftNameColorRow || i == showUsernameCheckRow || - i == editTextSizeRow || i == editTextColorRow || i == editTextIconsColorRow || i == sendColorRow || i == editTextBGColorRow || i == attachBGColorRow || i == attachTextColorRow || - i == emojiViewBGColorRow || i == emojiViewTabIconColorRow || i == emojiViewTabColorRow; + i == editTextSizeRow || i == editTextColorRow || i == editTextIconsColorRow || i == sendColorRow || i == editTextBGColorRow || i == editTextBGGradientRow || AndroidUtilities.getIntDef("chatEditTextBGGradient", 0) != 0 && i == editTextBGGradientColorRow || i == attachBGColorRow || i == attachBGGradientRow || AndroidUtilities.getIntDef("chatAttachBGGradient", 0) != 0 && i == attachBGGradientColorRow || i == attachTextColorRow || + i == emojiViewBGColorRow || i == emojiViewBGGradientRow || AndroidUtilities.getIntDef("chatEmojiViewBGGradient", 0) != 0 && i == emojiViewBGGradientColorRow || i == emojiViewTabIconColorRow || i == emojiViewTabColorRow; } @Override @@ -1295,13 +1535,18 @@ public class ThemingChatActivity extends BaseFragment { int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); int darkColor = AndroidUtilities.getIntDarkerColor("themeColor", 0x15); + int lightColor = AndroidUtilities.getIntDarkerColor("themeColor", -0x40); if (i == headerColorRow) { - textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("chatHeaderColor", defColor), true); + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("chatHeaderColor", defColor), false); + } else if (i == headerGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.RowGradientColor), themePrefs.getInt("chatHeaderGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatHeaderGradientColor", defColor), true); } else if (i == headerIconsColorRow) { textCell.setTag("chatHeaderIconsColor"); textCell.setTextAndColor(LocaleController.getString("HeaderIconsColor", R.string.HeaderIconsColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), true); } else if (i == solidBGColorRow) { textCell.setTextAndColor(LocaleController.getString("SolidBGColor", R.string.SolidBGColor), themePrefs.getBoolean("chatSolidBGColorCheck", false) ? themePrefs.getInt("chatSolidBGColor", 0xffffffff) : 0x00000000, true); + } else if (i == gradientBGColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatGradientBG", 0) == 0 || !themePrefs.getBoolean("chatSolidBGColorCheck", false) ? 0x00000000 : themePrefs.getInt("chatGradientBGColor", 0xffffffff), true); } else if (i == memberColorRow) { textCell.setTextAndColor(LocaleController.getString("MemberColor", R.string.MemberColor), themePrefs.getBoolean("chatMemberColorCheck", false) ? themePrefs.getInt("chatMemberColor", darkColor) : 0x00000000, true); } else if (i == contactNameColorRow) { @@ -1334,7 +1579,9 @@ public class ThemingChatActivity extends BaseFragment { } else if (i == nameColorRow) { textCell.setTextAndColor(LocaleController.getString("NameColor", R.string.NameColor), themePrefs.getInt("chatNameColor", 0xffffffff), true); } else if (i == statusColorRow) { - textCell.setTextAndColor(LocaleController.getString("StatusColor", R.string.StatusColor), themePrefs.getInt("chatStatusColor", AndroidUtilities.getIntDarkerColor("themeColor",-0x40)), false); + textCell.setTextAndColor(LocaleController.getString("StatusColor", R.string.StatusColor), themePrefs.getInt("chatStatusColor", lightColor), true); + } else if (i == onlineColorRow) { + textCell.setTextAndColor(LocaleController.getString("OnlineColor", R.string.OnlineColor), themePrefs.getInt("chatOnlineColor", themePrefs.getInt("chatStatusColor", lightColor)), false); } else if (i == rTimeColorRow) { textCell.setTextAndColor(LocaleController.getString("RTimeColor", R.string.RTimeColor), themePrefs.getInt("chatRTimeColor", darkColor), true); } else if (i == lTimeColorRow) { @@ -1350,21 +1597,104 @@ public class ThemingChatActivity extends BaseFragment { } else if (i == editTextColorRow) { textCell.setTextAndColor(LocaleController.getString("EditTextColor", R.string.EditTextColor), themePrefs.getInt("chatEditTextColor", 0xff000000), true); } else if (i == editTextBGColorRow) { - textCell.setTextAndColor(LocaleController.getString("EditTextBGColor", R.string.EditTextBGColor), themePrefs.getInt("chatEditTextBGColor", 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("EditTextBGColor", R.string.EditTextBGColor), themePrefs.getInt("chatEditTextBGColor", 0xffffffff), false); + } else if (i == editTextBGGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatEditTextBGGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatEditTextBGGradientColor", 0xffffffff), true); } else if (i == attachBGColorRow) { - textCell.setTextAndColor(LocaleController.getString("AttachBGColor", R.string.AttachBGColor), themePrefs.getInt("chatAttachBGColor", 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("AttachBGColor", R.string.AttachBGColor), themePrefs.getInt("chatAttachBGColor", 0xffffffff), false); + } else if (i == attachBGGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatAttachBGGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatAttachBGGradientColor", 0xffffffff), true); } else if (i == attachTextColorRow) { textCell.setTextAndColor(LocaleController.getString("AttachTextColor", R.string.AttachTextColor), themePrefs.getInt("chatAttachTextColor", 0xff757575), true); } else if (i == editTextIconsColorRow) { textCell.setTag("chatEditTextIconsColor"); textCell.setTextAndColor(LocaleController.getString("EditTextIconsColor", R.string.EditTextIconsColor), themePrefs.getInt("chatEditTextIconsColor", 0xffadadad), true); } else if (i == emojiViewBGColorRow) { - textCell.setTextAndColor(LocaleController.getString("EmojiViewBGColor", R.string.EmojiViewBGColor), themePrefs.getInt("chatEmojiViewBGColor", 0xfff5f6f7), true); + textCell.setTextAndColor(LocaleController.getString("EmojiViewBGColor", R.string.EmojiViewBGColor), themePrefs.getInt("chatEmojiViewBGColor", 0xfff5f6f7), false); + } else if (i == emojiViewBGGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatEmojiViewBGGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatEmojiViewBGGradientColor", 0xfff5f6f7), true); } else if (i == emojiViewTabIconColorRow) { textCell.setTextAndColor(LocaleController.getString("EmojiViewTabIconColor", R.string.EmojiViewTabIconColor), themePrefs.getInt("chatEmojiViewTabIconColor", 0xffa8a8a8), false); } else if (i == emojiViewTabColorRow) { textCell.setTextAndColor(LocaleController.getString("EmojiViewTabColor", R.string.EmojiViewTabColor), themePrefs.getInt("chatEmojiViewTabColor", AndroidUtilities.getIntDarkerColor("themeColor",-0x15)), false); } + } else if (type == 5) { + if (view == null) { + view = new TextDetailSettingsCell(mContext); + } + + TextDetailSettingsCell textCell = (TextDetailSettingsCell) view; + if(i == gradientBGRow){ + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatGradientBG", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == headerGradientRow){ + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatHeaderGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == editTextBGGradientRow){ + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatEditTextBGGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == attachBGGradientRow){ + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatAttachBGGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == emojiViewBGGradientRow){ + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatEmojiViewBGGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } } return view; } @@ -1381,14 +1711,16 @@ public class ThemingChatActivity extends BaseFragment { return 2; } - else if ( i == headerColorRow || i == muteColorRow || i == headerIconsColorRow || - i == solidBGColorRow || i == rBubbleColorRow || i == lBubbleColorRow || i == nameColorRow || i == statusColorRow || i == dateColorRow || i == dateBubbleColorRow || + else if ( i == headerColorRow || i == headerGradientColorRow || i == muteColorRow || i == headerIconsColorRow || + i == solidBGColorRow || i == gradientBGColorRow || i == rBubbleColorRow || i == lBubbleColorRow || i == nameColorRow || i == statusColorRow || i == onlineColorRow || i == dateColorRow || i == dateBubbleColorRow || i == rTextColorRow || i == rLinkColorRow || i == lTextColorRow || i == lLinkColorRow || i == rLinkColorRow || i == rTimeColorRow || i == lTimeColorRow || i == checksColorRow || i == memberColorRow || i == contactNameColorRow || i == forwardRightNameColorRow || i == forwardLeftNameColorRow || - i == sendColorRow || i == editTextColorRow || i == editTextBGColorRow || i == editTextIconsColorRow || i == attachBGColorRow || i == attachTextColorRow || - i == emojiViewBGColorRow || i == emojiViewTabIconColorRow || i == emojiViewTabColorRow) { + i == sendColorRow || i == editTextColorRow || i == editTextBGColorRow || i == editTextBGGradientColorRow || i == editTextIconsColorRow || i == attachBGColorRow || i == attachBGGradientColorRow || i == attachTextColorRow || + i == emojiViewBGColorRow || i == emojiViewBGGradientColorRow || i == emojiViewTabIconColorRow || i == emojiViewTabColorRow) { return 3; } else if (i == solidBGColorCheckRow || i == memberColorCheckRow || i == showUsernameCheckRow || i == avatarAlignTopRow || i == ownAvatarAlignTopRow || i == showContactAvatar || i == showOwnAvatar || i == showOwnAvatarGroup) { return 4; + } else if (i == headerGradientRow || i == gradientBGRow || i == editTextBGGradientRow || i == attachBGGradientRow || i == emojiViewBGGradientRow) { + return 5; } else { return 2; @@ -1397,7 +1729,7 @@ public class ThemingChatActivity extends BaseFragment { @Override public int getViewTypeCount() { - return 5; + return 6; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatsActivity.java index 6dbb1e94..cdd6ad74 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemingChatsActivity.java @@ -15,7 +15,6 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -29,6 +28,7 @@ import org.telegram.android.AndroidUtilities; import org.telegram.android.ContactsController; import org.telegram.android.LocaleController; import org.telegram.android.MessagesController; +import org.telegram.android.NotificationCenter; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.R; import org.telegram.messenger.TLRPC; @@ -38,6 +38,7 @@ import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Adapters.BaseFragmentAdapter; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; +import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextColorCell; import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextSettingsCell; @@ -88,6 +89,11 @@ public class ThemingChatsActivity extends BaseFragment { private int groupNameSizeRow; private int mediaColorRow; private int groupIconColorRow; + private int rowGradientRow; + private int rowGradientColorRow; + private int rowGradientListCheckRow; + private int headerGradientRow; + private int headerGradientColorRow; private int rowCount; @@ -100,6 +106,8 @@ public class ThemingChatsActivity extends BaseFragment { rowCount = 0; headerSection2Row = rowCount++; headerColorRow = rowCount++; + headerGradientRow = rowCount++; + headerGradientColorRow = rowCount++; headerTitleColorRow = rowCount++; headerTitleRow = rowCount++; headerIconsColorRow = rowCount++; @@ -107,6 +115,9 @@ public class ThemingChatsActivity extends BaseFragment { rowsSectionRow = rowCount++; rowsSection2Row = rowCount++; rowColorRow = rowCount++; + rowGradientRow = rowCount++; + rowGradientColorRow = rowCount++; + //rowGradientListCheckRow = rowCount++; dividerColorRow = rowCount++; avatarRadiusRow = rowCount++; @@ -208,7 +219,7 @@ public class ThemingChatsActivity extends BaseFragment { },themePrefs.getInt( key, defColor), CENTER, 0, false); colorDialog.show(); - } else if (i == headerTitleColorRow) { + } else if (i == headerGradientColorRow) { if (getParentActivity() == null) { return; } @@ -219,6 +230,20 @@ public class ThemingChatsActivity extends BaseFragment { public void colorChanged(int color) { commitInt( key, color); } + + },themePrefs.getInt( key, defColor), CENTER, 0, true); + colorDialog.show(); + } else if (i == headerTitleColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt(key, color); + } },themePrefs.getInt( key, 0xffffffff), CENTER, 0, true); colorDialog.show(); } else if (i == headerIconsColorRow) { @@ -230,7 +255,7 @@ public class ThemingChatsActivity extends BaseFragment { ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { @Override public void colorChanged(int color) { - commitInt( key, color); + commitInt(key, color); } },themePrefs.getInt( key, 0xffffffff), CENTER, 0, false); colorDialog.show(); @@ -244,10 +269,37 @@ public class ThemingChatsActivity extends BaseFragment { @Override public void colorChanged(int color) { commitInt( key, color); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); } },themePrefs.getInt( key, 0xffffffff), CENTER, 0, false); colorDialog.show(); + } else if (i == rowGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt(key, color); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); + } + },themePrefs.getInt( key, 0xffffffff), CENTER, 0, true); + colorDialog.show(); + } else if (i == rowGradientListCheckRow) { + boolean b = themePrefs.getBoolean( key, false); + SharedPreferences.Editor editor = themePrefs.edit(); + editor.putBoolean(key, !b); + editor.commit(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!b); + } + if (listView != null) { + listView.invalidateViews(); + } + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); } else if (i == dividerColorRow) { if (getParentActivity() == null) { return; @@ -302,6 +354,54 @@ public class ThemingChatsActivity extends BaseFragment { }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); + } else if (i == headerGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatsHeaderGradient", which).commit(); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == rowGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("chatsRowGradient", which).commit(); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (i == nameColorRow) { if (getParentActivity() == null) { return; @@ -554,7 +654,7 @@ public class ThemingChatsActivity extends BaseFragment { @Override public void onClick(DialogInterface dialog, int which) { if (numberPicker.getValue() != currentValue) { - commitInt( key, numberPicker.getValue()); + commitInt(key, numberPicker.getValue()); } } }); @@ -645,7 +745,7 @@ public class ThemingChatsActivity extends BaseFragment { @Override public void onClick(DialogInterface dialog, int which) { if (numberPicker.getValue() != currentValue) { - commitInt( key, numberPicker.getValue()); + commitInt(key, numberPicker.getValue()); } } }); @@ -803,8 +903,9 @@ public class ThemingChatsActivity extends BaseFragment { @Override public boolean isEnabled(int i) { - return i == headerColorRow || i == headerTitleColorRow || i == headerIconsColorRow || i == headerTitleRow || - i == rowColorRow || i == dividerColorRow || i == avatarRadiusRow || i == avatarSizeRow || i == avatarMarginLeftRow || + int g = AndroidUtilities.getIntDef("chatsRowGradient",0); + return i == headerColorRow || i == headerGradientRow || (AndroidUtilities.getIntDef("chatsHeaderGradient", 0) != 0 && i == headerGradientColorRow) || i == headerTitleColorRow || i == headerIconsColorRow || i == headerTitleRow || + i == rowColorRow || i == rowGradientRow || (g != 0 && i == rowGradientColorRow) || (g != 0 && i == rowGradientListCheckRow) || i == dividerColorRow || i == avatarRadiusRow || i == avatarSizeRow || i == avatarMarginLeftRow || i == nameColorRow || i == groupNameColorRow || i == unknownNameColorRow || i == groupIconColorRow || i == muteColorRow || i == checksColorRow || i == nameSizeRow || i == groupNameSizeRow || i == messageColorRow || i == memberColorRow || i == mediaColorRow || i == typingColorRow || i == messageSizeRow || i == timeColorRow || i == timeSizeRow || i == countColorRow || i == countSizeRow || i == countBGColorRow || i == floatingPencilColorRow || i == floatingBGColorRow; } @@ -897,7 +998,10 @@ public class ThemingChatsActivity extends BaseFragment { if (i == headerColorRow) { textCell.setTag("chatsHeaderColor"); - textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("chatsHeaderColor", defColor), true); + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("chatsHeaderColor", defColor), false); + } else if (i == headerGradientColorRow) { + textCell.setTag("chatsHeaderGradientColor"); + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatsHeaderGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatsHeaderGradientColor", defColor), true); } else if (i == headerTitleColorRow) { textCell.setTag("chatsHeaderTitleColor"); textCell.setTextAndColor(LocaleController.getString("HeaderTitleColor", R.string.HeaderTitleColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), true); @@ -906,7 +1010,10 @@ public class ThemingChatsActivity extends BaseFragment { textCell.setTextAndColor(LocaleController.getString("HeaderIconsColor", R.string.HeaderIconsColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), false); } else if (i == rowColorRow) { textCell.setTag("chatsRowColor"); - textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt("chatsRowColor", 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt("chatsRowColor", 0xffffffff), false); + } else if (i == rowGradientColorRow) { + textCell.setTag("chatsRowGradientColor"); + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("chatsRowGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("chatsRowGradientColor", 0xffffffff), true); } else if (i == dividerColorRow) { textCell.setTag("chatsDividerColor"); textCell.setTextAndColor(LocaleController.getString("DividerColor", R.string.DividerColor), themePrefs.getInt("chatsDividerColor", 0xffdcdcdc), true); @@ -956,17 +1063,17 @@ public class ThemingChatsActivity extends BaseFragment { textCell.setTag("chatsFloatingBGColor"); textCell.setTextAndColor(LocaleController.getString("FloatingBGColor", R.string.FloatingBGColor), themePrefs.getInt("chatsFloatingBGColor", defColor), false); } - } /*else if (type == 4) { + } else if (type == 4) { if (view == null) { view = new TextCheckCell(mContext); } TextCheckCell textCell = (TextCheckCell) view; - - if (i == usernameTitleRow) { - textCell.setTag("chatsUsernameTitle"); - textCell.setTextAndCheck(LocaleController.getString("UsernameTitle", R.string.UsernameTitle), themePrefs.getBoolean("chatsUsernameTitle", false), false); + if (i == rowGradientListCheckRow) { + textCell.setTag("chatsRowGradientListCheck"); + int value = AndroidUtilities.getIntDef("chatsRowGradient", 0); + textCell.setTextAndCheck(LocaleController.getString("RowGradientList", R.string.RowGradientList), value == 0 ? false : themePrefs.getBoolean("chatsRowGradientListCheck", false), true); } - }*/ else if (type == 5) { + } else if (type == 5) { if (view == null) { view = new TextDetailSettingsCell(mContext); } @@ -975,9 +1082,7 @@ public class ThemingChatsActivity extends BaseFragment { if (i == headerTitleRow) { textCell.setTag("chatsHeaderTitle"); textCell.setMultilineDetail(false); - int value = 0; - value = themePrefs.getInt("chatsHeaderTitle", 0); - Log.e("chatsHeaderTitle", "" + value); + int value = themePrefs.getInt("chatsHeaderTitle", 0); int user_id = UserConfig.getClientUserId(); TLRPC.User user = MessagesController.getInstance().getUser(user_id); String text; @@ -997,6 +1102,36 @@ public class ThemingChatsActivity extends BaseFragment { } else if (value == 4) { textCell.setTextAndValue(LocaleController.getString("HeaderTitle", R.string.HeaderTitle), "", true); } + } else if(i == headerGradientRow){ + textCell.setTag("chatsHeaderGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatsHeaderGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == rowGradientRow){ + textCell.setTag("chatsRowGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("chatsRowGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } } } return view; @@ -1010,13 +1145,13 @@ public class ThemingChatsActivity extends BaseFragment { return 1; } else if ( i == avatarRadiusRow || i == avatarSizeRow || i == avatarMarginLeftRow || i == nameSizeRow || i == groupNameSizeRow || i == messageSizeRow || i == timeSizeRow || i == countSizeRow ) { return 2; - } else if ( i == headerColorRow || i == headerTitleColorRow || i == headerIconsColorRow || - i == rowColorRow || i == dividerColorRow || i == nameColorRow || i == groupNameColorRow || i == unknownNameColorRow || i == groupIconColorRow || i == muteColorRow || i == checksColorRow || i == messageColorRow || i == memberColorRow || i == mediaColorRow || i == typingColorRow || i == timeColorRow || i == countColorRow || + } else if ( i == headerColorRow || i == headerGradientColorRow || i == headerTitleColorRow || i == headerIconsColorRow || + i == rowColorRow || i == rowGradientColorRow || i == dividerColorRow || i == nameColorRow || i == groupNameColorRow || i == unknownNameColorRow || i == groupIconColorRow || i == muteColorRow || i == checksColorRow || i == messageColorRow || i == memberColorRow || i == mediaColorRow || i == typingColorRow || i == timeColorRow || i == countColorRow || i == countBGColorRow || i == floatingPencilColorRow || i == floatingBGColorRow) { return 3; - }/* else if (i == usernameTitleRow) { + } else if (i == rowGradientListCheckRow) { return 4; - }*/ else if (i == headerTitleRow) { + } else if (i == headerTitleRow || i == headerGradientRow || i == rowGradientRow) { return 5; } else { return 2; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemingContactsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemingContactsActivity.java index b43f691f..dd3507b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemingContactsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemingContactsActivity.java @@ -33,12 +33,17 @@ import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Adapters.BaseFragmentAdapter; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; +import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextColorCell; +import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.ColorSelectorDialog; import org.telegram.ui.Components.NumberPicker; +import java.util.ArrayList; +import java.util.List; + import static org.telegram.ui.Components.ColorSelectorDialog.OnColorChangedListener; public class ThemingContactsActivity extends BaseFragment { @@ -62,6 +67,13 @@ public class ThemingContactsActivity extends BaseFragment { private int onlineColorRow; private int iconsColorRow; + private int rowGradientRow; + private int rowGradientColorRow; + private int rowGradientListCheckRow; + + private int headerGradientRow; + private int headerGradientColorRow; + private int rowCount; public final static int CENTER = 0; @@ -73,12 +85,17 @@ public class ThemingContactsActivity extends BaseFragment { rowCount = 0; headerSection2Row = rowCount++; headerColorRow = rowCount++; + headerGradientRow = rowCount++; + headerGradientColorRow = rowCount++; headerTitleColorRow = rowCount++; headerIconsColorRow = rowCount++; rowsSectionRow = rowCount++; rowsSection2Row = rowCount++; rowColorRow = rowCount++; + rowGradientRow = rowCount++; + rowGradientColorRow = rowCount++; + //rowGradientListCheckRow = rowCount++; avatarRadiusRow = rowCount++; iconsColorRow = rowCount++; nameColorRow = rowCount++; @@ -158,6 +175,20 @@ public class ThemingContactsActivity extends BaseFragment { },themePrefs.getInt("contactsHeaderColor", AndroidUtilities.getIntColor("themeColor")), CENTER, 0, false); colorDialog.show(); + } else if (i == headerGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("contactsHeaderGradientColor", color); + } + + },themePrefs.getInt("contactsHeaderGradientColor", AndroidUtilities.getIntColor("themeColor")), CENTER, 0, true); + colorDialog.show(); } else if (i == headerTitleColorRow) { if (getParentActivity() == null) { return; @@ -211,6 +242,76 @@ public class ThemingContactsActivity extends BaseFragment { },themePrefs.getInt("contactsRowColor", 0xffffffff), CENTER, 0, false); colorDialog.show(); + } else if (i == rowGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("contactsRowGradientColor", color); + } + },themePrefs.getInt( "contactsRowGradientColor", 0xffffffff), CENTER, 0, true); + colorDialog.show(); + } else if (i == rowGradientListCheckRow) { + boolean b = themePrefs.getBoolean("contactsRowGradientListCheck", false); + SharedPreferences.Editor editor = themePrefs.edit(); + editor.putBoolean("contactsRowGradientListCheck", !b); + editor.commit(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!b); + } + if (listView != null) { + listView.invalidateViews(); + } + } else if (i == headerGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("contactsHeaderGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == rowGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("contactsRowGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (i == nameColorRow) { if (getParentActivity() == null) { return; @@ -239,7 +340,7 @@ public class ThemingContactsActivity extends BaseFragment { },themePrefs.getInt("contactsStatusColor", 0xffa8a8a8), CENTER, 0, false); colorDialog.show(); - } else if (i == onlineColorRow) { + } else if (i == onlineColorRow) { if (getParentActivity() == null) { return; } @@ -327,6 +428,8 @@ public class ThemingContactsActivity extends BaseFragment { } if (i == headerColorRow) { resetInt("contactsHeaderColor"); + } else if (i == headerGradientColorRow) { + resetInt("contactsHeaderGradientColor"); } else if (i == headerTitleColorRow) { resetInt("contactsHeaderTitleColor"); } else if (i == headerIconsColorRow) { @@ -335,6 +438,12 @@ public class ThemingContactsActivity extends BaseFragment { resetInt("contactsIconsColor"); } else if (i == rowColorRow) { resetInt("contactsRowColor"); + } else if (i == rowGradientColorRow) { + resetInt("contactsRowGradientColor"); + } else if (i == headerGradientRow) { + resetInt("contactsHeaderGradient"); + } else if (i == rowGradientRow) { + resetInt("contactsRowGradient"); } else if (i == avatarRadiusRow) { resetInt("contactsAvatarRadius"); } else if (i == nameColorRow) { @@ -347,7 +456,10 @@ public class ThemingContactsActivity extends BaseFragment { resetInt("contactsStatusSize"); } else if (i == onlineColorRow) { resetInt("contactsOnlineColor"); + } else{ + if(view.getTag() != null)resetPref(view.getTag().toString()); } + return true; } }); @@ -362,6 +474,16 @@ public class ThemingContactsActivity extends BaseFragment { return fragmentView; } + private void resetPref(String key){ + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + SharedPreferences.Editor editor = preferences.edit(); + if(key != null)editor.remove(key); + editor.commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + private void resetInt(String key){ SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); SharedPreferences.Editor editor = preferences.edit(); @@ -441,7 +563,8 @@ public class ThemingContactsActivity extends BaseFragment { @Override public boolean isEnabled(int i) { - return i == headerColorRow || i == headerTitleColorRow || i == headerIconsColorRow || i == iconsColorRow || i == rowColorRow || i == avatarRadiusRow || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == statusSizeRow || + int g = AndroidUtilities.getIntDef("contactsRowGradient", 0); + return i == headerColorRow || i == headerGradientRow || AndroidUtilities.getIntDef("contactsHeaderGradient", 0) != 0 && i == headerGradientColorRow || i == headerTitleColorRow || i == headerIconsColorRow || i == iconsColorRow || i == rowColorRow || i == rowGradientRow || (g != 0 && i == rowGradientColorRow) || (g != 0 && i == rowGradientListCheckRow) || i == avatarRadiusRow || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == statusSizeRow || i == onlineColorRow ; } @@ -510,7 +633,9 @@ public class ThemingContactsActivity extends BaseFragment { TextColorCell textCell = (TextColorCell) view; if (i == headerColorRow) { - textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("contactsHeaderColor", AndroidUtilities.getIntColor("themeColor")), true); + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("contactsHeaderColor", AndroidUtilities.getIntColor("themeColor")), false); + } else if (i == headerGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("contactsHeaderGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("contactsHeaderGradientColor", AndroidUtilities.getIntColor("themeColor")), true); } else if (i == headerTitleColorRow) { textCell.setTextAndColor(LocaleController.getString("HeaderTitleColor", R.string.HeaderTitleColor), themePrefs.getInt("contactsHeaderTitleColor", 0xffffffff), true); } else if (i == headerIconsColorRow) { @@ -518,7 +643,9 @@ public class ThemingContactsActivity extends BaseFragment { } else if (i == iconsColorRow) { textCell.setTextAndColor(LocaleController.getString("IconsColor", R.string.IconsColor), themePrefs.getInt("contactsIconsColor", 0xff737373), true); } else if (i == rowColorRow) { - textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt("contactsRowColor", 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt("contactsRowColor", 0xffffffff), false); + } else if (i == rowGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("contactsRowGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("contactsRowGradientColor", 0xffffffff), true); } else if (i == nameColorRow) { textCell.setTextAndColor(LocaleController.getString("NameColor", R.string.NameColor), themePrefs.getInt("contactsNameColor", 0xff000000), true); } else if (i == statusColorRow) { @@ -526,6 +653,53 @@ public class ThemingContactsActivity extends BaseFragment { } else if (i == onlineColorRow) { textCell.setTextAndColor(LocaleController.getString("OnlineColor", R.string.OnlineColor), themePrefs.getInt("contactsOnlineColor", AndroidUtilities.getIntDarkerColor("themeColor",0x15)), false); } + } else if (type == 4) { + if (view == null) { + view = new TextCheckCell(mContext); + } + TextCheckCell textCell = (TextCheckCell) view; + if (i == rowGradientListCheckRow) { + textCell.setTag("contactsRowGradientListCheck"); + int value = AndroidUtilities.getIntDef("contactsRowGradient", 0); + textCell.setTextAndCheck(LocaleController.getString("RowGradientList", R.string.RowGradientList), value == 0 ? false : themePrefs.getBoolean("contactsRowGradientListCheck", false), true); + } + } else if (type == 5) { + if (view == null) { + view = new TextDetailSettingsCell(mContext); + } + + TextDetailSettingsCell textCell = (TextDetailSettingsCell) view; + if(i == headerGradientRow){ + textCell.setTag("contactsHeaderGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("contactsHeaderGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == rowGradientRow){ + textCell.setTag("contactsRowGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("contactsRowGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } } return view; } @@ -541,10 +715,15 @@ public class ThemingContactsActivity extends BaseFragment { else if ( i == avatarRadiusRow || i == nameSizeRow || i == statusSizeRow ) { return 2; } - - else if ( i == headerColorRow || i == headerTitleColorRow || i == headerIconsColorRow || i == iconsColorRow || i == rowColorRow || i == nameColorRow || i == statusColorRow || i == onlineColorRow) { + else if ( i == headerColorRow || i == headerGradientColorRow || i == headerTitleColorRow || i == headerIconsColorRow || i == iconsColorRow || i == rowColorRow || i == rowGradientColorRow || i == nameColorRow || i == statusColorRow || i == onlineColorRow) { return 3; } + else if (i == rowGradientListCheckRow) { + return 4; + } + else if ( i == headerGradientRow || i == rowGradientRow) { + return 5; + } else { return 2; } @@ -552,7 +731,7 @@ public class ThemingContactsActivity extends BaseFragment { @Override public int getViewTypeCount() { - return 4; + return 6; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemingDrawerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemingDrawerActivity.java index 707ee33f..ea776867 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemingDrawerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemingDrawerActivity.java @@ -37,11 +37,15 @@ import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextColorCell; +import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.ColorSelectorDialog; import org.telegram.ui.Components.NumberPicker; +import java.util.ArrayList; +import java.util.List; + import static org.telegram.ui.Components.ColorSelectorDialog.OnColorChangedListener; public class ThemingDrawerActivity extends BaseFragment { @@ -71,6 +75,12 @@ public class ThemingDrawerActivity extends BaseFragment { private int listDividerColorRow; private int centerAvatarRow; + private int rowGradientRow; + private int rowGradientColorRow; + private int rowGradientListCheckRow; + private int headerGradientRow; + private int headerGradientColorRow; + private int rowCount; public final static int CENTER = 0; @@ -87,6 +97,8 @@ public class ThemingDrawerActivity extends BaseFragment { headerBackgroundCheckRow = rowCount++; hideBackgroundShadowRow = rowCount++; headerColorRow = rowCount++; + headerGradientRow = rowCount++; + headerGradientColorRow = rowCount++; avatarColorRow = rowCount++; avatarRadiusRow = rowCount++; avatarSizeRow = rowCount++; @@ -99,6 +111,9 @@ public class ThemingDrawerActivity extends BaseFragment { rowsSectionRow = rowCount++; rowsSection2Row = rowCount++; listColorRow = rowCount++; + rowGradientRow = rowCount++; + rowGradientColorRow = rowCount++; + //rowGradientListCheckRow = rowCount++; listDividerColorRow = rowCount++; iconColorRow = rowCount++; optionColorRow = rowCount++; @@ -167,6 +182,7 @@ public class ThemingDrawerActivity extends BaseFragment { SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); final String key = view.getTag() != null ? view.getTag().toString() : ""; + int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); if (i == headerColorRow) { if (getParentActivity() == null) { @@ -180,7 +196,43 @@ public class ThemingDrawerActivity extends BaseFragment { commitInt("drawerHeaderColor", color); } - },themePrefs.getInt("drawerHeaderColor", AndroidUtilities.getIntColor("themeColor")), CENTER, 0, false); + },themePrefs.getInt("drawerHeaderColor", defColor), CENTER, 0, false); + colorDialog.show(); + } else if (i == headerGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("drawerHeaderGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == headerGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("drawerHeaderGradientColor", color); + } + },themePrefs.getInt("drawerHeaderGradientColor", defColor), CENTER, 0, true); colorDialog.show(); } else if (i == headerBackgroundCheckRow) { boolean b = themePrefs.getBoolean( key, true); @@ -230,6 +282,53 @@ public class ThemingDrawerActivity extends BaseFragment { },themePrefs.getInt("drawerListColor", 0xffffffff), CENTER, 0, false); colorDialog.show(); + } else if (i == rowGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt("drawerRowGradientColor", color); + } + },themePrefs.getInt( "drawerRowGradientColor", 0xffffffff), CENTER, 0, true); + colorDialog.show(); + } else if (i == rowGradientListCheckRow) { + boolean b = themePrefs.getBoolean( "drawerRowGradientListCheck", false); + SharedPreferences.Editor editor = themePrefs.edit(); + editor.putBoolean("drawerRowGradientListCheck", !b); + editor.commit(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!b); + } + if (listView != null) { + listView.invalidateViews(); + } + } else if (i == rowGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("drawerRowGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (i == listDividerColorRow) { if (getParentActivity() == null) { return; @@ -243,7 +342,7 @@ public class ThemingDrawerActivity extends BaseFragment { player = true; } - },themePrefs.getInt("drawerListDividerColor", 0xffd9d9d9), CENTER, 0, false); + },themePrefs.getInt("drawerListDividerColor", 0xffd9d9d9), CENTER, 0, true); colorDialog.show(); } else if (i == iconColorRow) { if (getParentActivity() == null) { @@ -288,7 +387,7 @@ public class ThemingDrawerActivity extends BaseFragment { commitInt("drawerVersionColor", color); } - },themePrefs.getInt("drawerVersionColor", 0xffa3a3a3), CENTER, 0, false); + },themePrefs.getInt("drawerVersionColor", 0xffa3a3a3), CENTER, 0, true); colorDialog.show(); } else if (i == avatarColorRow) { if (getParentActivity() == null) { @@ -472,9 +571,22 @@ public class ThemingDrawerActivity extends BaseFragment { } if (i == headerColorRow) { resetInt("drawerHeaderColor"); + } else if (i == headerGradientRow) { + resetInt("drawerHeaderGradient"); + } else if (i == headerGradientColorRow) { + resetInt("drawerHeaderGradientColor"); } else if (i == listColorRow) { resetInt("drawerListColor"); player = true; + } else if (i == rowGradientColorRow) { + resetInt("drawerRowGradientColor"); + player = true; + } else if (i == rowGradientRow) { + resetInt("drawerRowGradient"); + player = true; + } else if (i == rowGradientListCheckRow) { + resetInt("drawerRowGradientListCheck"); + player = true; } else if (i == listDividerColorRow) { resetInt("drawerListDividerColor"); } else if (i == avatarColorRow) { @@ -616,7 +728,10 @@ public class ThemingDrawerActivity extends BaseFragment { @Override public boolean isEnabled(int i) { - return i == headerColorRow || i == headerBackgroundCheckRow || i == hideBackgroundShadowRow || i == centerAvatarRow || i == listColorRow || i == listDividerColorRow || i == iconColorRow || i == optionColorRow || i == optionSizeRow || i == avatarColorRow || i == avatarRadiusRow || i == nameColorRow || i == avatarSizeRow || i == nameSizeRow || i == phoneColorRow || i == phoneSizeRow || + int h = AndroidUtilities.getIntDef("drawerHeaderGradient", 0); + int g = AndroidUtilities.getIntDef("drawerRowGradient", 0); + return i == headerColorRow || i == headerGradientRow || h > 0 && i == headerGradientColorRow || i == headerBackgroundCheckRow || i == hideBackgroundShadowRow || i == centerAvatarRow || + i == listColorRow || i == rowGradientRow || g != 0 && i == rowGradientColorRow || g != 0 && i == rowGradientListCheckRow || i == listDividerColorRow || i == iconColorRow || i == optionColorRow || i == optionSizeRow || i == avatarColorRow || i == avatarRadiusRow || i == nameColorRow || i == avatarSizeRow || i == nameSizeRow || i == phoneColorRow || i == phoneSizeRow || i == versionColorRow || i == versionSizeRow; } @@ -644,6 +759,8 @@ public class ThemingDrawerActivity extends BaseFragment { public View getView(int i, View view, ViewGroup viewGroup) { int type = getItemViewType(i); SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); + int darkColor = AndroidUtilities.getIntDarkerColor("themeColor", 0x15); if (type == 0) { if (view == null) { view = new ShadowSectionCell(mContext); @@ -694,9 +811,13 @@ public class ThemingDrawerActivity extends BaseFragment { TextColorCell textCell = (TextColorCell) view; if (i == headerColorRow) { - textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("drawerHeaderColor", AndroidUtilities.getIntColor("themeColor")), true); + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("drawerHeaderColor", defColor), false); + } else if (i == headerGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("drawerHeaderGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("drawerHeaderGradientColor", defColor), true); } else if (i == listColorRow) { - textCell.setTextAndColor(LocaleController.getString("ListColor", R.string.ListColor), themePrefs.getInt("drawerListColor", 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("ListColor", R.string.ListColor), themePrefs.getInt("drawerListColor", 0xffffffff), false); + } else if (i == rowGradientColorRow) { + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("drawerRowGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("drawerRowGradientColor", 0xffffffff), true); } else if (i == listDividerColorRow) { textCell.setTextAndColor(LocaleController.getString("ListDividerColor", R.string.ListDividerColor), themePrefs.getInt("drawerListDividerColor", 0xffd9d9d9), true); } else if (i == iconColorRow) { @@ -706,13 +827,13 @@ public class ThemingDrawerActivity extends BaseFragment { } else if (i == versionColorRow) { textCell.setTextAndColor(LocaleController.getString("VersionColor", R.string.VersionColor), themePrefs.getInt("drawerVersionColor", 0xffa3a3a3), true); } else if (i == avatarColorRow) { - textCell.setTextAndColor(LocaleController.getString("AvatarColor", R.string.AvatarColor), themePrefs.getInt("drawerAvatarColor", AndroidUtilities.getIntDarkerColor("themeColor", 0x15)), true); + textCell.setTextAndColor(LocaleController.getString("AvatarColor", R.string.AvatarColor), themePrefs.getInt("drawerAvatarColor", darkColor), true); } else if (i == nameColorRow) { textCell.setTextAndColor(LocaleController.getString("NameColor", R.string.NameColor), themePrefs.getInt("drawerNameColor", 0xffffffff), true); } else if (i == phoneColorRow) { textCell.setTextAndColor(LocaleController.getString("PhoneColor", R.string.PhoneColor), themePrefs.getInt("drawerPhoneColor", AndroidUtilities.getIntDarkerColor("themeColor",-0x40)), true); } - } else if (type == 4) { + } else if (type == 4) { if (view == null) { view = new TextCheckCell(mContext); } @@ -726,6 +847,47 @@ public class ThemingDrawerActivity extends BaseFragment { } else if (i == centerAvatarRow) { textCell.setTag("drawerCenterAvatarCheck"); textCell.setTextAndCheck(LocaleController.getString("CenterAvatar", R.string.CenterAvatar), themePrefs.getBoolean("drawerCenterAvatarCheck", false), false); + } else if (i == rowGradientListCheckRow) { + textCell.setTag("drawerRowGradientListCheck"); + int value = AndroidUtilities.getIntDef("drawerRowGradient", 0); + textCell.setTextAndCheck(LocaleController.getString("RowGradientList", R.string.RowGradientList), value == 0 ? false : themePrefs.getBoolean("drawerRowGradientListCheck", false), true); + } + } else if (type == 5) { + if (view == null) { + view = new TextDetailSettingsCell(mContext); + } + TextDetailSettingsCell textCell = (TextDetailSettingsCell) view; + + if(i == headerGradientRow){ + textCell.setTag("drawerHeaderGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("drawerHeaderGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == rowGradientRow){ + textCell.setTag("drawerRowGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("drawerRowGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } } } return view; @@ -742,12 +904,15 @@ public class ThemingDrawerActivity extends BaseFragment { else if ( i == avatarRadiusRow || i == avatarSizeRow || i == nameSizeRow || i == phoneSizeRow || i == optionSizeRow || i == versionSizeRow) { return 2; } - else if ( i == headerColorRow || i == listColorRow || i == listDividerColorRow || i == iconColorRow || i == optionColorRow || i == versionColorRow || i == avatarColorRow || i == nameColorRow || i == phoneColorRow) { + else if ( i == headerColorRow || i == headerGradientColorRow || i == listColorRow || i == rowGradientColorRow || i == listDividerColorRow || i == iconColorRow || i == optionColorRow || i == versionColorRow || i == avatarColorRow || i == nameColorRow || i == phoneColorRow) { return 3; } - else if (i == headerBackgroundCheckRow || i == hideBackgroundShadowRow || i == centerAvatarRow) { + else if (i == headerBackgroundCheckRow || i == hideBackgroundShadowRow || i == centerAvatarRow || i == rowGradientListCheckRow) { return 4; } + else if (i == headerGradientRow || i == rowGradientRow) { + return 5; + } else { return 2; } @@ -755,7 +920,7 @@ public class ThemingDrawerActivity extends BaseFragment { @Override public int getViewTypeCount() { - return 5; + return 6; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemingProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemingProfileActivity.java index 35087ce2..ecf9cdc3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemingProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemingProfileActivity.java @@ -33,12 +33,17 @@ import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Adapters.BaseFragmentAdapter; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.ShadowSectionCell; +import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextColorCell; +import org.telegram.ui.Cells.TextDetailSettingsCell; import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.ColorSelectorDialog; import org.telegram.ui.Components.NumberPicker; +import java.util.ArrayList; +import java.util.List; + import static org.telegram.ui.Components.ColorSelectorDialog.OnColorChangedListener; public class ThemingProfileActivity extends BaseFragment { @@ -61,8 +66,16 @@ public class ThemingProfileActivity extends BaseFragment { private int titleColorRow; private int summaryColorRow; - private int avatarRadiusRow; + private int headerAvatarRadiusRow; private int iconsColorRow; + private int onlineColorRow; + + private int rowGradientRow; + private int rowGradientColorRow; + private int rowGradientListCheckRow; + private int headerGradientRow; + private int headerGradientColorRow; + private int avatarRadiusRow; private int rowCount; @@ -75,8 +88,10 @@ public class ThemingProfileActivity extends BaseFragment { rowCount = 0; headerSection2Row = rowCount++; headerColorRow = rowCount++; + headerGradientRow = rowCount++; + headerGradientColorRow = rowCount++; headerIconsColorRow = rowCount++; - avatarRadiusRow = rowCount++; + headerAvatarRadiusRow = rowCount++; nameSizeRow = rowCount++; nameColorRow = rowCount++; @@ -86,9 +101,13 @@ public class ThemingProfileActivity extends BaseFragment { rowsSectionRow = rowCount++; rowsSection2Row = rowCount++; rowColorRow = rowCount++; - + rowGradientRow = rowCount++; + rowGradientColorRow = rowCount++; + //rowGradientListCheckRow = rowCount++; + avatarRadiusRow = rowCount++; titleColorRow = rowCount++; summaryColorRow = rowCount++; + onlineColorRow = rowCount++; iconsColorRow = rowCount++; return true; @@ -147,6 +166,7 @@ public class ThemingProfileActivity extends BaseFragment { SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); final String key = view.getTag() != null ? view.getTag().toString() : ""; + int defColor = themePrefs.getInt("themeColor", AndroidUtilities.defColor); if (i == headerColorRow) { if (getParentActivity() == null) { @@ -160,7 +180,79 @@ public class ThemingProfileActivity extends BaseFragment { commitInt(key, color); } - },themePrefs.getInt(key, AndroidUtilities.getIntColor("themeColor")), CENTER, 0, false); + },themePrefs.getInt(key, defColor), CENTER, 0, false); + + colorDialog.show(); + } else if (i == headerGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("profileHeaderGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == rowGradientRow) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("RowGradient", R.string.RowGradient)); + List array = new ArrayList<>(); + array.add( LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled)); + array.add(LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom)); + array.add( LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight)); + array.add( LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR)); + array.add( LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR)); + String[] simpleArray = new String[ array.size() ]; + array.toArray( new String[ array.size() ]); + builder.setItems(array.toArray(simpleArray), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE); + themePrefs.edit().putInt("profileRowGradient", which).commit(); + if (listView != null) { + listView.invalidateViews(); + } + } + }); + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (i == rowGradientListCheckRow) { + boolean b = themePrefs.getBoolean( "profileRowGradientListCheck", false); + SharedPreferences.Editor editor = themePrefs.edit(); + editor.putBoolean("profileRowGradientListCheck", !b); + editor.commit(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(!b); + } + if (listView != null) { + listView.invalidateViews(); + } + } else if (i == headerGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt(key, color); + } + + },themePrefs.getInt(key, defColor), CENTER, 0, false); colorDialog.show(); } else if (i == headerIconsColorRow) { @@ -273,7 +365,21 @@ public class ThemingProfileActivity extends BaseFragment { },themePrefs.getInt( key, 0xffffffff), CENTER, 0, false); colorDialog.show(); - } else if (i == avatarRadiusRow) { + } else if (i == rowGradientColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt( key, color); + } + + },themePrefs.getInt( key, 0xffffffff), CENTER, 0, false); + colorDialog.show(); + } else if (i == headerAvatarRadiusRow) { if (getParentActivity() == null) { return; } @@ -294,6 +400,27 @@ public class ThemingProfileActivity extends BaseFragment { } }); showDialog(builder.create()); + } else if (i == avatarRadiusRow) { + if (getParentActivity() == null) { + return; + } + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("AvatarRadius", R.string.AvatarRadius)); + final NumberPicker numberPicker = new NumberPicker(getParentActivity()); + final int currentValue = themePrefs.getInt( "profileRowAvatarRadius", 32); + numberPicker.setMinValue(1); + numberPicker.setMaxValue(32); + numberPicker.setValue(currentValue); + builder.setView(numberPicker); + builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (numberPicker.getValue() != currentValue) { + commitInt("profileRowAvatarRadius", numberPicker.getValue()); + } + } + }); + showDialog(builder.create()); } else if (i == titleColorRow) { if (getParentActivity() == null) { return; @@ -320,6 +447,19 @@ public class ThemingProfileActivity extends BaseFragment { } },themePrefs.getInt(key, 0xff8a8a8a), CENTER, 0, false); colorDialog.show(); + } else if (i == onlineColorRow) { + if (getParentActivity() == null) { + return; + } + LayoutInflater li = (LayoutInflater)getParentActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + li.inflate(R.layout.colordialog, null, false); + ColorSelectorDialog colorDialog = new ColorSelectorDialog(getParentActivity(), new OnColorChangedListener() { + @Override + public void colorChanged(int color) { + commitInt(key, color); + } + },themePrefs.getInt(key, AndroidUtilities.getIntDarkerColor("themeColor", -0x40)), CENTER, 0, false); + colorDialog.show(); } } }); @@ -426,8 +566,10 @@ public class ThemingProfileActivity extends BaseFragment { @Override public boolean isEnabled(int i) { - return i == headerColorRow || i == headerIconsColorRow || i == iconsColorRow || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == statusSizeRow || - i == rowColorRow || i == titleColorRow || i == summaryColorRow || i == avatarRadiusRow; + int h = AndroidUtilities.getIntDef("profileHeaderGradient", 0); + int g = AndroidUtilities.getIntDef("profileRowGradient", 0); + return i == headerColorRow || i == headerGradientRow || h > 0 && i == headerGradientColorRow || i == headerIconsColorRow || i == iconsColorRow || i == nameColorRow || i == nameSizeRow || i == statusColorRow || i == statusSizeRow || + i == rowColorRow || i == rowGradientRow || g != 0 && i == rowGradientColorRow || g != 0 && i == rowGradientListCheckRow || i == titleColorRow || i == summaryColorRow || i == onlineColorRow || i == headerAvatarRadiusRow || i == avatarRadiusRow; } @Override @@ -483,10 +625,14 @@ public class ThemingProfileActivity extends BaseFragment { textCell.setTag("profileStatusSize"); int size = themePrefs.getInt("profileStatusSize", AndroidUtilities.isTablet() ? 16 : 14); textCell.setTextAndValue(LocaleController.getString("StatusSize", R.string.StatusSize), String.format("%d", size), true); - } else if (i == avatarRadiusRow) { + } else if (i == headerAvatarRadiusRow) { textCell.setTag("profileAvatarRadius"); int size = themePrefs.getInt("profileAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32); textCell.setTextAndValue(LocaleController.getString("AvatarRadius", R.string.AvatarRadius), String.format("%d", size), true); + } else if (i == avatarRadiusRow) { + textCell.setTag("profileRowAvatarRadius"); + int size = themePrefs.getInt("profileRowAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32); + textCell.setTextAndValue(LocaleController.getString("AvatarRadius", R.string.AvatarRadius), String.format("%d", size), true); } } else if (type == 3){ @@ -495,10 +641,14 @@ public class ThemingProfileActivity extends BaseFragment { } TextColorCell textCell = (TextColorCell) view; + int defColor = AndroidUtilities.getIntColor("themeColor"); if (i == headerColorRow) { textCell.setTag("profileHeaderColor"); - textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt(textCell.getTag().toString(), AndroidUtilities.getIntColor("themeColor")), true); + textCell.setTextAndColor(LocaleController.getString("HeaderColor", R.string.HeaderColor), themePrefs.getInt("profileHeaderColor", defColor), false); + } else if (i == headerGradientColorRow) { + textCell.setTag("profileHeaderGradientColor"); + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("profileHeaderGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("profileHeaderGradientColor", defColor), true); } else if (i == headerIconsColorRow) { textCell.setTag("profileHeaderIconsColor"); textCell.setTextAndColor(LocaleController.getString("HeaderIconsColor", R.string.HeaderIconsColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), true); @@ -513,13 +663,67 @@ public class ThemingProfileActivity extends BaseFragment { textCell.setTextAndColor(LocaleController.getString("StatusColor", R.string.StatusColor), themePrefs.getInt(textCell.getTag().toString(), AndroidUtilities.getIntDarkerColor("themeColor",-0x40)), false); } else if (i == rowColorRow) { textCell.setTag("profileRowColor"); - textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), true); + textCell.setTextAndColor(LocaleController.getString("RowColor", R.string.RowColor), themePrefs.getInt(textCell.getTag().toString(), 0xffffffff), false); + } else if (i == rowGradientColorRow) { + textCell.setTag("profileRowGradientColor"); + textCell.setTextAndColor(LocaleController.getString("RowGradientColor", R.string.RowGradientColor), themePrefs.getInt("profileRowGradient", 0) == 0 ? 0x00000000 : themePrefs.getInt("profileRowGradientColor", 0xffffffff), true); } else if (i == titleColorRow) { textCell.setTag("profileTitleColor"); textCell.setTextAndColor(LocaleController.getString("NameColor", R.string.NameColor), themePrefs.getInt(textCell.getTag().toString(), 0xff000000), true); } else if (i == summaryColorRow) { textCell.setTag("profileSummaryColor"); textCell.setTextAndColor(LocaleController.getString("StatusColor", R.string.StatusColor), themePrefs.getInt(textCell.getTag().toString(), 0xff8a8a8a), true); + } else if (i == onlineColorRow) { + textCell.setTag("profileOnlineColor"); + textCell.setTextAndColor(LocaleController.getString("OnlineColor", R.string.OnlineColor), themePrefs.getInt("profileOnlineColor", AndroidUtilities.getIntDarkerColor("themeColor", -0x40)), true); + } + } else if (type == 4) { + if (view == null) { + view = new TextCheckCell(mContext); + } + TextCheckCell textCell = (TextCheckCell) view; + + if (i == rowGradientListCheckRow) { + textCell.setTag("profileRowGradientListCheck"); + int value = AndroidUtilities.getIntDef("profileRowGradient", 0); + textCell.setTextAndCheck(LocaleController.getString("RowGradientList", R.string.RowGradientList), value == 0 ? false : themePrefs.getBoolean("profileRowGradientListCheck", false), true); + } + } else if (type == 5) { + if (view == null) { + view = new TextDetailSettingsCell(mContext); + } + TextDetailSettingsCell textCell = (TextDetailSettingsCell) view; + + if(i == headerGradientRow){ + textCell.setTag("profileHeaderGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("profileHeaderGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } + } else if(i == rowGradientRow){ + textCell.setTag("profileRowGradient"); + textCell.setMultilineDetail(false); + int value = themePrefs.getInt("profileRowGradient", 0); + if (value == 0) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false); + } else if (value == 1) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false); + } else if (value == 2) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false); + } else if (value == 3) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false); + } else if (value == 4) { + textCell.setTextAndValue(LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false); + } } } return view; @@ -533,14 +737,19 @@ public class ThemingProfileActivity extends BaseFragment { else if ( i == headerSection2Row || i == rowsSection2Row ) { return 1; } - else if ( i == nameSizeRow || i == statusSizeRow || i == avatarRadiusRow ) { + else if ( i == nameSizeRow || i == statusSizeRow || i == headerAvatarRadiusRow || i == avatarRadiusRow) { return 2; } - - else if ( i == headerColorRow || i == headerIconsColorRow || i == iconsColorRow || i == nameColorRow || i == statusColorRow || - i == rowColorRow || i == titleColorRow || i == summaryColorRow) { + else if ( i == headerColorRow || i == headerGradientColorRow || i == headerIconsColorRow || i == iconsColorRow || i == nameColorRow || i == statusColorRow || + i == rowColorRow || i == rowGradientColorRow || i == titleColorRow || i == summaryColorRow || i == onlineColorRow) { return 3; } + else if (i == rowGradientListCheckRow) { + return 4; + } + else if (i == headerGradientRow || i == rowGradientRow) { + return 5; + } else { return 2; } @@ -548,7 +757,7 @@ public class ThemingProfileActivity extends BaseFragment { @Override public int getViewTypeCount() { - return 4; + return 6; } @Override diff --git a/TMessagesProj/src/main/res/drawable-hdpi/Thumbs.db b/TMessagesProj/src/main/res/drawable-hdpi/Thumbs.db index db4f80cd..6bf1aae0 100644 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/Thumbs.db and b/TMessagesProj/src/main/res/drawable-hdpi/Thumbs.db differ diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index fd2efad0..1f86d1dc 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -842,7 +842,7 @@ %1$s الساعة %2$s تم تحديث تيليجرام نسخة الآندرويد. الجديد في نسخة 3.1.3:\n\n- قسم جديد للروابط المشاركة في معلومات المحادثة \n- استعراض لروابط الصور داخل التطبيق. - 594 + 597 بلاس مسنجر للأندرويد diff --git a/TMessagesProj/src/main/res/values-ca/strings.xml b/TMessagesProj/src/main/res/values-ca/strings.xml index eb8c039c..08d3b5b2 100644 --- a/TMessagesProj/src/main/res/values-ca/strings.xml +++ b/TMessagesProj/src/main/res/values-ca/strings.xml @@ -839,7 +839,7 @@ %1$s a les %2$s S\'ha actualitzat el Telegram per a l\'Android. Novetats a la versió 3.1.3:\n\n- Nova secció \'Enllaços compartits\' a la informació del xat\n- Previsualització, dins de l\'aplicació, per a enllaços a fotos - 594 + 597 Plus Messenger per Android @@ -886,7 +886,8 @@ Mida de l\'entrada de text Color de fons de l\'entrada de text Color de fons dels emoji - Color de la pestanya dels emoji + Color de la pestanya d\'emojis activa + Color de la icona de la pestanya d\'emojis Color de «en línia» Música Desa el tema diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index caf3cf11..08464279 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -839,10 +839,10 @@ %1$s um %2$s Plus Messenger für Android wurde aktualisiert. Neu in Version 3.1.3:\n\n- Neuer \"Geteilte Links\" Bereich in der Chat Info\n- In-App Vorschau für Links von Bildern. - 594 + 597 -\n\nNeu in Version 3.1.3.0:\n\n- Neuer MOD ändert Standard Emoji Tab Symbol Farbe\n- Fehlerbeseitigung +\n\nNeu in Version 3.1.3.3:\n\n- Option Farbverlauf in Kopf- und Listenzeile, in Chatübersicht, Chat, Kontakten, Profile und Hauptmenü\n- Hinzugefügt Option Farbverlauf in Texteingabefeld, Emoji Ansicht und einfügen Ansicht\n- MOD Wechsel \'online\' Textfarbe in Profile und Text\n- MOD Profilbildradius im Profil ändern\n- Fehlerbeseitigung Plus Messenger für Android Themen bearbeiten Ungültiger Hex-Code! @@ -982,4 +982,12 @@ Audio nicht stoppen Optionliste Trennstrich Profilbild, Name und Telefonnummer zentriert + Verlauf + Verlauf + Deaktiviert + von Oben + Links nach Rechts + von oben Links nach unten Rechts + von unten Links nach oben Rechts + Hintergrund Farbverlauf Liste oder Seite \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index 9cad4161..e68f7328 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -839,9 +839,9 @@ %1$s a las %2$s Plus Messenger para Android ha sido actualizada. Novedades en la versión 3.1.3:\n\n- Nueva sección de \'Enlaces\' en la información del chat\n- Vista previa en la app para enlaces a fotos - 594 + 597 - \n\nNovedades en 3.1.3.0:\n\n- Nuevo MOD para ajustar color por defecto de icono de pestaña de emoticonos\n- Solución de errores + "\n\nNovedades en 3.1.3.3:\n\n- Añadida opción de gradiente al color de lista y cabecera de chats, chat, contactos, menu y perfil\n- Opción de gradiente en entrada de texto, vista de emoticonos y en vista adjuntar en chat\n- MOD para ajustar color de texto \'en línea\' en perfil y en chat\n- MOD para ajustar radio de avatares en perfil\n- Solución de errores" Plus Messenger para Android Tematización ¡Color hexadecimal inválido! @@ -981,4 +981,12 @@ No parar audio Color de divisor de lista Centrar avatar, nombre y móvil + Gradiente + Color de gradiente + Desactivado + Arriba Abajo + Izquierda Derecha + Arriba-Izquierda Abajo-Derecha + Abajo-Izquierda Arriba-Derecha + Aplicar gradiente a fondo de lista \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-fr/strings.xml b/TMessagesProj/src/main/res/values-fr/strings.xml index 6c9d5268..ddf36cb5 100644 --- a/TMessagesProj/src/main/res/values-fr/strings.xml +++ b/TMessagesProj/src/main/res/values-fr/strings.xml @@ -841,7 +841,7 @@ Plus Messenger pour Android a été mis à jour. Nouveautés de la version 3.1.3:\n\n- Nouvelle section \"Liens partagés\" dans les informations de la conversation\n - Prévisualistaion In-app pour les liens des images - 594 + 597 Plus Messenger pour Android Thème diff --git a/TMessagesProj/src/main/res/values-gl/strings.xml b/TMessagesProj/src/main/res/values-gl/strings.xml index 0d5559a2..4ea9c7f2 100644 --- a/TMessagesProj/src/main/res/values-gl/strings.xml +++ b/TMessagesProj/src/main/res/values-gl/strings.xml @@ -840,7 +840,7 @@ e introduce o teu número. %1$s ás %2$s Telegram para Android foi actualizada. Novidades na versión 3.1.3:\n\n - Nova sección de \'Enlaces\' na información do chat\n - Vista previa na app para enlaces a fotos - 594 + 597 Plus Messenger para Android diff --git a/TMessagesProj/src/main/res/values-hi/strings.xml b/TMessagesProj/src/main/res/values-hi/strings.xml index 969c39ad..d9e98881 100644 --- a/TMessagesProj/src/main/res/values-hi/strings.xml +++ b/TMessagesProj/src/main/res/values-hi/strings.xml @@ -515,7 +515,7 @@ %1$s पर %2$s Plus Messenger for Android has been updated. New in Version 3.0:\n\n\n\n- Dedicated tabs for each one of your custom sticker sets in the sticker panel. Add custom stickers like https://telegram.me/addstickers/Animals\n- New bot API, free for everyone. If you\'re an engineer, create your own bots for games, services or integrations. Learn more at https://telegram.org/blog/bot-revolution\n https://play.google.com/store/apps/details?id=es.rafalense.themes - 594 + 597 Android के लिए प्लस मैसेंजर diff --git a/TMessagesProj/src/main/res/values-hr/strings.xml b/TMessagesProj/src/main/res/values-hr/strings.xml index 939ae251..ec4c4ee9 100644 --- a/TMessagesProj/src/main/res/values-hr/strings.xml +++ b/TMessagesProj/src/main/res/values-hr/strings.xml @@ -750,7 +750,7 @@ h:mm a %1$s u %2$s - 594 + 597 Plus Messenger za Android Izrada teme diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index 5193f360..9912085a 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -839,10 +839,10 @@ %1$s alle %2$s Plus Messenger per Android si è aggiornato. Nuovo nella versione 3.1.3:\n\n- Nuova sezione \"Link condivisi\" nelle info della chat\n- Anteprima in-app delle foto dei link - 594 + 597 -\n\nNovità nella versione 3.1.3.0:\n\n- Nuova MOD per cambiare il colore predefinito della icona della linguetta degli emoji\n- Correzione di Bug +\n\nNovità nella versione 3.1.3.3:\n\n- Aggiunta opzione per il colore gradiente nell\'intestazione e nelle liste di chat, contatti, profilo e menu\n- Aggiunta opzione gradiente per il campo di testo, la vista degli emoji e la vista degli allegati\n- MOD per cambiare il colore del testo \"online\" nel profilo e nella chat\n- MOD per cambiare il raggio dell\'avatar nel profilo\n- Correzioni bug Plus Messenger per Android Personalizzazione Codice del colore esadecimale non valido! @@ -887,8 +887,8 @@ Dimensione del testo immesso Colore di sfondo del campo di testo Colore di sfondo degli Emoji - Colore della linguetta dell\'Emoji selezionato - Colore icona linguetta degli Emoji + Colore della linguetta degli Emoji selezionata + Colore dell\'icona nella linguetta degli Emoji Colore dello stato Online Musica Salva il tema @@ -982,4 +982,12 @@ Non interrompere l\'audio Colore del divisore delle liste Centra l\'avatar, il nome ed il numero di telefono + Gradiente + Colore gradiente + Disattivato + Intestazione Fondo + Sinistra Destra + Intestazione-sinistra Fondo-destra + Fondo-sinistra Intestazione-destra + Applica il gradiente allo sfondo della lista \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-ko/strings.xml b/TMessagesProj/src/main/res/values-ko/strings.xml index d2d98103..7b5f0202 100644 --- a/TMessagesProj/src/main/res/values-ko/strings.xml +++ b/TMessagesProj/src/main/res/values-ko/strings.xml @@ -842,5 +842,5 @@ %1$s %2$s 텔레그램 안드로이드 버전이 업데이트 되었습니다. 새로운 버전은 3.1.3 입니다:\n\n- 채팅방 정보내 \'공유된 링크\' 추가 \n- 사진 링크 프리뷰 기능 - 594 + 597 \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index 34ac519e..2021dd43 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -839,7 +839,7 @@ %1$s om %2$s Plus Messenger voor Android is bijgewerkt. Nieuw in versie 3.1.3:\n\n- Nieuw \'Gedeelde links\'-gedeelte in chatinformatie\n- In-app voorvertoning voor links naar foto\'s - 594 + 597 Plus Messenger voor Android diff --git a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml index 1b97e56f..f56dc50a 100644 --- a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml @@ -838,11 +838,11 @@ h:mm a %1$s às %2$s - Plus Messenger para Android foi atualizado. Novidade na versão 3.1.3\n\n- Nova sessão \"Links Compartilhados\" na informação do chat\n- Pré-visualizaçãp de fotos em links no aplicativo. - 594 + Plus Messenger para Android foi atualizado. Novidade na versão 3.1.3\n\n- Nova seção \"Links Compartilhados\" na informação do chat\n- Pré-visualização de fotos em links no aplicativo. + 597 -\n\nNovo na versão 3.1.3.0:\n\n- Novo MOD para mudar a cor do ícone padrão da aba de emoji\n- Concertos de Bugs +\n\nNovo na versão 3.1.3.3:\n\n- Adicionado opção Degradê para Cabeçalho e Cor das Colunas na Lista de Chats, Chat, Contatos, Perfil e Menu de Navegação\n- Correções de erros Plus Messenger para Android Personalização Código de cor HEX inválido! @@ -886,9 +886,9 @@ Cor do Texto Digitado Tamanho do Texto Digitado Cor da Caixa de Texto - Cor do Fundo Emojis - Cor selecionada da aba de emoji - Cor do icone da aba de emoji + Cor do Fundo Emoji + Cor da Aba Emoji selecionada + Cor do Ícone da Aba Emoji Cor do Status Online Música Salvar Tema @@ -982,4 +982,12 @@ Não Parar Áudio Cor do Divisor de Lista Centralizar Avatar, Nome e Número + Degradê + Cor Degradê + Desativado + Superior Inferior + Esquerda Direita + Superior-Esquerda Inferior-Direita + Inferior-Esquerda Superior-Direita + Aplicar degradê para a lista de fundo \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml index 56df1be7..260217a3 100644 --- a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml @@ -842,7 +842,7 @@ %1$s às %2$s Plus Messenger para Android foi atualizado. Novidade na versão 3.1.3\n\n- Nova sessão \"Links Compartilhados\" na informação do chat\n- Pré-visualizaçãp de fotos em links no aplicativo. - 594 + 597 Plus Messenger para Android Temas diff --git a/TMessagesProj/src/main/res/values-ru/strings.xml b/TMessagesProj/src/main/res/values-ru/strings.xml index 70ab435c..ccaa741d 100644 --- a/TMessagesProj/src/main/res/values-ru/strings.xml +++ b/TMessagesProj/src/main/res/values-ru/strings.xml @@ -839,9 +839,9 @@ %1$s в %2$s Plus Messenger для Android обновлён. Новое в версии 3.1.3:\n\n- Новый раздел \'Общие ссылки\' в информации о части\n- Предварительный просмотр ссылок на фото в приложении - 594 - + 597 + + \n\nНовое в версии 3.1.3.3:\n\n- Добавлена опция градиента в настройки цвета заголовка и строк для списка чатов, экрана чата, контактов и меню\n- Добавлена опция градиента в настройки поля ввода текста, emoji и аттача\n- Мод для смены цвета текста \"в сети\" в профиле и чате\n- Мод для смены закругления аватара в профиле\n- Исправление ошибок Plus Messenger для Android Кастомизация Неверный hex-код цвета! @@ -886,7 +886,8 @@ Размер вводимого текста Цвет фона для ввода текста Цвет фона Emoji - Цвет вкладок Emoji + Цвет выбранной вкладки emoji + Цвет иконки на вклаке emoji Цвет статуса \"онлайн\" Музыка Сохранить тему @@ -980,4 +981,12 @@ Не останавливать аудио Цвет разделителя списка Центрировать аватар, имя и телефон + Градиент + Цвет градиента + Отключено + Сверху вних + Слева направо + Сверху налево, снизу направо + Снизу налево, сверху направо + Применить градиент к фону списка diff --git a/TMessagesProj/src/main/res/values-tr/strings.xml b/TMessagesProj/src/main/res/values-tr/strings.xml index 6c151896..4a242dc0 100644 --- a/TMessagesProj/src/main/res/values-tr/strings.xml +++ b/TMessagesProj/src/main/res/values-tr/strings.xml @@ -461,7 +461,7 @@ HH:mm Plus Messenger için temalar indirin ve uygulayın. Hergün yeni temalar ekleniyor:\n https://play.google.com/store/apps/details?id=es.rafalense.themes - 594 + 597 @@ -509,7 +509,8 @@ Yazı Giriş Boyutu Yazı Giriş Arkaplan Rengi Emoji Arkaplan Rengi - Emoji Sekme Rengi + seçilmiş surat sekme rengi + Surat simgesinin rengi Çevrimiçi Rengi Müzik Temayı Kaydet @@ -603,4 +604,12 @@ Sesi durdurma Liste ayırıcı rengi Avatarı, ismi ve telefonu ortala + Gradyan + Gradyan rengi + Devre dışı + Üst Alt + Sol sağ + Üst Sol Alt-Sağ + Alt Sol Üst Sağ + Arkaplana gradyan uygula diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings.xml index b0c88d9c..0bc8f7a5 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings.xml @@ -838,7 +838,7 @@ %1$s 的 %2$s Android 版的 Plus Messenger 已更新。最新版本 3.1 的新增功能有:\n\n- 在特定聊天中搜索消息内容。\n- 全新设计的附件选择菜单。从附件选择菜单中直接发送联系人资料或语音文件。\n- 改进的程序内媒体播放功能 (YouTube, Vimoe, Soundcloud 等), 新播放器适用于大型语音文件。\n\n更多更新请查看:\nhttps://telegram.org/blog/search-and-media - 594 + 597 Plus Messenger for Android diff --git a/TMessagesProj/src/main/res/values-zh-rTW/strings.xml b/TMessagesProj/src/main/res/values-zh-rTW/strings.xml index 8c14206f..ce5856e8 100644 --- a/TMessagesProj/src/main/res/values-zh-rTW/strings.xml +++ b/TMessagesProj/src/main/res/values-zh-rTW/strings.xml @@ -839,7 +839,7 @@ 於時間 %1$s %2$s Android 版的 Plus Messenger 已經更新。在版本 3.1.3 中的新功能:\n\n- 在聊天室資訊中新增「共享的連結」部份\n- 程式內預覽照片連結 - 594 + 597 diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 682851e4..514b43bd 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -840,9 +840,9 @@ %1$s at %2$s Plus Messenger for Android has been updated. New in version 3.1.3:\n\n- New \'Shared Links\' section in chat info\n- In-app preview for links to photos - 594 + 597 - \n\nNew in version 3.1.3.0:\n\n- New MOD to change default emoji tab icon color\n- Bug fixes + \n\nNew in version 3.1.3.3:\n\n- Added gradient option to header and list color in chats, chat, contacts, menu and profile\n- Added gradient option to text entry box, emoji view and attach view\n- MOD to change \'online\' text color in profile and chat\n- MOD to change avatars radius in profile\n- Bug fixes Plus Messenger for Android Theming Invalid color hex code! @@ -982,4 +982,12 @@ Don\'t stop audio List divider color Center avatar, name and phone + Gradient + Gradient color + Disabled + Top Bottom + Left Right + Top-Left Bottom-Right + Bottom-Left Top-Right + Apply gradient to list background \ No newline at end of file