mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Update to 6.1.0 (1941)
This commit is contained in:
parent
ed9e38da5b
commit
73e5ba43d6
5 changed files with 50 additions and 53 deletions
|
@ -286,7 +286,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 1940
|
||||
defaultConfig.versionCode = 1941
|
||||
|
||||
def tgVoipDexFileName = "libtgvoip.dex"
|
||||
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BuildVars {
|
|||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
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 int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
|
|
@ -7821,7 +7821,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@ public class ChatAttachAlertPollLayout extends ChatAttachAlert.AttachAlertLayout
|
|||
|
||||
private int topPadding;
|
||||
|
||||
private static final int MAX_QUESTION_LENGTH = 255;
|
||||
private static final int MAX_ANSWER_LENGTH = 100;
|
||||
private static final int MAX_SOLUTION_LENGTH = 200;
|
||||
public static final int MAX_QUESTION_LENGTH = 255;
|
||||
public static final int MAX_ANSWER_LENGTH = 100;
|
||||
public static final int MAX_SOLUTION_LENGTH = 200;
|
||||
|
||||
private static final int done_button = 40;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.telegram.ui.Cells.TextCell;
|
|||
import org.telegram.ui.Cells.TextCheckCell;
|
||||
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.ChatAttachAlertPollLayout;
|
||||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.EditTextBoldCursor;
|
||||
import org.telegram.ui.Components.HintView;
|
||||
|
@ -93,10 +94,6 @@ public class PollCreateActivity extends BaseFragment {
|
|||
private int settingsSectionRow;
|
||||
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;
|
||||
|
||||
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;
|
||||
} 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;
|
||||
} else {
|
||||
int count = 0;
|
||||
for (int a = 0; a < answers.length; a++) {
|
||||
if (!TextUtils.isEmpty(getFixedString(answers[a]))) {
|
||||
if (answers[a].length() > MAX_ANSWER_LENGTH) {
|
||||
if (answers[a].length() > ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH) {
|
||||
count = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -527,27 +524,26 @@ public class PollCreateActivity extends BaseFragment {
|
|||
}
|
||||
|
||||
private void setTextLeft(View cell, int index) {
|
||||
if (cell instanceof HeaderCell) {
|
||||
HeaderCell headerCell = (HeaderCell) cell;
|
||||
if (index == -1) {
|
||||
int left = MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
|
||||
if (left <= MAX_QUESTION_LENGTH - MAX_QUESTION_LENGTH * 0.7f) {
|
||||
headerCell.setText2(String.format("%d", left));
|
||||
SimpleTextView textView = headerCell.getTextView2();
|
||||
String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
|
||||
textView.setTextColor(Theme.getColor(key));
|
||||
textView.setTag(key);
|
||||
} else {
|
||||
headerCell.setText2("");
|
||||
if (!(cell instanceof PollEditTextCell)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
headerCell.setText2("");
|
||||
}
|
||||
} else if (cell instanceof PollEditTextCell) {
|
||||
if (index >= 0) {
|
||||
PollEditTextCell textCell = (PollEditTextCell) cell;
|
||||
int left = MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
|
||||
if (left <= MAX_ANSWER_LENGTH - MAX_ANSWER_LENGTH * 0.7f) {
|
||||
int max;
|
||||
int left;
|
||||
if (index == questionRow) {
|
||||
max = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH;
|
||||
left = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
|
||||
} else if (index == solutionRow) {
|
||||
max = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH;
|
||||
left = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
|
||||
} else if (index >= answerStartRow && index < answerStartRow + answersCount) {
|
||||
index -= answerStartRow;
|
||||
max = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH;
|
||||
left = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (left <= max - max * 0.7f) {
|
||||
textCell.setText2(String.format("%d", left));
|
||||
SimpleTextView textView = textCell.getTextView2();
|
||||
String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
|
||||
|
@ -557,8 +553,6 @@ public class PollCreateActivity extends BaseFragment {
|
|||
textCell.setText2("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewField() {
|
||||
answersChecks[answersCount] = false;
|
||||
|
@ -605,11 +599,13 @@ public class PollCreateActivity extends BaseFragment {
|
|||
}
|
||||
case 2: {
|
||||
TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView;
|
||||
cell.setFixedSize(0);
|
||||
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
if (position == solutionInfoRow) {
|
||||
cell.setText(LocaleController.getString("AddAnExplanationInfo", R.string.AddAnExplanationInfo));
|
||||
} else if (position == settingsSectionRow) {
|
||||
if (quizOnly != 0) {
|
||||
cell.setFixedSize(12);
|
||||
cell.setText(null);
|
||||
} else {
|
||||
cell.setText(LocaleController.getString("QuizInfo", R.string.QuizInfo));
|
||||
|
@ -651,14 +647,12 @@ public class PollCreateActivity extends BaseFragment {
|
|||
@Override
|
||||
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
|
||||
int viewType = holder.getItemViewType();
|
||||
if (viewType == 0 || viewType == 5) {
|
||||
setTextLeft(holder.itemView, holder.getAdapterPosition() == questionHeaderRow ? -1 : 0);
|
||||
}
|
||||
if (viewType == 4) {
|
||||
PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
|
||||
textCell.setTag(1);
|
||||
textCell.setTextAndHint(questionString != null ? questionString : "", LocaleController.getString("QuestionHint", R.string.QuestionHint), false);
|
||||
textCell.setTag(null);
|
||||
setTextLeft(holder.itemView, holder.getAdapterPosition());
|
||||
} else if (viewType == 5) {
|
||||
int position = holder.getAdapterPosition();
|
||||
PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
|
||||
|
@ -672,12 +666,13 @@ public class PollCreateActivity extends BaseFragment {
|
|||
AndroidUtilities.showKeyboard(editText);
|
||||
requestFieldFocusAtPosition = -1;
|
||||
}
|
||||
setTextLeft(holder.itemView, position - answerStartRow);
|
||||
setTextLeft(holder.itemView, position);
|
||||
} else if (viewType == 7) {
|
||||
PollEditTextCell textCell = (PollEditTextCell) holder.itemView;
|
||||
textCell.setTag(1);
|
||||
textCell.setTextAndHint(solutionString != null ? solutionString : "", LocaleController.getString("AddAnExplanation", R.string.AddAnExplanation), false);
|
||||
textCell.setTag(null);
|
||||
setTextLeft(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -704,7 +699,7 @@ public class PollCreateActivity extends BaseFragment {
|
|||
View view;
|
||||
switch (viewType) {
|
||||
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));
|
||||
break;
|
||||
case 1:
|
||||
|
@ -719,6 +714,7 @@ public class PollCreateActivity extends BaseFragment {
|
|||
break;
|
||||
case 4: {
|
||||
PollEditTextCell cell = new PollEditTextCell(mContext, null);
|
||||
cell.createErrorTextView();
|
||||
cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||
cell.addTextWatcher(new TextWatcher() {
|
||||
@Override
|
||||
|
@ -737,9 +733,9 @@ public class PollCreateActivity extends BaseFragment {
|
|||
return;
|
||||
}
|
||||
questionString = s.toString();
|
||||
RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionHeaderRow);
|
||||
RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionRow);
|
||||
if (holder != null) {
|
||||
setTextLeft(holder.itemView, -1);
|
||||
setTextLeft(holder.itemView, questionRow);
|
||||
}
|
||||
checkDoneButton();
|
||||
}
|
||||
|
@ -753,6 +749,7 @@ public class PollCreateActivity extends BaseFragment {
|
|||
break;
|
||||
case 7: {
|
||||
PollEditTextCell cell = new PollEditTextCell(mContext, null);
|
||||
cell.createErrorTextView();
|
||||
cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||
cell.addTextWatcher(new TextWatcher() {
|
||||
@Override
|
||||
|
@ -771,10 +768,10 @@ public class PollCreateActivity extends BaseFragment {
|
|||
return;
|
||||
}
|
||||
solutionString = s.toString();
|
||||
/*RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(questionHeaderRow);
|
||||
RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(solutionRow);
|
||||
if (holder != null) {
|
||||
setTextLeft(holder.itemView, -1);
|
||||
}*/
|
||||
setTextLeft(holder.itemView, solutionRow);
|
||||
}
|
||||
checkDoneButton();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue