This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun <T> ExpandableCardStack( | |
| elements: List<T>, | |
| contentHeight: Dp, | |
| contentVerticalPadding: Dp, | |
| contentHorizontalPadding: Dp, | |
| content: @Composable (Modifier) -> Unit, | |
| modifier: Modifier = Modifier, | |
| cardCornerRadius: Dp = 16.dp, | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NetworkMonitor( | |
| applicationContext: Context, | |
| ) : NetworkConnectivityService { | |
| private val connectivityManager = applicationContext.getSystemService( | |
| Context.CONNECTIVITY_SERVICE | |
| ) as ConnectivityManager | |
| override val networkStatus: Flow<NetworkStatus> = callbackFlow { | |
| val connectivityCallback = object : NetworkCallback() { | |
| override fun onAvailable(network: Network) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ui.kit | |
| //https://stackoverflow.com/a/69780826 | |
| import androidx.compose.material.LocalTextStyle | |
| import androidx.compose.material.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.getValue | |
| import androidx.compose.runtime.mutableStateOf | |
| import androidx.compose.runtime.remember |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun dipToPixels(dip: Int): Int { | |
| return TypedValue.applyDimension( | |
| TypedValue.COMPLEX_UNIT_DIP, | |
| dip.toFloat(), | |
| Resources.getSystem().displayMetrics | |
| ).toInt() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Validator { | |
| private const val LOGIN_PATTERN = "^[a-zA-Z0-9_-]{0,38}$" | |
| private const val AUTHORIZATION_TOKEN_PATTERN = "^gh[pousr]_[a-zA-Z0-9]{0,40}$" | |
| fun validateLogin(login: String): Validation { | |
| if (login.isEmpty()) return FieldValidation.Empty | |
| val matcher = Pattern.compile(LOGIN_PATTERN).matcher(login) | |
| return if (matcher.matches()) Validation.Correct else Validation.Incorrect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AppActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| NetworkConnectionManager(this).startNetworkCallback() | |
| setContentView(R.layout.activity_app) | |
| } | |
| override fun onPause() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.xmlpull.v1.XmlPullParser | |
| import org.xmlpull.v1.XmlPullParserException | |
| import org.xmlpull.v1.XmlPullParserFactory | |
| import java.io.IOException | |
| import java.io.InputStream | |
| import java.math.BigDecimal | |
| import java.nio.charset.Charset | |
| import java.util.ArrayList | |
| class XmlParser { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Activity extends AppCompatActivity{ | |
| ... | |
| private NetworkConnectionMonitor connectionMonitor; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity); | |
| ... | |
| connectionMonitor = new NetworkConnectionMonitor(getApplicationContext()); |