Update to 6.1.0 (1941)

This commit is contained in:
DrKLO 2020-04-24 13:30:21 +03:00
parent ed9e38da5b
commit 73e5ba43d6
5 changed files with 50 additions and 53 deletions

View file

@ -286,7 +286,7 @@ android {
} }
} }
defaultConfig.versionCode = 1940 defaultConfig.versionCode = 1941
def tgVoipDexFileName = "libtgvoip.dex" def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"] def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false; public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1940; public static int BUILD_VERSION = 1941;
public static String BUILD_VERSION_STRING = "6.1.0"; public static String BUILD_VERSION_STRING = "6.1.0";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -7821,7 +7821,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
maxUnreadDate = Math.max(maxUnreadDate, messageObject.messageOwner.date); maxUnreadDate = Math.max(maxUnreadDate, messageObject.messageOwner.date);
} }
if (messageObject.type == MessageObject.TYPE_POLL) { if (messageObject.type == MessageObject.TYPE_POLL && messageObject.getId() > 0) {
pollsToCheck.add(messageObject); pollsToCheck.add(messageObject);
} }
} }

View file

@ -94,9 +94,9 @@ public class ChatAttachAlertPollLayout extends ChatAttachAlert.AttachAlertLayout
private int topPadding; private int topPadding;
private static final int MAX_QUESTION_LENGTH = 255; public static final int MAX_QUESTION_LENGTH = 255;
private static final int MAX_ANSWER_LENGTH = 100; public static final int MAX_ANSWER_LENGTH = 100;
private static final int MAX_SOLUTION_LENGTH = 200; public static final int MAX_SOLUTION_LENGTH = 200;
private static final int done_button = 40; private static final int done_button = 40;

View file

