mirror of
https://github.com/openlibrecommunity/olcng.git
synced 2026-07-03 14:05:17 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b775851960 | |||
| 4c52c1e45c | |||
| e55ad93c52 | |||
| db931be24e | |||
| 1f1d110a82 | |||
| 2912d17aca | |||
| 261bd389f6 | |||
| 2c9eb2d8af | |||
| 35a396ea0a | |||
| 0fa72f5ee1 |
@@ -229,12 +229,18 @@ class GroupServerFragment : BaseFragment<FragmentGroupServerBinding>(),
|
||||
*/
|
||||
private fun setSelectServer(guid: String) {
|
||||
val selected = MmkvManager.getSelectServer()
|
||||
if (guid != selected) {
|
||||
if (guid == selected) {
|
||||
MmkvManager.setSelectServer("")
|
||||
val position = mainViewModel.getPosition(guid)
|
||||
adapter.setSelectServer(position, position)
|
||||
if (mainViewModel.isRunning.value == true) {
|
||||
ownerActivity.restartV2Ray()
|
||||
}
|
||||
} else {
|
||||
MmkvManager.setSelectServer(guid)
|
||||
val fromPosition = mainViewModel.getPosition(selected.orEmpty())
|
||||
val toPosition = mainViewModel.getPosition(guid)
|
||||
adapter.setSelectServer(fromPosition, toPosition)
|
||||
|
||||
if (mainViewModel.isRunning.value == true) {
|
||||
ownerActivity.restartV2Ray()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package xyz.zarazaex.olc.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.net.VpnService
|
||||
import android.os.Bundle
|
||||
@@ -11,6 +12,8 @@ import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import com.google.android.material.color.MaterialColors
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
@@ -509,6 +512,13 @@ class MainActivity : HelperBaseActivity(), NavigationView.OnNavigationItemSelect
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
|
||||
val iconColor = MaterialColors.getColor(this, com.google.android.material.R.attr.colorOnSurface, Color.BLACK)
|
||||
for (i in 0 until menu.size()) {
|
||||
menu.getItem(i).icon?.let {
|
||||
DrawableCompat.setTint(DrawableCompat.wrap(it).mutate(), iconColor)
|
||||
}
|
||||
}
|
||||
|
||||
val searchItem = menu.findItem(R.id.search_view)
|
||||
val searchView = searchItem.actionView as SearchView
|
||||
|
||||
@@ -672,6 +682,7 @@ class MainActivity : HelperBaseActivity(), NavigationView.OnNavigationItemSelect
|
||||
|
||||
private fun importAllSubsOnStartup() {
|
||||
showLoading()
|
||||
setTestState(getString(R.string.connection_updating_profiles))
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val result = AngConfigManager.updateConfigViaSubAll()
|
||||
val removed = mainViewModel.removeDuplicateByIpAll()
|
||||
@@ -694,6 +705,7 @@ class MainActivity : HelperBaseActivity(), NavigationView.OnNavigationItemSelect
|
||||
*/
|
||||
fun importConfigViaSub(): Boolean {
|
||||
showLoading()
|
||||
setTestState(getString(R.string.connection_updating_profiles))
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val result = mainViewModel.updateConfigViaSubAll()
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/app_name"
|
||||
app:titleCentered="true" />
|
||||
app:titleCentered="true"
|
||||
app:titleTextColor="?attr/colorOnSurface" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -47,7 +48,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible"
|
||||
app:indicatorColor="@color/md_theme_primary" />
|
||||
app:indicatorColor="?attr/colorPrimary"
|
||||
app:trackCornerRadius="0dp"
|
||||
app:trackColor="@android:color/transparent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tab_slot_top"
|
||||
@@ -90,7 +93,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabIndicatorFullWidth="true"
|
||||
app:tabMode="auto"
|
||||
app:tabMode="fixed"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabRippleColor="@android:color/transparent"
|
||||
@@ -114,14 +117,15 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@drawable/bolt_24"
|
||||
android:stateListAnimator="@null"
|
||||
app:tint="@color/colorWhite"
|
||||
app:backgroundTint="@color/color_fab_inactive"
|
||||
app:rippleColor="#33FFFFFF"
|
||||
app:fabSize="normal"
|
||||
app:maxImageSize="28dp"
|
||||
app:elevation="4dp"
|
||||
app:pressedTranslationZ="8dp"
|
||||
app:hoveredFocusedTranslationZ="6dp" />
|
||||
app:elevation="0dp"
|
||||
app:pressedTranslationZ="0dp"
|
||||
app:hoveredFocusedTranslationZ="0dp" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
@@ -132,13 +136,14 @@
|
||||
android:focusable="true"
|
||||
android:nextFocusLeft="@+id/layout_test"
|
||||
android:src="@drawable/shield_24"
|
||||
android:stateListAnimator="@null"
|
||||
app:tint="@color/colorWhite"
|
||||
app:rippleColor="#33FFFFFF"
|
||||
app:fabSize="normal"
|
||||
app:maxImageSize="28dp"
|
||||
app:elevation="4dp"
|
||||
app:pressedTranslationZ="8dp"
|
||||
app:hoveredFocusedTranslationZ="6dp" />
|
||||
app:elevation="0dp"
|
||||
app:pressedTranslationZ="0dp"
|
||||
app:hoveredFocusedTranslationZ="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -143,15 +143,15 @@
|
||||
<string name="msg_downloading_content">Загрузка данных</string>
|
||||
<string name="menu_item_export_proxy_app">Экспорт в буфер обмена</string>
|
||||
<string name="menu_item_import_proxy_app">Импорт из буфера обмена</string>
|
||||
<string name="per_app_proxy_settings">Выбор приложений</string>
|
||||
<string name="per_app_proxy_settings_enable">Выбор приложений</string>
|
||||
<string name="per_app_proxy_settings">Раздельное туннелирование</string>
|
||||
<string name="per_app_proxy_settings_enable">Раздельное туннелирование</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="title_settings">Настройки</string>
|
||||
<string name="title_advanced">Расширенные настройки</string>
|
||||
<string name="title_core_settings">Настройки ядра</string>
|
||||
<string name="title_vpn_settings">Настройки VPN</string>
|
||||
<string name="title_pref_per_app_proxy">Прокси для выбранных приложений</string>
|
||||
<string name="title_pref_per_app_proxy">Раздельное туннелирование</string>
|
||||
<string name="summary_pref_per_app_proxy">Основной: выбранное приложение соединяется через прокси, не выбранное — напрямую;\nРежим обхода: выбранное приложение соединяется напрямую, не выбранное — через прокси.\nЕсть возможность автоматического выбора проксируемых приложений в меню.</string>
|
||||
<string name="title_pref_is_booted">Автоподключение при запуске</string>
|
||||
<string name="summary_pref_is_booted">Автоматически подключаться к выбранному серверу при запуске приложения (может оказаться неудачным)</string>
|
||||
@@ -345,7 +345,8 @@
|
||||
<string name="connection_test_fail">Интернет недоступен</string>
|
||||
<string name="connection_test_error_status_code">Код ошибки: #%d</string>
|
||||
<string name="connection_connected">Соединено, нажмите для проверки</string>
|
||||
<string name="connection_not_connected">Нет соединения</string>
|
||||
<string name="connection_not_connected">Ожидаем действий</string>
|
||||
<string name="connection_updating_profiles">Обновление профилей…</string>
|
||||
<string name="connection_runing_task_left">Запущено проверок: %s</string>
|
||||
|
||||
<string name="import_subscription_success">Подписка импортирована</string>
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
<string name="menu_item_import_proxy_app">Import from Clipboard</string>
|
||||
<string name="per_app_proxy_settings">Раздельное туннелирование</string>
|
||||
<string name="per_app_proxy_settings_enable">Включить</string>
|
||||
<string name="split_tunneling_description">Выберите приложения, которые будут использовать VPN. В режиме обхода — выбранные приложения НЕ используют VPN.</string>
|
||||
<string name="split_tunneling_description">Выберите приложения, которые будут использовать VPN — остальные приложения, например банки, будут идти напрямую через ваш домашний интернет.\n\nВ режиме обхода всё зеркально — выбранные приложения не используют VPN.</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="title_settings">Settings</string>
|
||||
@@ -353,6 +353,7 @@
|
||||
<string name="connection_test_error_status_code">Error code: #%d</string>
|
||||
<string name="connection_connected">Connected, tap to check connection</string>
|
||||
<string name="connection_not_connected">Готово к подключению</string>
|
||||
<string name="connection_updating_profiles">Updating profiles…</string>
|
||||
<string name="connection_runing_task_left">Проверено успешно: %s</string>
|
||||
|
||||
<string name="import_subscription_success">Subscription imported Successfully</string>
|
||||
|
||||
Reference in New Issue
Block a user