Compare commits
10 changed files with 117 additions and 106 deletions
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -13,7 +13,7 @@
|
|||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 13
|
||||
versionName "1.0.5"
|
||||
versionName "1.0.7"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package net.typeblog.socks;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.VpnService;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
|
@ -8,6 +10,13 @@ public class MainActivity extends Activity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Prepare the VPN connection (this will request permission if needed)
|
||||
Intent prepareIntent = VpnService.prepare(this);
|
||||
if (prepareIntent != null) {
|
||||
// Permission not yet granted, start the activity to request it
|
||||
startActivityForResult(prepareIntent, 0);
|
||||
}
|
||||
|
||||
this.getFragmentManager().beginTransaction().replace(android.R.id.content, new ProfileFragment()).commit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class SocksVpnService extends VpnService {
|
|||
new Intent(this, MainActivity.class), intentFlags);
|
||||
startForeground(NOTIFICATION_ID, builder
|
||||
.setContentTitle(getString(R.string.notify_title))
|
||||
.setContentText(String.format(getString(R.string.notify_msg), name))
|
||||
.setContentText(String.format( getString(R.string.notify_msg), name))
|
||||
.setPriority(Notification.PRIORITY_MIN)
|
||||
.setSmallIcon(R.drawable.ic_vpn)
|
||||
.setContentIntent(contentIntent)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public boolean isPerApp() {
|
||||
return mPref.getBoolean(key("perapp"), false);
|
||||
return mPref.getBoolean(key("perapp"), true);
|
||||
}
|
||||
|
||||
public void setIsPerApp(boolean is) {
|
||||
|
|
@ -92,7 +92,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public boolean isBypassApp() {
|
||||
return mPref.getBoolean(key("appbypass"), false);
|
||||
return mPref.getBoolean(key("appbypass"), true);
|
||||
}
|
||||
|
||||
public void setIsBypassApp(boolean is) {
|
||||
|
|
@ -100,7 +100,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public String getAppList() {
|
||||
return mPref.getString(key("applist"), "");
|
||||
return mPref.getString(key("applist"), "com.termux");
|
||||
}
|
||||
|
||||
public void setAppList(String list) {
|
||||
|
|
@ -116,7 +116,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public boolean hasUDP() {
|
||||
return mPref.getBoolean(key("udp"), false);
|
||||
return mPref.getBoolean(key("udp"), true);
|
||||
}
|
||||
|
||||
public void setHasUDP(boolean has) {
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable/ic_gitlab.png
Normal file
BIN
app/src/main/res/drawable/ic_gitlab.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/drawable/ic_termux.png
Normal file
BIN
app/src/main/res/drawable/ic_termux.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
|
|
@ -2,9 +2,10 @@
|
|||
<resources>
|
||||
<string name="src">Xem mã nguồn</string>
|
||||
<string name="open_termux">Mở Termux</string>
|
||||
<string name="advancedsettings">Cài đặt nâng cao</string>
|
||||
<string name="advancedsettings_summary">IP máy chủ, Xác thực, Cổng, IPv6, v.v...</string>
|
||||
<string name="open_termux_summary">Termux có thể cần thiết trong 1 số mục đích cụ thể, ví dụ như sử dụng internet miễn phí.</string>
|
||||
<string name="src_title">Xem mã nguồn dự án trên GitLab</string>
|
||||
<string name="notice">Để sử dụng, hãy bật tất cả 3 tùy chọn dưới, và thêm com.termux vào danh sách ứng dụng nhé !</string>
|
||||
<string name="adv_app_bypass">Chế độ bỏ qua</string>
|
||||
<string name="adv_app_bypass_sum">Bật tùy chọn này để bỏ qua các ứng dụng đã chọn thay vì ủy quyền chúng</string>
|
||||
<string name="adv_app_list">Danh sách ứng dụng</string>
|
||||
|
|
@ -41,5 +42,7 @@
|
|||
<string name="udp_gw">Cổng UDP (Từ xa)</string>
|
||||
<string name="udp_proxy">Chuyển tiếp UDP</string>
|
||||
<string name="udp_proxy_sum">Chuyển tiếp gói UDP tới badvpn-udpgw qua SOCKS5. Điều này cần badvpn-udpgw chạy trên máy chủ từ xa (thường listen trên 127.0.0.1) để hoạt động.</string>
|
||||
|
||||
<string name="appinfo_category">Thông tin ứng dụng</string>
|
||||
<string name="appversion">Phiên bản ứng dụng</string>
|
||||
<string name="compiletime">Thời gian biên dịch</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -2,14 +2,17 @@
|
|||
<resources>
|
||||
|
||||
<string name="app_name">SocksDroid</string>
|
||||
<string name="advancedsettings">Advanced Settings</string>
|
||||
<string name="advancedsettings_summary">Server IP, Authentication, Ports, IPv6, etc...</string>
|
||||
<string name="open_termux">Open Termux</string>
|
||||
<string name="open_termux_summary">This might be needed for some purpose, such as getting free internet.</string>
|
||||
<string name="notice">In order to use, enable all available option below, and add com.termux to App List !</string>
|
||||
<string name="src">View source code</string>
|
||||
<string name="src_title">View project source code on GitLab</string>
|
||||
<string name="profile">Profile</string>
|
||||
<string name="prof_default">Default</string>
|
||||
|
||||
<string name="appinfo_category">App info</string>
|
||||
<string name="appversion">App version</string>
|
||||
<string name="compiletime">Compile time</string>
|
||||
<string name="connection">Connection</string>
|
||||
<string name="server_ip">Server IP</string>
|
||||
<string name="server_port">Server Port</string>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<Preference
|
||||
android:icon="@drawable/ic_gitlab"
|
||||
android:title="@string/src"
|
||||
android:summary="@string/src_title">
|
||||
<intent
|
||||
|
|
@ -10,116 +11,111 @@
|
|||
<PreferenceCategory
|
||||
android:selectable="false"
|
||||
android:title="@string/connection">
|
||||
<Preference
|
||||
android:summary="@string/notice"/>
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/ic_termux"
|
||||
android:title="@string/open_termux"
|
||||
android:summary="@string/open_termux_summary">
|
||||
<intent
|
||||
android:targetPackage="com.termux"
|
||||
android:targetClass="com.termux.HomeActivity" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="udp_proxy"
|
||||
android:title="@string/udp_proxy"
|
||||
android:summary="@string/udp_proxy_sum"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="adv_per_app"
|
||||
android:title="@string/adv_per_app"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:defaultValue="true"
|
||||
android:key="adv_app_bypass"
|
||||
android:title="@string/adv_app_bypass"
|
||||
android:summary="@string/adv_app_bypass_sum"
|
||||
android:dependency="adv_per_app"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:key="adv_app_list"
|
||||
android:title="@string/adv_app_list"
|
||||
android:summary="@string/adv_app_list_sum"
|
||||
android:dependency="adv_per_app"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/advanced">
|
||||
<EditTextPreference
|
||||
android:key="adv_dns"
|
||||
android:title="@string/adv_dns"
|
||||
android:singleLine="true"/>
|
||||
<ListPreference
|
||||
android:enabled="false"
|
||||
android:key="profile"
|
||||
android:title="@string/profile"/>
|
||||
<CheckBoxPreference
|
||||
android:enabled="false"
|
||||
android:key="auth_userpw"
|
||||
android:title="@string/auth_userpw"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:key="auth_username"
|
||||
android:title="@string/auth_username"
|
||||
android:dependency="auth_userpw"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:key="auth_password"
|
||||
android:title="@string/auth_password"
|
||||
android:inputType="textPassword"
|
||||
android:dependency="auth_userpw"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:enabled="false"
|
||||
android:key="server_ip"
|
||||
android:title="@string/server_ip"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:enabled="false"
|
||||
android:key="server_port"
|
||||
android:title="@string/server_port"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="false"
|
||||
android:key="ipv6_proxy"
|
||||
android:title="@string/ipv6_proxy"
|
||||
android:summary="@string/ipv6_proxy_sum"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:enabled="false"
|
||||
android:key="udp_gw"
|
||||
android:title="@string/udp_gw"
|
||||
android:singleLine="true"
|
||||
android:dependency="udp_proxy"/>
|
||||
|
||||
<ListPreference
|
||||
android:enabled="false"
|
||||
android:key="adv_route"
|
||||
android:title="@string/adv_route"
|
||||
android:entries="@array/adv_routes"
|
||||
android:entryValues="@array/adv_routes_values"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:enabled="false"
|
||||
android:key="adv_dns_port"
|
||||
android:title="@string/adv_dns_port"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:enabled="false"
|
||||
android:key="adv_auto_connect"
|
||||
android:title="@string/adv_auto_connect"/>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/advancedsettings"
|
||||
android:summary="@string/advancedsettings_summary">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="udp_proxy"
|
||||
android:title="@string/udp_proxy"
|
||||
android:summary="@string/udp_proxy_sum"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="adv_per_app"
|
||||
android:title="@string/adv_per_app"/>
|
||||
<CheckBoxPreference
|
||||
android:enabled="true"
|
||||
android:defaultValue="true"
|
||||
android:key="adv_app_bypass"
|
||||
android:title="@string/adv_app_bypass"
|
||||
android:summary="@string/adv_app_bypass_sum"
|
||||
android:dependency="adv_per_app"/>
|
||||
<EditTextPreference
|
||||
android:key="adv_dns"
|
||||
android:title="@string/adv_dns"
|
||||
android:singleLine="true"/>
|
||||
<ListPreference
|
||||
android:key="profile"
|
||||
android:title="@string/profile"/>
|
||||
<CheckBoxPreference
|
||||
android:key="auth_userpw"
|
||||
android:title="@string/auth_userpw"
|
||||
android:defaultValue="false"/>
|
||||
<EditTextPreference
|
||||
android:key="auth_username"
|
||||
android:title="@string/auth_username"
|
||||
android:dependency="auth_userpw"
|
||||
android:singleLine="true"/>
|
||||
<EditTextPreference
|
||||
android:key="auth_password"
|
||||
android:title="@string/auth_password"
|
||||
android:inputType="textPassword"
|
||||
android:dependency="auth_userpw"
|
||||
android:singleLine="true"/>
|
||||
<EditTextPreference
|
||||
android:key="server_ip"
|
||||
android:title="@string/server_ip"
|
||||
android:singleLine="true"/>
|
||||
<EditTextPreference
|
||||
android:key="server_port"
|
||||
android:title="@string/server_port"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"/>
|
||||
<CheckBoxPreference
|
||||
android:key="ipv6_proxy"
|
||||
android:title="@string/ipv6_proxy"
|
||||
android:summary="@string/ipv6_proxy_sum"/>
|
||||
<EditTextPreference
|
||||
android:key="udp_gw"
|
||||
android:title="@string/udp_gw"
|
||||
android:singleLine="true"
|
||||
android:dependency="udp_proxy"/>
|
||||
<ListPreference
|
||||
android:key="adv_route"
|
||||
android:title="@string/adv_route"
|
||||
android:entries="@array/adv_routes"
|
||||
android:entryValues="@array/adv_routes_values"/>
|
||||
<EditTextPreference
|
||||
android:key="adv_dns_port"
|
||||
android:title="@string/adv_dns_port"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"/>
|
||||
<CheckBoxPreference
|
||||
android:key="adv_auto_connect"
|
||||
android:title="@string/adv_auto_connect"/>
|
||||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/appinfo_category">
|
||||
<Preference
|
||||
android:title="@string/appversion"
|
||||
android:summary="1.0.7" />
|
||||
<Preference
|
||||
android:title="@string/compiletime"
|
||||
android:summary="YYYY-MM-DD" />
|
||||
<Preference
|
||||
android:title="Commit"
|
||||
android:summary="">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://gitlab.com/cuynu/socksdroid/-/commits/main/?ref_type=HEADS" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
|
|||
Loading…
Reference in a new issue