Minor fixes

This commit is contained in:
世界 2021-01-01 12:53:45 +08:00
parent 448f3ca7e4
commit fbed805f73
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
7 changed files with 26 additions and 61 deletions

View File

@ -1,8 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
def verName = "7.3.1-rc04"
def verCode = 138
def verName = "7.3.1-rc05"
def verCode = 140
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -4073,8 +4073,6 @@ public class Theme {
new int[]{0, 180, 45, 0, 45, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
new int[]{0, 52, 46, 57, 45, 64, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0}
);
} else {
}
themes.add(currentDayTheme = currentTheme = defaultTheme = themeInfo);
themesDict.put("Blue", themeInfo);
@ -4572,9 +4570,9 @@ public class Theme {
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int eventType = -1;
if (NekoConfig.eventType == 1 || (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) {
if (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1) {
eventType = 0;
} else if (NekoConfig.eventType == 2 || (monthOfYear == 1 && dayOfMonth == 14)) {
} else if (monthOfYear == 1 && dayOfMonth == 14) {
eventType = 1;
} else if (monthOfYear == 9 && dayOfMonth >= 30 || monthOfYear == 10 && dayOfMonth == 1 && hour < 12) {
eventType = 2;
@ -4585,22 +4583,16 @@ public class Theme {
public static Drawable getCurrentHolidayDrawable() {
if ((System.currentTimeMillis() - lastHolidayCheckTime) >= 60 * 1000) {
lastHolidayCheckTime = System.currentTimeMillis();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
int monthOfYear = calendar.get(Calendar.MONTH);
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
int minutes = calendar.get(Calendar.MINUTE);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
if (NekoConfig.actionBarDecoration > 0 || (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0)) {
if (getEventType() == 0 || NekoConfig.actionBarDecoration == 1) {
canStartHolidayAnimation = true;
} else {
canStartHolidayAnimation = false;
}
if (dialogs_holidayDrawable == null) {
if (NekoConfig.newYear || (monthOfYear == 11 && dayOfMonth >= (BuildVars.DEBUG_PRIVATE_VERSION ? 29 : 31) && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) {
if (getEventType() == 0 || NekoConfig.newYear) {
dialogs_holidayDrawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.newyear);
dialogs_holidayDrawableOffsetX = -AndroidUtilities.dp(3);
dialogs_holidayDrawableOffsetY = +AndroidUtilities.dp(1);
dialogs_holidayDrawableOffsetY = -AndroidUtilities.dp(1);
}
}
}

View File

@ -109,7 +109,7 @@ public class DrawerProfileCell extends FrameLayout {
addView(arrowView, LayoutHelper.createFrame(59, 59, Gravity.RIGHT | Gravity.BOTTOM));
setArrowState(false);
if (Theme.getEventType() == 0 || NekoConfig.eventType == 1) {
if (Theme.getEventType() == 0 || NekoConfig.actionBarDecoration == 1) {
snowflakesEffect = new SnowflakesEffect();
snowflakesEffect.setColorKey(Theme.key_chats_menuName);
}

View File

@ -245,6 +245,7 @@ import tw.nekomimi.nekogram.MessageDetailsActivity;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.parts.MessageTransKt;
import tw.nekomimi.nekogram.parts.PollTransUpdatesKt;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.PGPUtil;
@ -13890,7 +13891,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean isVoted = object.isVoted();
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) object.messageOwner.media;
if (poll != null) {
object.messageOwner.translated = false;
if (object.messageOwner.translated) {
PollTransUpdatesKt.postPollTrans(media, poll);
}
media.poll = poll;
isQuiz = poll.quiz;
} else if (media.poll != null) {

View File

@ -415,14 +415,6 @@ public class NekoConfig {
editor.apply();
}
public static void setEventType(int type) {
eventType = type;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("eventType", eventType);
editor.apply();
}
public static void setActionBarDecoration(int decoration) {
actionBarDecoration = decoration;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);

View File

@ -0,0 +1,10 @@
package tw.nekomimi.nekogram.parts
import org.telegram.tgnet.TLRPC
fun postPollTrans(media: TLRPC.TL_messageMediaPoll, poll: TLRPC.TL_poll) {
poll.translatedQuestion = media.poll.translatedQuestion
poll.answers.forEach { answer ->
answer.translatedText = media.poll.answers.find { it.text == answer.text }!!.translatedText
}
}

View File

@ -105,7 +105,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
private int forceTabletRow;
private int avatarAsDrawerBackgroundRow;
private int removeTitleEmojiRow;
private int eventTypeRow;
private int newYearRow;
private int actionBarDecorationRow;
private int appBarShadowRow;
@ -266,22 +265,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
builder.show();
} else if (position == eventTypeRow) {
PopupBuilder builder = new PopupBuilder(view);
builder.setItems(new String[]{
LocaleController.getString("DependsOnDate", R.string.DependsOnDate),
LocaleController.getString("Christmas", R.string.Christmas),
LocaleController.getString("Valentine", R.string.Valentine)
}, (i, __) -> {
NekoConfig.setEventType(i);
listAdapter.notifyItemChanged(position);
return Unit.INSTANCE;
});
builder.show();
} else if (position == actionBarDecorationRow) {
PopupBuilder builder = new PopupBuilder(view);
@ -387,6 +370,8 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
NekoConfig.setGoogleTranslateKey(key);
listAdapter.notifyItemChanged(position);
return Unit.INSTANCE;
});
@ -709,7 +694,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
avatarAsDrawerBackgroundRow = rowCount++;
appBarShadowRow = rowCount++;
removeTitleEmojiRow = rowCount++;
eventTypeRow = rowCount++;
newYearRow = rowCount++;
actionBarDecorationRow = rowCount++;
appearance2Row = rowCount++;
@ -813,20 +797,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
break;
}
textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, true);
} else if (position == eventTypeRow) {
String value;
switch (NekoConfig.eventType) {
case 1:
value = LocaleController.getString("Christmas", R.string.Christmas);
break;
case 2:
value = LocaleController.getString("Valentine", R.string.Valentine);
break;
case 0:
default:
value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate);
}
textCell.setTextAndValue(LocaleController.getString("EventType", R.string.EventType), value, true);
} else if (position == actionBarDecorationRow) {
String value;
switch (NekoConfig.actionBarDecoration) {
@ -876,7 +846,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
case 6: {
TextDetailSettingsCell textCell = (TextDetailSettingsCell) holder.itemView;
if (position == googleCloudTranslateKeyRow) {
textCell.setTextAndValue(LocaleController.getString("GoogleCloudTransKey", R.string.GoogleCloudTransKey), StrUtil.isNotBlank(NekoConfig.googleCloudTranslateKey) ? NekoConfig.googleCloudTranslateKey : LocaleController.getString("GoogleCloudTransKeyNotice", R.string.GoogleCloudTransKeyNotice), false);
textCell.setTextAndValue(LocaleController.getString("GoogleCloudTransKey", R.string.GoogleCloudTransKey), StrUtil.isNotBlank(NekoConfig.googleCloudTranslateKey) ? NekoConfig.googleCloudTranslateKey : LocaleController.getString("CacheEmpty", R.string.CacheEmpty), false);
}
}
break;
@ -925,8 +895,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("AskBeforeCalling", R.string.AskBeforeCalling), NekoConfig.askBeforeCall, true);
} else if (position == disableNumberRoundingRow) {
textCell.setTextAndValueAndCheck(LocaleController.getString("DisableNumberRounding", R.string.DisableNumberRounding), "4.8K -> 4777", NekoConfig.disableNumberRounding, true, true);
} else if (position == appBarShadowRow) {
textCell.setTextAndCheck(LocaleController.getString("DisableAppBarShadow", R.string.DisableAppBarShadow), NekoConfig.disableAppBarShadow, eventTypeRow != -1);
} else if (position == usePersianCalenderRow) {
} else if (position == autoPauseVideoRow) {
textCell.setTextAndValueAndCheck(LocaleController.getString("AutoPauseVideo", R.string.AutoPauseVideo), LocaleController.getString("AutoPauseVideoAbout", R.string.AutoPauseVideoAbout), NekoConfig.autoPauseVideo, true, true);
@ -1004,7 +972,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
position == general2Row || position == appearance2Row || position == openKeyChain2Row) {
return 1;
} else if (position == nameOrderRow || position == sortMenuRow || position == translateToLangRow || position == translateInputToLangRow ||
position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow ||
position == translationProviderRow || position == actionBarDecorationRow ||
position == pgpAppRow || position == keyRow) {
return 2;
} else if (position == connectionRow || position == transRow || position == dialogsRow ||