fix: merged 9.2.2

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
This commit is contained in:
Next Alone 2022-12-11 09:54:51 +08:00
parent 4196484d20
commit e543a78c90
No known key found for this signature in database
GPG Key ID: DBA7B0AEF8C1CD2C
14 changed files with 35 additions and 88 deletions

View File

@ -237,20 +237,7 @@ public final class QRCodeWriter {
return bitmap;
}
private boolean has(int x, int y) {
if (x >= imageBlockX && x < imageBlockX + imageBloks && y >= imageBlockX && y < imageBlockX + imageBloks) {
return false;
}
if ((x < sideQuadSize || x >= input.getWidth() - sideQuadSize) && y < sideQuadSize) {
return false;
}
if (x < sideQuadSize && y >= input.getHeight() - sideQuadSize) {
return false;
}
return x >= 0 && y >= 0 && x < input.getWidth() && y < input.getHeight() && input.get(x, y) == 1;
}
public Bitmap encode(String contents, int width, int height, Map<EncodeHintType, ?> hints, Bitmap bitmap) throws WriterException {
return encode(contents, width, height, hints, bitmap, 1.0f, 0xffffffff, 0xff000000);
}

View File

@ -10495,7 +10495,7 @@ public class MessagesController extends BaseController implements NotificationCe
putUsers(res.users, false);
putChats(res.chats, false);
getMessagesStorage().putUsersAndChats(res.users, res.chats, false, true);
createChat(title, selectedContacts, about, type, forImport, location, locationAddress, fragment);
createChat(title, selectedContacts, about, type, forImport, location, locationAddress, ttlPeriod, fragment);
} else {
AndroidUtilities.runOnUIThread(() -> {
AlertsCreator.processError(currentAccount, error, fragment, req);

View File

@ -3062,11 +3062,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
am.abandonAudioFocus(this);
}
try {
am.unregisterMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class));
} catch (Exception e) {
FileLog.e(e);
}
am.unregisterMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class));
if (hasAudioFocus) {
am.abandonAudioFocus(this);
}

View File

@ -22,6 +22,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import android.text.TextUtils;
import android.transition.ChangeBounds;
import android.transition.Fade;
import android.transition.TransitionManager;
@ -36,6 +37,7 @@ import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.DefaultItemAnimator;
@ -425,7 +427,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
itemInners.add(new ItemInner(VIEW_TYPE_INFO, "database", null));
// resetDateRow = itemInners.size();
// itemInners.add(new ItemInner());
// fixme merge 9.2.2
// fixme merge 9.2.2
if (loadingDialogs) {
itemInners.add(new ItemInner(VIEW_TYPE_HEADER, LocaleController.getString("DataUsageByChats", R.string.DataUsageByChats), 15, 4, null));
itemInners.add(new ItemInner(VIEW_FLICKER_LOADING_DIALOG, null, null));
@ -1164,9 +1166,10 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
}
slideChooseView.setOptions(index, LocaleController.formatPluralString("Days", 1), LocaleController.formatPluralString("Days", 3), LocaleController.formatPluralString("Weeks", 1), LocaleController.formatPluralString("Months", 1), LocaleController.getString("KeepMediaForever", R.string.KeepMediaForever));
break;
case 5:
view = new ShadowSectionCell(mContext);
break;
// fixme merge 9.2.2
// case 5:
// view = new ShadowSectionCell(mContext);
// break;
case VIEW_TYPE_CHAT:
UserCell userCell = new UserCell(getContext(), getResourceProvider());
userCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));

View File

@ -97,7 +97,7 @@ public class SharedLinkCell extends FrameLayout {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
if (pressedLinkIndex >= 0) {
delegate.onLinkPress(links.get(pressedLink).toString(), true);
delegate.onLinkPress(links.get(pressedLinkIndex).toString(), true);
}
MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0);
onTouchEvent(event);

View File

@ -18674,6 +18674,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (id == NotificationCenter.dialogsUnreadCounterChanged) {
if (actionBar != null) { // NekoX
actionBar.unreadBadgeSetCount(getMessagesStorage().getMainUnreadCount());
}
}
}
}

View File

@ -21,6 +21,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.collection.LongSparseArray;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

View File

