This commit is contained in:
世界 2020-10-13 14:53:22 +00:00
parent df19b1b865
commit cc1209b617
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
7 changed files with 177 additions and 137 deletions

View File

@ -5,8 +5,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def verName = "7.1.3-rc03"
def verCode = 78
def verName = "7.1.3-preview04"
def verCode = 79
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -355,6 +355,7 @@ add_library(webp STATIC
libwebp/src/dsp/cost.c
libwebp/src/dsp/cost_mips32.c
libwebp/src/dsp/cost_mips_dsp_r2.c
libwebp/src/dsp/cost_neon.c
libwebp/src/dsp/cost_sse2.c
libwebp/src/dsp/enc.c
libwebp/src/dsp/enc_mips32.c

@ -1 +1 @@
Subproject commit e85d3313d6d52b1e9c6c181b488fc0831a747de8
Subproject commit d7844e9762b61c9638c263657bd49e1690184832

View File

@ -2327,32 +2327,48 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (position == addMemberRow) {
openAddMember();
} else if (position == usernameRow) {
if (currentChat != null) {
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle("@" + currentChat.username);
if (chatInfo != null && chatInfo.can_set_username) {
builder.addItem(LocaleController.getString("Edit", R.string.Edit), R.drawable.baseline_edit_24, __ -> {
ChatEditTypeActivity fragment = new ChatEditTypeActivity(chat_id, chatInfo.can_set_location);
fragment.setInfo(chatInfo);
presentFragment(fragment);
return Unit.INSTANCE;
});
final String username;
if (user_id != 0) {
final TLRPC.User user = getMessagesController().getUser(user_id);
if (user == null || user.username == null) {
return;
}
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert("@" + currentChat.username);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink), R.drawable.baseline_link_24, __ -> {
AlertUtil.copyAndAlert("https://t.me/" + currentChat.username);
return Unit.INSTANCE;
});
builder.show();
username = user.username;
} else if (chat_id != 0) {
final TLRPC.Chat chat = getMessagesController().getChat(chat_id);
if (chat == null || chat.username == null) {
return;
}
username = chat.username;
} else {
return;
}
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle("@" + username);
if (chatInfo != null && chatInfo.can_set_username) {
builder.addItem(LocaleController.getString("Edit", R.string.Edit), R.drawable.baseline_edit_24, __ -> {
ChatEditTypeActivity fragment = new ChatEditTypeActivity(chat_id, chatInfo.can_set_location);
fragment.setInfo(chatInfo);
presentFragment(fragment);
return Unit.INSTANCE;
});
}
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert("@" + username);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink), R.drawable.baseline_link_24, __ -> {
AlertUtil.copyAndAlert("https://t.me/" + username);
return Unit.INSTANCE;
});
builder.show();
} else if (position == locationRow) {
if (chatInfo.location instanceof TLRPC.TL_channelLocation) {
LocationActivity fragment = new LocationActivity(LocationActivity.LOCATION_TYPE_GROUP_VIEW);
@ -2465,6 +2481,30 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (userInfo != null) {
presentFragment(new ChangeBioActivity());
}
} else if (position == channelInfoRow || position == userInfoRow || position == locationRow) {
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
try {
String about;
if (position == locationRow) {
about = chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation ? ((TLRPC.TL_channelLocation) chatInfo.location).address : null;
} else if (position == channelInfoRow) {
about = chatInfo != null ? chatInfo.about : null;
} else {
about = userInfo != null ? userInfo.about : null;
}
if (!TextUtils.isEmpty(about)) {
AlertUtil.copyAndAlert(about);
}
} catch (Exception e) {
FileLog.e(e);
}
return Unit.INSTANCE;
});
builder.show();
} else if (position == numberRow) {
TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser();
@ -2508,6 +2548,43 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
showDialog(builder.create());
} else if (position == phoneRow) {
final TLRPC.User user = getMessagesController().getUser(user_id);
if (user == null || user.phone == null || user.phone.length() == 0 || getParentActivity() == null
|| (NekoConfig.hidePhone && user.id == UserConfig.getInstance(currentAccount).getClientUserId())) {
return;
}
String number = PhoneFormat.getInstance().format("+" + user.phone);
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle(number);
builder.addItem(LocaleController.getString("Call", R.string.Call), R.drawable.baseline_call_24, __ -> {
AlertUtil.call(user.phone);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(number);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("ShareContact", R.string.ShareContact), R.drawable.baseline_forward_24, __ -> {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putString("selectAlertString", LocaleController.getString("SendContactToText", R.string.SendContactToText));
args.putString("selectAlertStringGroup", LocaleController.getString("SendContactToGroupText", R.string.SendContactToGroupText));
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ProfileActivity.this);
presentFragment(fragment);
return Unit.INSTANCE;
});
showDialog(builder.create());
} else if (position == setAvatarRow) {
} else if (position == versionRow) {
TextInfoPrivacyCell cell = (TextInfoPrivacyCell) view;
@ -2543,12 +2620,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return Unit.INSTANCE;
});
}
if (BuildConfig.BUILD_TYPE.startsWith("release")) {
builder.addItem(LocaleController.getString("SwitchVersion", R.string.SwitchVersion), R.drawable.baseline_replay_24, (it) -> {
Browser.openUrl(ProfileActivity.this.getParentActivity(), "https://github.com/NekoX-Dev/NekoX/releases");
return Unit.INSTANCE;
});
}
builder.addItem(LocaleController.getString("SwitchVersion", R.string.SwitchVersion), R.drawable.baseline_replay_24, (it) -> {
Browser.openUrl(ProfileActivity.this.getParentActivity(), "https://github.com/NekoX-Dev/NekoX/releases");
return Unit.INSTANCE;
});
if (NekoXConfig.developerModeEntrance || NekoXConfig.developerMode) {
builder.addItem(LocaleController.getString("DeveloperSettings", R.string.DeveloperSettings), R.drawable.baseline_developer_mode_24, (it) -> {
BottomBuilder devBuilder = new BottomBuilder(ProfileActivity.this.getParentActivity());
@ -3422,99 +3498,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
private boolean processOnClickOrPress(final int position) {
if (position == usernameRow) {
final String username;
if (user_id != 0) {
final TLRPC.User user = getMessagesController().getUser(user_id);
if (user == null || user.username == null) {
return false;
}
username = user.username;
} else if (chat_id != 0) {
final TLRPC.Chat chat = getMessagesController().getChat(chat_id);
if (chat == null || chat.username == null) {
return false;
}
username = chat.username;
} else {
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
if (i == 0) {
try {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData.newPlainText("label", "@" + username);
clipboard.setPrimaryClip(clip);
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
}
});
showDialog(builder.create());
return true;
} else if (position == phoneRow) {
final TLRPC.User user = getMessagesController().getUser(user_id);
if (user == null || user.phone == null || user.phone.length() == 0 || getParentActivity() == null
|| (NekoConfig.hidePhone && user.id == UserConfig.getInstance(currentAccount).getClientUserId())) {
return false;
}
String number = PhoneFormat.getInstance().format("+" + user.phone);
// NekoX: move long lick actions to click
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle(number);
builder.addItem(LocaleController.getString("Call", R.string.Call), R.drawable.baseline_call_24, __ -> {
AlertUtil.call(user.phone);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(number);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("ShareContact", R.string.ShareContact), R.drawable.baseline_forward_24, __ -> {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putString("selectAlertString", LocaleController.getString("SendContactToText", R.string.SendContactToText));
args.putString("selectAlertStringGroup", LocaleController.getString("SendContactToGroupText", R.string.SendContactToGroupText));
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ProfileActivity.this);
presentFragment(fragment);
return Unit.INSTANCE;
});
showDialog(builder.create());
return true;
} else if (position == channelInfoRow || position == userInfoRow || position == locationRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
try {
String about;
if (position == locationRow) {
about = chatInfo != null && chatInfo.location instanceof TLRPC.TL_channelLocation ? ((TLRPC.TL_channelLocation) chatInfo.location).address : null;
} else if (position == channelInfoRow) {
about = chatInfo != null ? chatInfo.about : null;
} else {
about = userInfo != null ? userInfo.about : null;
}
if (TextUtils.isEmpty(about)) {
return;
}
AndroidUtilities.addToClipboard(about);
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
});
showDialog(builder.create());
return true;
}
return false;
}
@ -4940,6 +4926,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
privacyRow = -1;
dataRow = -1;
chatRow = -1;
stickersRow = -1;
filtersRow = -1;
devicesRow = -1;
devicesSectionRow = -1;
@ -5013,7 +5000,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
dataRow = rowCount++;
privacyRow = rowCount++;
chatRow = rowCount++;
stickersRow = rowCount++;
filtersRow = rowCount++;
nekoRow = rowCount++;
languageRow = rowCount++;
@ -5478,20 +5464,33 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
if (id != 0) {
int finalId = id;
idTextView.setOnLongClickListener(v -> {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
if (i == 0) {
try {
AndroidUtilities.addToClipboard(String.valueOf(finalId));
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
}
idTextView.setOnClickListener(v -> {
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle(finalId + "");
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(finalId + "");
return Unit.INSTANCE;
});
showDialog(builder.create());
return false;
if (finalId == user_id) {
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink), R.drawable.baseline_link_24, __ -> {
AlertUtil.copyLinkAndAlert("tg://user?id=" + finalId);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink) + " (Android)", R.drawable.baseline_link_24, __ -> {
AlertUtil.copyLinkAndAlert("tg://openmessage?user_id=" + finalId);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink) + " (IOS)", R.drawable.baseline_link_24, __ -> {
AlertUtil.copyLinkAndAlert("https://t.me/@id" + finalId);
return Unit.INSTANCE;
});
} else {
builder.addItem(LocaleController.getString("CopyLink", R.string.CopyLink) + " (Android)", R.drawable.baseline_link_24, __ -> {
AlertUtil.copyLinkAndAlert("tg://openmessage?chat_id=" + finalId);
return Unit.INSTANCE;
});
}
builder.show();
});
}
}

