pull/21/head
fengyuecanzhu 3 years ago
parent 6a10102b7a
commit e52aeb1c15
  1. 1
      app/src/main/java/xyz/fycz/myreader/model/third3/http/HttpHelper.kt
  2. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java
  3. 6
      app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java
  4. 12
      app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt

@ -72,7 +72,6 @@ val globalProxy: String
fun getProxyClient(proxy0: String? = null, noProxy: Boolean = false): OkHttpClient { fun getProxyClient(proxy0: String? = null, noProxy: Boolean = false): OkHttpClient {
var proxy = proxy0 var proxy = proxy0
if (proxy.isNullOrEmpty()) proxy = globalProxy if (proxy.isNullOrEmpty()) proxy = globalProxy
Log.d("getProxyClient", "proxy=$proxy")
if (proxy.isNullOrBlank() || noProxy) { if (proxy.isNullOrBlank() || noProxy) {
return okHttpClient return okHttpClient
} }

@ -206,7 +206,7 @@ public class MoreSettingActivity extends BaseActivity<ActivityMoreSettingBinding
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
if (curFragment == null || curFragment != mProxyFragment) { if (curFragment == null || curFragment == mProxyFragment) {
menu.findItem(R.id.action_tip).setVisible(false); menu.findItem(R.id.action_tip).setVisible(false);
} else { } else {
menu.findItem(R.id.action_tip).setVisible(true); menu.findItem(R.id.action_tip).setVisible(true);

@ -140,7 +140,6 @@ public class MyAlertDialog {
.show(); .show();
} }
Button posBtn = inputDia.getButton(AlertDialog.BUTTON_POSITIVE); Button posBtn = inputDia.getButton(AlertDialog.BUTTON_POSITIVE);
posBtn.setEnabled(false);
editText.addTextChangedListener(new TextWatcher() { editText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -155,11 +154,6 @@ public class MyAlertDialog {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
String text = editText.getText().toString(); String text = editText.getText().toString();
if (editText.getText().length() > 0 && editText.getText().length() <= maxLen && !text.equals(initText)) {
posBtn.setEnabled(true);
} else {
posBtn.setEnabled(false);
}
oic.onChange(text); oic.onChange(text);
} }
}); });

@ -46,7 +46,6 @@ class ProxyFragment : BaseFragment() {
override fun initData(savedInstanceState: Bundle?) { override fun initData(savedInstanceState: Bundle?) {
enableProxy = SharedPreUtils.getInstance().getBoolean("enableProxy") enableProxy = SharedPreUtils.getInstance().getBoolean("enableProxy")
Log.d("ProxyFragment", "enableProxy=$enableProxy")
proxyType = SharedPreUtils.getInstance().getInt("proxyType") proxyType = SharedPreUtils.getInstance().getInt("proxyType")
proxyHost = SharedPreUtils.getInstance().getString("proxyHost") proxyHost = SharedPreUtils.getInstance().getString("proxyHost")
proxyPort = SharedPreUtils.getInstance().getString("proxyPort") proxyPort = SharedPreUtils.getInstance().getString("proxyPort")
@ -69,7 +68,6 @@ class ProxyFragment : BaseFragment() {
enableProxy = !enableProxy enableProxy = !enableProxy
binding.scEnableProxy.isChecked = enableProxy binding.scEnableProxy.isChecked = enableProxy
SharedPreUtils.getInstance().putBoolean("enableProxy", enableProxy) SharedPreUtils.getInstance().putBoolean("enableProxy", enableProxy)
Log.d("ProxyFragment", "putBoolean=$enableProxy")
binding.llContent.visibility = if (enableProxy) View.VISIBLE else View.GONE binding.llContent.visibility = if (enableProxy) View.VISIBLE else View.GONE
} }
@ -79,7 +77,7 @@ class ProxyFragment : BaseFragment() {
.setOnMenuItemClickListener { _: BottomMenu?, _: CharSequence?, which: Int -> .setOnMenuItemClickListener { _: BottomMenu?, _: CharSequence?, which: Int ->
proxyType = which proxyType = which
SharedPreUtils.getInstance().putInt("proxyType", which) SharedPreUtils.getInstance().putInt("proxyType", which)
binding.tvProxyType.text = proxyTypeArr[which] initWidget(null)
false false
}.setCancelButton(R.string.cancel) }.setCancelButton(R.string.cancel)
} }
@ -91,8 +89,8 @@ class ProxyFragment : BaseFragment() {
{ text: String -> tem = text } { text: String -> tem = text }
) { dialog: DialogInterface, _: Int -> ) { dialog: DialogInterface, _: Int ->
proxyHost = tem proxyHost = tem
binding.tvProxyHost.text = proxyHost
SharedPreUtils.getInstance().putString("proxyHost", proxyHost) SharedPreUtils.getInstance().putString("proxyHost", proxyHost)
initWidget(null)
dialog.dismiss() dialog.dismiss()
} }
} }
@ -110,7 +108,7 @@ class ProxyFragment : BaseFragment() {
.setPositiveButton(R.string.confirm) { _: DialogInterface?, _: Int -> .setPositiveButton(R.string.confirm) { _: DialogInterface?, _: Int ->
proxyPort = threadPick.value.toString() proxyPort = threadPick.value.toString()
SharedPreUtils.getInstance().putString("proxyPort", proxyPort) SharedPreUtils.getInstance().putString("proxyPort", proxyPort)
binding.tvProxyPort.text = proxyPort initWidget(null)
}.setNegativeButton(R.string.cancel, null) }.setNegativeButton(R.string.cancel, null)
.show() .show()
} }
@ -122,8 +120,8 @@ class ProxyFragment : BaseFragment() {
{ text: String -> tem = text } { text: String -> tem = text }
) { dialog: DialogInterface, _: Int -> ) { dialog: DialogInterface, _: Int ->
proxyUsername = tem proxyUsername = tem
binding.tvProxyUsername.text = proxyUsername
SharedPreUtils.getInstance().putString("proxyUsername", proxyUsername) SharedPreUtils.getInstance().putString("proxyUsername", proxyUsername)
initWidget(null)
dialog.dismiss() dialog.dismiss()
} }
} }
@ -135,8 +133,8 @@ class ProxyFragment : BaseFragment() {
{ text: String -> tem = text } { text: String -> tem = text }
) { dialog: DialogInterface, _: Int -> ) { dialog: DialogInterface, _: Int ->
proxyPassword = tem proxyPassword = tem
binding.tvProxyPassword.text = proxyPassword
SharedPreUtils.getInstance().putString("proxyPassword", proxyPassword) SharedPreUtils.getInstance().putString("proxyPassword", proxyPassword)
initWidget(null)
dialog.dismiss() dialog.dismiss()
} }
} }

Loading…
Cancel
Save