@ -459,7 +459,7 @@ public class BackButtonMenu {
cell.addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 59, 0, 12, 0));
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setSmallSize(true);
avatarDrawable.setScaleSize(.8f);
Drawable thumb = avatarDrawable;
if (chat != null) {
avatarDrawable.setInfo(chat);

View File

@ -46,20 +46,14 @@ public class ColoredImageSpan extends ReplacementSpan {
public ColoredImageSpan(Drawable drawable, int verticalAlignment) {
this.drawable = drawable;
this.usePaintColor = true;
if (drawable != null) {
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.setColorFilter(new PorterDuffColorFilter(drawableColor, PorterDuff.Mode.SRC_IN));
}
this.verticalAlignment = verticalAlignment;
}
public ColoredImageSpan(@NonNull Drawable drawable, int drawableColor) {
this.drawable = drawable;
this.drawableColor = drawableColor;
this.usePaintColor = true;
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.setColorFilter(new PorterDuffColorFilter(drawableColor, PorterDuff.Mode.SRC_IN));
}
public void setSize(int size) {
this.size = size;
drawable.setBounds(0, 0, size, size);

View File

@ -28,20 +28,28 @@ import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.Utilities;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.LanguageCell;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.LanguageCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextRadioCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EmptyTextProgressView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RecyclerListView;
@ -73,7 +81,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
private ArrayList<LocaleController.LocaleInfo> unofficialLanguages;
private ActionBarMenuItem searchItem;
private int translateSettingsBackgroundHeight;
@Override
public boolean onFragmentCreate() {
@ -159,32 +166,11 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
emptyView.setShowAtCenter(true);
frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView = new RecyclerListView(context) {
@Override
protected void dispatchDraw(Canvas canvas) {
if (getAdapter() == listAdapter && getItemAnimator() != null && getItemAnimator().isRunning()) {
int backgroundColor = Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider);
drawItemBackground(canvas, 0, translateSettingsBackgroundHeight, backgroundColor);
// drawItemBackground(canvas, 1, Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider));
drawSectionBackground(canvas, 1, 2, backgroundColor);
}
super.dispatchDraw(canvas);
}
};
listView = new RecyclerListView(context);
listView.setEmptyView(emptyView);
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setVerticalScrollBarEnabled(false);
listView.setAdapter(listAdapter);
DefaultItemAnimator itemAnimator = new DefaultItemAnimator() {
@Override
protected void onMoveAnimationUpdate(RecyclerView.ViewHolder holder) {
listView.invalidate();
listView.updateSelector();
}
};
itemAnimator.setDurations(400);
itemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
listView.setItemAnimator(itemAnimator);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setOnItemClickListener((view, position) -> {
@ -200,7 +186,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}).show();
return;
}
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, currentAccount);
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, currentAccount, () -> {});
parentLayout.rebuildAllFragmentViews(false, false);
}
finishFragment();
@ -359,22 +345,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}
}
private void updateLanguage() {
if (actionBar != null) {
actionBar.setTitleAnimated(LocaleController.getString("Language", R.string.Language), true, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
}
if (listView != null) {
for (int i = 0; i < listView.getChildCount(); ++i) {
View child = listView.getChildAt(i);
if (child instanceof TranslateSettings || child instanceof HeaderCell) {
listAdapter.notifyItemChanged(listView.getChildAdapterPosition(child));
} else {
listAdapter.onBindViewHolder(listView.getChildViewHolder(child), listView.getChildAdapterPosition(child));
}
}
}
}
private void processSearch(final String query) {
Utilities.searchQueue.postRunnable(() -> {
@ -522,8 +492,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (holder.getItemViewType()) {
case 0: {
if (!search)
position -= 2;
LanguageCell textSettingsCell = (LanguageCell) holder.itemView;
// TextRadioCell textSettingsCell = (TextRadioCell) holder.itemView;
LocaleController.LocaleInfo localeInfo;
boolean last;

View File

@ -1387,11 +1387,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
daddrLong = chatLocation.geo_point._long;
}
String domain;
if (BuildVars.isHuaweiStoreApp()) {
domain = "mapapp://navigation";
} else {
domain = "http://maps.google.com/maps";
}
domain = "http://maps.google.com/maps";
if (myLocation != null) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Locale.US, domain + "?saddr=%f,%f&daddr=%f,%f", myLocation.getLatitude(), myLocation.getLongitude(), daddrLat, daddrLong)));

View File

@ -508,7 +508,7 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
// bottomSheet.setParentFragment(PremiumPreviewFragment.this);
// showDialog(bottomSheet);
// } else {
showDialog(new PremiumFeatureBottomSheet(PremiumPreviewFragment.this, cell.data.type, false, subscriptionTiers.get(selectedTierIndex)));
// showDialog(new PremiumFeatureBottomSheet(PremiumPreviewFragment.this, cell.data.type, false, subscriptionTiers.get(selectedTierIndex)));
// }
}
});
@ -1145,7 +1145,6 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
}
premiumButtonView.setFlickerDisabled(false);
}
}
@Override
public boolean isLightStatusBar() {
@ -1316,6 +1315,7 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
});
}
// NekoX: remove Google Billing SubscriptionTier
public final static class SubscriptionTier {
public final TLRPC.TL_premiumSubscriptionOption subscriptionOption;

View File

@ -1093,7 +1093,7 @@ public class UsersSelectActivity extends BaseFragment implements NotificationCen
continue;
}
spansContainer.addSpan(span, true);
span.setOnClickListener(FilterUsersActivity.this);
span.setOnClickListener(UsersSelectActivity.this);
}
}
}

View File

@ -121,7 +121,7 @@ public abstract class BaseNekoSettingsActivity extends BaseFragment {
}
@Override
protected ActionBar createActionBar(Context context) {
public ActionBar createActionBar(Context context) {
ActionBar actionBar;
if (!hasWhiteActionBar()) {
actionBar = super.createActionBar(context);