GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix:设置代理容错 · magic-coder/AndroidHttpCapture@7639967

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app
    • build.gradle
    • src/main
      • AndroidManifest.xml
      • java/cn/darkal/networkdiagnosis
        • Fragment
          • WebViewFragment.java
        • Utils
          • ProxyUtils.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
applicationId "cn.darkal.networkdiagnosis"
2626
minSdkVersion 14
2727
targetSdkVersion 22
28-
versionCode 24
29-
versionName "2.4.24"
28+
versionCode 25
29+
versionName "2.4.25"
3030
// Enabling multidex support.
3131
multiDexEnabled true
3232
resConfigs "zh"
Collapse file

‎app/src/main/AndroidManifest.xml‎

Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
android:largeHeap="true"
2626
android:theme="@style/AppTheme">
2727

28+
<!-- 配置APP渠道号 -->
29+
<meta-data
30+
android:name="BUGLY_APP_CHANNEL"
31+
android:value="Github" />
32+
2833
<activity
2934
android:name="cn.darkal.networkdiagnosis.Activity.MainActivity"
3035
android:configChanges="orientation|keyboardHidden"
Collapse file

‎app/src/main/java/cn/darkal/networkdiagnosis/Fragment/WebViewFragment.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/cn/darkal/networkdiagnosis/Fragment/WebViewFragment.java
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import android.widget.EditText;
3333
import android.widget.ProgressBar;
3434
import android.widget.TextView;
35+
import android.widget.Toast;
3536

3637
import butterknife.BindView;
3738
import butterknife.ButterKnife;
@@ -254,6 +255,8 @@ public void run() {
254255
Log.e("~~~~", "initProxyWebView()");
255256
webView.loadUrl(urlText.getText() + "");
256257
isSetProxy = true;
258+
}else{
259+
Toast.makeText(webView.getContext(),"Set proxy fail!",Toast.LENGTH_LONG).show();
257260
}
258261
}
259262
});
Collapse file

‎app/src/main/java/cn/darkal/networkdiagnosis/Utils/ProxyUtils.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/cn/darkal/networkdiagnosis/Utils/ProxyUtils.java
+2-35Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -267,40 +267,6 @@ private static boolean setProxyKK(WebView webView, String host, int port, String
267267

268268
@TargetApi(Build.VERSION_CODES.KITKAT)
269269
private static boolean setProxyLollipop(final Context context, String host, int port) {
270-
// Log.i(LOG_TAG, "setProxyLollipop");
271-
// if (null == host) {
272-
// System.clearProperty("http.proxyHost");
273-
// System.clearProperty("http.proxyPort");
274-
// } else {
275-
// System.setProperty("http.proxyHost", host);
276-
// System.setProperty("http.proxyPort", port + "");
277-
// }
278-
// try {
279-
// Context appContext = context.getApplicationContext();
280-
// Class applicationClass = Class.forName("android.app.Application");
281-
// Field mLoadedApkField = applicationClass.getDeclaredField("mLoadedApk");
282-
// mLoadedApkField.setAccessible(true);
283-
// Object mloadedApk = mLoadedApkField.get(appContext);
284-
// Class loadedApkClass = Class.forName("android.app.LoadedApk");
285-
// Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers");
286-
// mReceiversField.setAccessible(true);
287-
// Map receivers = (Map) mReceiversField.get(mloadedApk);
288-
// for (Object receiverMap : receivers.values()) {
289-
// for (Object receiver : ((Map) receiverMap).keySet()) {
290-
// Class clazz = receiver.getClass();
291-
// if (clazz.getName().contains("ProxyChangeListener")) {
292-
// Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class);
293-
// Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
294-
// onReceiveMethod.invoke(receiver, appContext, intent);
295-
// }
296-
// }
297-
// }
298-
// Log.i(LOG_TAG, "Lollipop successfully");
299-
// return true;
300-
// } catch (Exception e) {
301-
// e.printStackTrace();
302-
// }
303-
304270
System.setProperty("http.proxyHost", host);
305271
System.setProperty("http.proxyPort", port + "");
306272
System.setProperty("https.proxyHost", host);
@@ -327,9 +293,10 @@ private static boolean setProxyLollipop(final Context context, String host, int
327293
}
328294
} catch (Exception e) {
329295
e.printStackTrace();
296+
return false;
330297
}
331298

332-
return false;
299+
return true;
333300
}
334301

335302
private static Object getFieldValueSafely(Field field, Object classInstance) throws IllegalArgumentException, IllegalAccessException {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.