Skip to content

Commit

Permalink
feat: can only save proxy when use url
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Aug 15, 2024
1 parent f3b2ae5 commit 4dc909b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4385,6 +4385,22 @@ protected void onDetachedFromWindow() {
}
dismissRunnable.run();
});

pickerBottomLayout.middleButtonTextView.setText(LocaleController.getString("Save", R.string.Save).toUpperCase());
pickerBottomLayout.middleButton.setVisibility(View.VISIBLE);
pickerBottomLayout.middleButton.setOnClickListener((it) -> {
int p = Utilities.parseInt(port);
SharedConfig.ProxyInfo info;
if (TextUtils.isEmpty(secret)) {
info = new SharedConfig.ProxyInfo(address, p, user, password, "");
} else {
info = new SharedConfig.ProxyInfo(address, p, "", "", secret);
}
SharedConfig.addProxy(info);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
dismissRunnable.run();
});

builder.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public PickerBottomLayout(Context context, boolean darkTheme, Theme.ResourcesPro

middleButton = new LinearLayout(context);
middleButton.setOrientation(LinearLayout.HORIZONTAL);
middleButton.setBackgroundDrawable(Theme.createSelectorDrawable(0x0f000000, 0));
middleButton.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_picker_enabledButton, resourcesProvider) & 0x0fffffff, 0));
middleButton.setPadding(AndroidUtilities.dp(33), 0, AndroidUtilities.dp(33), 0);
middleButton.setVisibility(GONE);
rightLayout.addView(middleButton);

middleButtonTextView = new TextView(context);
middleButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
middleButtonTextView.setTextColor(Theme.getColor(Theme.key_picker_enabledButton));
middleButtonTextView.setTextColor(Theme.getColor(Theme.key_picker_enabledButton, resourcesProvider));
middleButtonTextView.setGravity(Gravity.CENTER);
middleButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
middleButtonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
Expand Down

0 comments on commit 4dc909b

Please sign in to comment.