Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6577c46a31 | ||
|
|
c6dab001b2 | ||
|
|
c105d84b35 | ||
|
|
3ea04c076c | ||
|
|
98475460bf | ||
|
|
68ee61a753 | ||
|
|
90ba9ef2b7 | ||
|
|
0ec114322e |
@@ -2,6 +2,16 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.v2ray.ang">
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
@@ -69,36 +69,28 @@ class V2RayVpnService : VpnService() {
|
||||
*
|
||||
* Source: https://android.googlesource.com/platform/frameworks/base/+/2df4c7d/services/core/java/com/android/server/ConnectivityService.java#887
|
||||
*/
|
||||
private val defaultNetworkRequest by lazy {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
NetworkRequest.Builder()
|
||||
private val defaultNetworkRequest by lazy @RequiresApi(Build.VERSION_CODES.P) {
|
||||
NetworkRequest.Builder()
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
|
||||
.build()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val connectivity by lazy { getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager }
|
||||
|
||||
private val defaultNetworkCallback by lazy {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
object : ConnectivityManager.NetworkCallback() {
|
||||
override fun onAvailable(network: Network) {
|
||||
setUnderlyingNetworks(arrayOf(network))
|
||||
}
|
||||
override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities?) {
|
||||
// it's a good idea to refresh capabilities
|
||||
setUnderlyingNetworks(arrayOf(network))
|
||||
}
|
||||
override fun onLost(network: Network) {
|
||||
setUnderlyingNetworks(null)
|
||||
}
|
||||
private val defaultNetworkCallback by lazy @RequiresApi(Build.VERSION_CODES.P) {
|
||||
object : ConnectivityManager.NetworkCallback() {
|
||||
override fun onAvailable(network: Network) {
|
||||
setUnderlyingNetworks(arrayOf(network))
|
||||
}
|
||||
override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities?) {
|
||||
// it's a good idea to refresh capabilities
|
||||
setUnderlyingNetworks(arrayOf(network))
|
||||
}
|
||||
override fun onLost(network: Network) {
|
||||
setUnderlyingNetworks(null)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
private var listeningForDefaultNetwork = false
|
||||
|
||||
10
V2rayNG/app/src/main/res/drawable/background_test_button.xml
Normal file
10
V2rayNG/app/src/main/res/drawable/background_test_button.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@color/secondary_text" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@color/secondary_text" />
|
||||
<item android:state_hovered="true"
|
||||
android:drawable="@color/secondary_text" />
|
||||
<item android:drawable="@color/colorPrimary_text" />
|
||||
</selector>
|
||||
@@ -54,8 +54,10 @@
|
||||
android:id="@+id/layout_test"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/connection_test_height"
|
||||
android:background="@color/colorPrimary_text"
|
||||
android:gravity="center|left">
|
||||
android:background="@drawable/background_test_button"
|
||||
android:gravity="center|left"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_test_state"
|
||||
@@ -92,6 +94,8 @@
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@drawable/ic_v_idle"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_anchorGravity="bottom|right|end" />
|
||||
|
||||
</com.github.jorgecastilloprz.FABProgressCircle>
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
@@ -40,6 +43,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingEnd="6dp"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
card_view:cardCornerRadius="5dp">
|
||||
|
||||
<LinearLayout
|
||||
@@ -21,7 +17,11 @@
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:nextFocusRight="@+id/layout_share">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -111,10 +111,14 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_share"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="@dimen/layout_margin_right_height">
|
||||
android:padding="@dimen/layout_margin_spacing"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:nextFocusLeft="@+id/info_container">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -126,10 +130,13 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="@dimen/layout_margin_right_height">
|
||||
android:padding="@dimen/layout_margin_spacing"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/png_height"
|
||||
@@ -141,10 +148,13 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_remove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="@dimen/layout_margin_right_height">
|
||||
android:padding="@dimen/layout_margin_spacing"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/png_height"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/item_cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
@@ -13,7 +14,8 @@
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
card_view:cardCornerRadius="5dp">
|
||||
card_view:cardCornerRadius="5dp"
|
||||
android:nextFocusRight="@+id/layout_edit">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/info_container"
|
||||
@@ -62,11 +64,14 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_share"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="@dimen/layout_margin_right_height"
|
||||
android:visibility="invisible">
|
||||
android:padding="@dimen/layout_margin_spacing"
|
||||
android:visibility="invisible"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/png_height"
|
||||
@@ -78,10 +83,14 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/server_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="@dimen/layout_margin_right_height">
|
||||
android:padding="@dimen/layout_margin_spacing"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:nextFocusLeft="@+id/item_cardview">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/png_height"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<string name="toast_services_failure">啟動服務失敗</string>
|
||||
|
||||
<!--ServerActivity-->
|
||||
<string name="title_server">組態</string>
|
||||
<string name="title_server">設定檔</string>
|
||||
<string name="menu_item_add_config">新增組態</string>
|
||||
<string name="menu_item_save_config">儲存組態</string>
|
||||
<string name="menu_item_del_config">刪除組態</string>
|
||||
@@ -57,7 +57,7 @@
|
||||
<string name="title_file_chooser">選取一個設定檔</string>
|
||||
<string name="toast_require_file_manager">請安裝檔案總管。</string>
|
||||
<string name="server_customize_config">自訂組態</string>
|
||||
<string name="toast_config_file_invalid">無效組態</string>
|
||||
<string name="toast_config_file_invalid">無效設定檔</string>
|
||||
<string name="server_lab_content">內容</string>
|
||||
<string name="toast_none_data_clipboard">剪貼簿內無資料</string>
|
||||
<string name="toast_invalid_url">網址無效</string>
|
||||
@@ -104,17 +104,17 @@
|
||||
<string name="summary_pref_donate">向開發人員捐款</string>
|
||||
<string name="donate_detail">新增一些實驗性進階功能</string>
|
||||
|
||||
<string name="title_pref_remote_dns">遠端DNS (可选)</string>
|
||||
<string name="title_pref_remote_dns">遠端DNS (可選)</string>
|
||||
<string name="summary_pref_remote_dns">DNS</string>
|
||||
|
||||
<string name="title_pref_domestic_dns">境内DNS (可选,僅本地DNS模式下生效)</string>
|
||||
<string name="title_pref_domestic_dns">境内DNS (可選,僅本地DNS模式下生效)</string>
|
||||
<string name="summary_pref_domestic_dns">DNS</string>
|
||||
|
||||
<string name="title_pref_socks_port">SOCKS5代理端口</string>
|
||||
<string name="summary_pref_socks_port">SOCKS5代理端口</string>
|
||||
<string name="title_pref_socks_port">SOCKS5代理連接埠</string>
|
||||
<string name="summary_pref_socks_port">SOCKS5代理連接埠</string>
|
||||
|
||||
<string name="title_pref_http_port">HTTP代理端口</string>
|
||||
<string name="summary_pref_http_port">HTTP代理端口</string>
|
||||
<string name="title_pref_http_port">HTTP代理連接埠</string>
|
||||
<string name="summary_pref_http_port">HTTP代理連接埠</string>
|
||||
|
||||
|
||||
<string name="title_pref_feedback">回饋</string>
|
||||
@@ -154,7 +154,7 @@
|
||||
<string name="routing_settings_delete">清除</string>
|
||||
<string name="routing_settings_scan_replace">掃描並取代</string>
|
||||
<string name="routing_settings_scan_append">掃描並附加</string>
|
||||
<string name="routing_settings_default_rules">設置默認路由規則</string>
|
||||
<string name="routing_settings_default_rules">設置預設路由規則</string>
|
||||
|
||||
<string name="connection_test_pending">"檢查連線能力"</string>
|
||||
<string name="connection_test_testing">"測試中……"</string>
|
||||
@@ -179,13 +179,13 @@
|
||||
|
||||
<string-array name="routing_mode">
|
||||
<item>全球</item>
|
||||
<item>略過局域網</item>
|
||||
<item>略過區域網路</item>
|
||||
<item>略過中國大陸</item>
|
||||
<item>略過局域網及中國大陸</item>
|
||||
<item>略過區域網路及中國大陸</item>
|
||||
</string-array>
|
||||
<string name="title_pref_proxy_sharing_enabled">代理共享</string>
|
||||
<string name="summary_pref_proxy_sharing_enabled">綁定代理入口ip到0.0.0.0</string>
|
||||
<string name="toast_warning_pref_proxysharing">其他設備可以使用socks/http協議通過您的IP地址連接到代理\nHttp 代理: http://您的ip:10809\nSocks 代理: socks(4/5)://您的ip:10808\n僅在受信任的網絡中啟用以避免未經授權的連接</string>
|
||||
<string name="toast_warning_pref_proxysharing_short">代理共享已啟用,請確保處於受信網絡</string>
|
||||
<string name="toast_warning_pref_proxysharing">其他設備可以使用socks/http協定通過您的IP地址連接到代理\nHttp 代理: http://您的ip:10809\nSocks 代理: socks(4/5)://您的ip:10808\n僅在受信任的網路中啟用以避免未經授權的連接</string>
|
||||
<string name="toast_warning_pref_proxysharing_short">代理共享已啟用,請確保處於受信網路</string>
|
||||
<string name="toast_malformed_josn">配置格式錯誤</string>
|
||||
</resources>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<dimen name="bypass_list_header_height">50dp</dimen>
|
||||
<dimen name="layout_margin_top_height">16dp</dimen>
|
||||
<dimen name="layout_margin_right_height">16dp</dimen>
|
||||
<dimen name="layout_margin_spacing">8dp</dimen>
|
||||
<dimen name="edit_height">50dp</dimen>
|
||||
<dimen name="png_height">24dp</dimen>
|
||||
<dimen name="server_height">72dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user