|  | @@ -4,7 +4,6 @@ import android.Manifest
 | 
	
		
			
				|  |  |  import android.content.pm.ApplicationInfo
 | 
	
		
			
				|  |  |  import android.content.pm.PackageManager
 | 
	
		
			
				|  |  |  import android.util.Log
 | 
	
		
			
				|  |  | -import androidx.compose.animation.core.animateFloatAsState
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.background
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.Arrangement
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.Box
 | 
	
	
		
			
				|  | @@ -21,13 +20,12 @@ import androidx.compose.foundation.layout.padding
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.size
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.lazy.LazyColumn
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.lazy.items
 | 
	
		
			
				|  |  | +import androidx.compose.foundation.lazy.itemsIndexed
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.selection.selectable
 | 
	
		
			
				|  |  |  import androidx.compose.material.Icon
 | 
	
		
			
				|  |  |  import androidx.compose.material.IconButton
 | 
	
		
			
				|  |  |  import androidx.compose.material.Surface
 | 
	
		
			
				|  |  |  import androidx.compose.material.Text
 | 
	
		
			
				|  |  | -import androidx.compose.material.icons.Icons
 | 
	
		
			
				|  |  | -import androidx.compose.material.icons.automirrored.filled.ArrowBack
 | 
	
		
			
				|  |  |  import androidx.compose.material3.MaterialTheme
 | 
	
		
			
				|  |  |  import androidx.compose.material3.RadioButton
 | 
	
		
			
				|  |  |  import androidx.compose.material3.RadioButtonDefaults
 | 
	
	
		
			
				|  | @@ -39,7 +37,6 @@ import androidx.compose.runtime.setValue
 | 
	
		
			
				|  |  |  import androidx.compose.ui.Alignment
 | 
	
		
			
				|  |  |  import androidx.compose.ui.Modifier
 | 
	
		
			
				|  |  |  import androidx.compose.ui.draw.alpha
 | 
	
		
			
				|  |  | -import androidx.compose.ui.draw.rotate
 | 
	
		
			
				|  |  |  import androidx.compose.ui.graphics.Color
 | 
	
		
			
				|  |  |  import androidx.compose.ui.platform.LocalContext
 | 
	
		
			
				|  |  |  import androidx.compose.ui.res.colorResource
 | 
	
	
		
			
				|  | @@ -56,11 +53,9 @@ import com.google.gson.Gson
 | 
	
		
			
				|  |  |  import com.google.gson.reflect.TypeToken
 | 
	
		
			
				|  |  |  import com.vpn.fastestvpnservice.R
 | 
	
		
			
				|  |  |  import com.vpn.fastestvpnservice.beans.SelectApplicationEntry
 | 
	
		
			
				|  |  | -import com.vpn.fastestvpnservice.beans.SplitTunnelData
 | 
	
		
			
				|  |  |  import com.vpn.fastestvpnservice.constants.splitList
 | 
	
		
			
				|  |  |  import com.vpn.fastestvpnservice.customItems.SplitTunnelingItem
 | 
	
		
			
				|  |  |  import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
 | 
	
		
			
				|  |  | -import java.util.ArrayList
 | 
	
		
			
				|  |  |  import java.util.SortedSet
 | 
	
		
			
				|  |  |  import java.util.TreeSet
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -193,8 +188,46 @@ fun ColumnScope.ShowRadioButtons() {
 | 
	
		
			
				|  |  |          color = colorResource(id = R.color.gray_icon)
 | 
	
		
			
				|  |  |      ) {}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    val apps = getInstalledApps()
 | 
	
		
			
				|  |  | +    val apps2 = getInstalledApps()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    Log.d("test_split_compose", "apps called : ${apps.size}")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    val type = object : TypeToken<SortedSet<String?>?>() {}.type
 | 
	
		
			
				|  |  | +    val appsAllow = Gson().fromJson<SortedSet<String>>(
 | 
	
		
			
				|  |  | +        prefHelper.getSplitTunneledApps(), type
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for (app in appsAllow) {
 | 
	
		
			
				|  |  | +        Log.d("test_split_compose", "apps allow : $app")
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    val appsNoVpn = Gson().fromJson<SortedSet<String>>(
 | 
	
		
			
				|  |  | +        prefHelper.getSplitTunneledAppsNoVpn(), type
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for (app in appsNoVpn) {
 | 
	
		
			
				|  |  | +        Log.d("test_split_compose", "apps no vpn : $app")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    val appsNotAllow = prefHelper.getSplitTunneledAppsNotAllow()
 | 
	
		
			
				|  |  | +//    Log.d("test_split_compose", "apps not allow : $appsNotAllow")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (selectedList == splitList[1]) {
 | 
	
		
			
				|  |  | +        ShowSplitTunnelList(apps)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (selectedList == splitList[2]) {
 | 
	
		
			
				|  |  | +        ShowSplitTunnelList(apps)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@Composable
 | 
	
		
			
				|  |  | +fun getInstalledApps(): ArrayList<SelectApplicationEntry> {
 | 
	
		
			
				|  |  | +    val context = LocalContext.current
 | 
	
		
			
				|  |  | +    val prefHelper = BasePreferenceHelper(context)
 | 
	
		
			
				|  |  |      val apps: ArrayList<SelectApplicationEntry> = ArrayList()
 | 
	
		
			
				|  |  | -    val apps2: ArrayList<SelectApplicationEntry> = ArrayList()
 | 
	
		
			
				|  |  | +//    val apps2: ArrayList<SelectApplicationEntry> = ArrayList()
 | 
	
		
			
				|  |  |      val seen: SortedSet<String> = TreeSet()
 | 
	
		
			
				|  |  |      var selectedAppsList = ArrayList<String>()
 | 
	
		
			
				|  |  |      var selectedAppsListNoVpn = ArrayList<String>()
 | 
	
	
		
			
				|  | @@ -242,7 +275,7 @@ fun ColumnScope.ShowRadioButtons() {
 | 
	
		
			
				|  |  |                  Log.d("entry split", entry.toString())
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  apps.add(entry)
 | 
	
		
			
				|  |  | -                apps2.add(entry)
 | 
	
		
			
				|  |  | +//                apps2.add(entry)
 | 
	
		
			
				|  |  |                  seen.add(info.packageName)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -272,7 +305,7 @@ fun ColumnScope.ShowRadioButtons() {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  apps.add(entry)
 | 
	
		
			
				|  |  | -                apps2.add(entry)
 | 
	
		
			
				|  |  | +//                apps2.add(entry)
 | 
	
		
			
				|  |  |                  seen.add(info.packageName)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -280,22 +313,16 @@ fun ColumnScope.ShowRadioButtons() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      apps.sort()
 | 
	
		
			
				|  |  | -    apps2.sort()
 | 
	
		
			
				|  |  | +//    apps2.sort()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      apps.forEach {
 | 
	
		
			
				|  |  |          Log.d("test_split_apps", "$it ${it.getIcon()}")
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    apps2.forEach {
 | 
	
		
			
				|  |  | -        Log.d("test_split_apps 2", "$$it ${it.getIcon()}")
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +//    apps2.forEach {
 | 
	
		
			
				|  |  | +//        Log.d("test_split_apps 2", "$$it ${it.getIcon()}")
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    if (selectedList == splitList[1]) {
 | 
	
		
			
				|  |  | -        ShowSplitTunnelList(apps)
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    else if (selectedList == splitList[2]) {
 | 
	
		
			
				|  |  | -        ShowSplitTunnelList(apps2)
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    return apps
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Composable
 | 
	
	
		
			
				|  | @@ -307,8 +334,8 @@ fun ColumnScope.ShowSplitTunnelList(list: List<SelectApplicationEntry>) {
 | 
	
		
			
				|  |  |          .background(Color.Transparent)
 | 
	
		
			
				|  |  |      ) {
 | 
	
		
			
				|  |  |          LazyColumn() {
 | 
	
		
			
				|  |  | -            items(items = list) { app ->
 | 
	
		
			
				|  |  | -                SplitTunnelingItem(app, list)
 | 
	
		
			
				|  |  | +            itemsIndexed(items = list) {position, app ->
 | 
	
		
			
				|  |  | +                SplitTunnelingItem(app, list, position)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 |