View File

@ -30,6 +30,15 @@ object AlertUtil {
}
@JvmStatic
fun copyLinkAndAlert(text: String) {
AndroidUtilities.addToClipboard(text)
AlertUtil.showToast(LocaleController.getString("LinkCopied", R.string.LinkCopied))
}
@JvmStatic
fun call(number: String) {

View File

@ -14,4 +14,5 @@ rm -rf build/release &&
mkdir -p build/release &&
find TMessagesProj/build/outputs/apk -name "*.apk" -exec cp {} build/release \; &&
rm -f build/release/*-debug.apk &&
rm -f build/release/*fullPlay*.apk &&
ghr -delete -n "$1" "$1" build/release

30
bin/update_libwebp.kts Normal file
View File

@ -0,0 +1,30 @@
import java.io.File
import kotlin.system.exitProcess
val projectRoot = File("..")
val webpSources = File(projectRoot, "TMessagesProj/jni/libwebp/Android.mk")
.readLines()
.map { it.trim() }
.filter { it.startsWith("src/") && it.endsWith("\\") }
.map { "libwebp/" + it.substring(0, it.length - 2).replace("\$(NEON)", "c") }
val cmakeLists = File(projectRoot, "TMessagesProj/jni/CMakeLists.txt")
var cmakeListsSource = cmakeLists.readText()
val cmakeListsSourceNew = cmakeListsSource.substringBefore("add_library(webp STATIC") + "add_library(webp STATIC" +
webpSources.joinToString("\n", "\n") { " $it" } + ")" +
cmakeListsSource.substringAfter("add_library(webp STATIC").substringAfter(")")
if (cmakeListsSource == cmakeListsSourceNew) {
println("No changes")
exitProcess(0)
}
cmakeLists.writeText(cmakeListsSourceNew)
println("Updated sources")