Skip to content

Instantly share code, notes, and snippets.

View Sardorbekcyber's full-sized avatar
🎯
Growing

Sardor Narziyev Sardorbekcyber

🎯
Growing
View GitHub Profile
#If users are clicking on links and they aren’t opening in your application,
#then there might be a problem with your intent-filters. You can test your
#intent-filters using the command adb shell am start with a VIEW action, a deep linked URL,
#and the package id. This checks that the application can handle a deep link which is explicitly sent to it.
adb shell am start \
-W -a android.intent.action.VIEW \
-d "https://droidfood.example.com" \
com.example.droidfood
package app.skylab.device.countrycode.model
object Constants {
const val codes = """[
{
"name": "Afghanistan",
"dialCode": "+93",
"isoCode": "AF",
"flag": "https://cdn.kcak11.com/CountryFlags/countries/af.svg"
},
adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.myapp. Used to test deeplinks from adb
To slow down the device's animations by a factor of 10x, you can run the following commands from the command line:
adb shell settings put global window_animation_scale 10
adb shell settings put global transition_animation_scale 10
adb shell settings put global animator_duration_scale 10
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.customview.widget.ViewDragHelper
import timber.log.Timber
class VerticalSwipeDismissBehavior<V : View> @JvmOverloads constructor(context: Context? = null, attrs: AttributeSet? = null) : CoordinatorLayout.Behavior<V>(context, attrs) {
Change the emulator locale from the adb shell
To change the locale in the emulator by using the adb shell, do the following:
Pick the locale you want to test and determine its BCP-47 language tag, such as fr-CA for Canadian French.
Launch an emulator.
From a command-line shell on the host computer, run the following command:
adb shell
or, if you have a device attached, specify that you want the emulator by adding the -e option:
adb -e shell
At the adb shell prompt (#), run this command:
object LocaleHelper {
fun setLocale(context: Context?): Context {
return setAppLocale(context!!, Pref(context).lang)
}
private fun setAppLocale(
context: Context,
locale: String
): Context {
@Sardorbekcyber
Sardorbekcyber / FollowersViewModel.kt
Created October 20, 2023 11:39
Follower ViewModel for Code Example
package app.skylab.profile.ui.fragments.followers
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import androidx.paging.cachedIn
import app.skylab.core.ActionDispatcher
@Sardorbekcyber
Sardorbekcyber / multiple-ssh-keys-git.adoc
Created October 26, 2023 12:09 — forked from alejandro-martin/multiple-ssh-keys-git.adoc
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

//Service
@Override
public void onCreate() {
LocalBroadcastManager
.getInstance(this)
.registerReceiver(new ServiceEchoReceiver(), new IntentFilter("ping"));
//do not forget to deregister the receiver when the service is destroyed to avoid
//any potential memory leaks
}