@ -38,6 +38,7 @@ import org.telegram.ui.Cells.TextCell;
import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Components.AlertsCreator; import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.ChatAttachAlertPollLayout;
import org.telegram.ui.Components.CombinedDrawable; import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.EditTextBoldCursor; import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.HintView; import org.telegram.ui.Components.HintView;
@ -93,10 +94,6 @@ public class PollCreateActivity extends BaseFragment {
private int settingsSectionRow; private int settingsSectionRow;
private int rowCount; private int rowCount;
private static final int MAX_QUESTION_LENGTH = 255;
private static final int MAX_ANSWER_LENGTH = 100;
private static final int MAX_SOLUTION_LENGTH = 255;
private static final int done_button = 1; private static final int done_button = 1;
public interface PollCreateActivityDelegate { public interface PollCreateActivityDelegate {
@ -428,15 +425,15 @@ public class PollCreateActivity extends BaseFragment {
} }
} }
} }
if (!TextUtils.isEmpty(getFixedString(solutionString)) && solutionString.length() > MAX_SOLUTION_LENGTH) { if (!TextUtils.isEmpty(getFixedString(solutionString)) && solutionString.length() > ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH) {
enabled = false; enabled = false;
} else if (TextUtils.isEmpty(getFixedString(questionString)) || questionString.length() > MAX_QUESTION_LENGTH) { } else if (TextUtils.isEmpty(getFixedString(questionString)) || questionString.length() > ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH) {
enabled = false; enabled = false;
} else { } else {
int count = 0; int count = 0;
for (int a = 0; a < answers.length; a++) { for (int a = 0; a < answers.length; a++) {
if (!TextUtils.isEmpty(getFixedString(answers[a]))) { if (!TextUtils.isEmpty(getFixedString(answers[a]))) {
if (answers[a].length() > MAX_ANSWER_LENGTH) { if (answers[a].length() > ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH) {
count = 0; count = 0;
break; break;
} }
@ -527,36 +524,33 @@ public class PollCreateActivity extends BaseFragment {
} }
private void setTextLeft(View cell, int index) { private void setTextLeft(View cell, int index) {
if (cell instanceof HeaderCell) { if (!(cell instanceof PollEditTextCell)) {
HeaderCell headerCell = (HeaderCell) cell; return;
if (index == -1) { }
int left = MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0); PollEditTextCell textCell = (PollEditTextCell) cell;
if (left <= MAX_QUESTION_LENGTH - MAX_QUESTION_LENGTH * 0.7f) { int max;
headerCell.setText2(String.format("%d", left)); int left;
SimpleTextView textView = headerCell.getTextView2(); if (index == questionRow) {
String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3; max = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH;
textView.setTextColor(Theme.getColor(key)); left = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
textView.setTag(key); } else if (index == solutionRow) {
} else { max = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH;
headerCell.setText2(""); left = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
} } else if (index >= answerStartRow && index < answerStartRow + answersCount) {
} else { index -= answerStartRow;
headerCell.setText2(""); max = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH;
} left = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
} else if (cell instanceof PollEditTextCell) { } else {
if (index >= 0) { return;
PollEditTextCell textCell = (PollEditTextCell) cell; }
int left = MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0); if (left <= max - max * 0.7f) {
if (left <= MAX_ANSWER_LENGTH - MAX_ANSWER_LENGTH * 0.7f) { textCell.setText2(String.format("%d", left));
textCell.setText2(String.format("%d", left)); SimpleTextView textView = textCell.getTextView2();
SimpleTextView textView = textCell.getTextView2(); String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3; textView.setTextColor(Theme.getColor(key));
textView.setTextColor(Theme.getColor(key)); textView.setTag(key);
textView.setTag(key); } else {
} else { textCell.setText2("");
textCell.setText2("");
}
}
} }
} }
@ -605,11 +599,13 @@ public class PollCreateActivity extends BaseFragment {
} }
case 2: { case 2: {
TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView;
cell.setFixedSize(0);
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
if (position == solutionInfoRow) { if (position == solutionInfoRow) {
cell.setText(LocaleController.getString("AddAnExplanationInfo", R.string.AddAnExplanationInfo)); cell.setText(LocaleController.getString("AddAnExplanationInfo", R.string.AddAnExplanationInfo));
} else if (position == settingsSectionRow) { } else if (position == settingsSectionRow) {
if (quizOnly != 0) { if (quizOnly != 0) {
cell.setFixedSize(12);
cell.setText(null); cell.setText(null);
} else { } else {
cell.setText(LocaleController.getString("QuizInfo", R.string.QuizInfo)); cell.setText(LocaleController.getString("QuizInfo", R.string.QuizInfo));
@ -651,14 +647,12 @@ public class PollCreateActivity extends BaseFragment {
@Override @Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
int viewType = holder.getItemViewType(); int viewType = holder.getItemViewType();
if (viewType == 0 || viewType == 5) {
setTextLeft(holder.itemView, holder.getAdapterPosition() == questionHeaderRow ? -1 : 0);
}
if (viewType == 4) { if (viewType == 4) {
PollEditTextCell textCell = (PollEditTextCell) holder.itemView; PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
textCell.setTag(1); textCell.setTag(1);
textCell.setTextAndHint(questionString != null ? questionString : "", LocaleController.getString("QuestionHint", R.string.QuestionHint), false); textCell.setTextAndHint(questionString != null ? questionString : "", LocaleController.getString("QuestionHint", R.string.QuestionHint), false);
textCell.setTag(null); textCell.setTag(null);
setTextLeft(holder.itemView, holder.getAdapterPosition());
} else if (viewType == 5) { } else if (viewType == 5) {
int position = holder.getAdapterPosition(); int position = holder.getAdapterPosition();
PollEditTextCell textCell = (PollEditTextCell) holder.itemView; PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
@ -672,12 +666,13 @@ public class PollCreateActivity extends BaseFragment {
AndroidUtilities.showKeyboard(editText); AndroidUtilities.showKeyboard(editText);
requestFieldFocusAtPosition = -1; requestFieldFocusAtPosition = -1;
} }
setTextLeft(holder.itemView, position - answerStartRow); setTextLeft(holder.itemView, position);
} else if (viewType == 7) { } else if (viewType == 7) {
PollEditTextCell textCell = (PollEditTextCell) holder.itemView; PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
textCell.setTag(1); textCell.setTag(1);
textCell.setTextAndHint(solutionString != null ? solutionString : "", LocaleController.getString("AddAnExplanation", R.string.AddAnExplanation), false); textCell.setTextAndHint(solutionString != null ? solutionString : "", LocaleController.getString("AddAnExplanation", R.string.AddAnExplanation), false);
textCell.setTag(null); textCell.setTag(null);
setTextLeft(holder.itemView, holder.getAdapterPosition());
} }
} }
@ -704,7 +699,7 @@ public class PollCreateActivity extends BaseFragment {
View view; View view;
switch (viewType) { switch (viewType) {
case 0: case 0:
view = new HeaderCell(mContext, Theme.key_windowBackgroundWhiteBlueHeader, 21, 15, true); view = new HeaderCell(mContext, Theme.key_windowBackgroundWhiteBlueHeader, 21, 15, false);
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
break; break;
case 1: case 1:
@ -719,6 +714,7 @@ public class PollCreateActivity extends BaseFragment {
break; break;
case 4: { case 4: {
PollEditTextCell cell = new PollEditTextCell(mContext, null); PollEditTextCell cell = new PollEditTextCell(mContext, null);
cell.createErrorTextView();
cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
cell.addTextWatcher(new TextWatcher() { cell.addTextWatcher(new TextWatcher() {
@Override @Override
@ -737,9 +733,9 @@ public class PollCreateActivity extends BaseFragment {
return; return;
} }
questionString = s.toString(); questionString = s.toString();
RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionHeaderRow); RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionRow);
if (holder != null) { if (holder != null) {
setTextLeft(holder.itemView, -1); setTextLeft(holder.itemView, questionRow);
} }
checkDoneButton(); checkDoneButton();
} }
@ -753,6 +749,7 @@ public class PollCreateActivity extends BaseFragment {
break; break;
case 7: { case 7: {
PollEditTextCell cell = new PollEditTextCell(mContext, null); PollEditTextCell cell = new PollEditTextCell(mContext, null);
cell.createErrorTextView();
cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
cell.addTextWatcher(new TextWatcher() { cell.addTextWatcher(new TextWatcher() {
@Override @Override
@ -771,10 +768,10 @@ public class PollCreateActivity extends BaseFragment {
return; return;
} }
solutionString = s.toString(); solutionString = s.toString();
/*RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionHeaderRow); RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(solutionRow);
if (holder != null) { if (holder != null) {
setTextLeft(holder.itemView, -1); setTextLeft(holder.itemView, solutionRow);
}*/ }
checkDoneButton(); checkDoneButton();
} }
}); });