This file contains 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 ferg.componentmash | |
import android.app.Activity | |
import android.os.Bundle | |
import androidx.activity.compose.setContent | |
import androidx.compose.animation.animateColorAsState | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Column |
This file contains 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
# https://www.atpeaz.com/disable-zscaler-temporarily-on-your-mac/ | |
# disable | |
sudo launchctl unload /Library/LaunchDaemons/com.zscaler.service.plist && sudo launchctl unload /Library/LaunchDaemons/com.zscaler.tunnel.plist | |
# Reenable | |
sudo launchctl load /Library/LaunchDaemons/com.zscaler.service.plist && sudo launchctl load /Library/LaunchDaemons/com.zscaler.tunnel.plist |
This file contains 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
/* | |
* Copyright 2019 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains 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 PdfDownloader @Inject constructor( | |
private val context: Context, | |
private val yourApi: YourApi | |
) { | |
private class DownloadException(message: String, cause: Throwable? = null) : RuntimeException(message, cause) | |
suspend fun download(url: String, fileName: String): String = withContext(Dispatchers.IO) { | |
val file = createFile(fileName) |
This file contains 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 PdfAdapter( | |
// this would come from the ViewModel so we don't need to recreate it on config change | |
// and the VM can close it within onCleared() | |
private val renderer: PdfRenderer, | |
// this would come from the Activity/Fragment based on the display metrics | |
private val pageWidth: Int | |
) : RecyclerView.Adapter<PdfAdapter.ViewHolder>() { | |
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { |
This file contains 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
#!/usr/bin/env python3 | |
''' | |
!!! Required adb PATH on env var !!! | |
[Usage] | |
Run with python: | |
$ python3 send_push_or_deeplink.py | |
or add exec permission | |
$ chmod +x send_push_or_deeplink.py |
This file contains 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 android.content.Context | |
import android.transition.AutoTransition | |
import android.transition.TransitionManager | |
import androidx.constraintlayout.widget.ConstraintLayout | |
import androidx.constraintlayout.widget.ConstraintSet | |
import androidx.core.transition.doOnEnd | |
//convenience method to animate several constraint layouts one after another | |
//important to only pass in the constraint layout LAYOUT FILE ids |
This file contains 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 android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.Paint | |
import android.os.Handler | |
import android.service.wallpaper.WallpaperService | |
import android.util.DisplayMetrics | |
import android.view.SurfaceHolder | |
import android.view.WindowManager | |
import java.util.* |
This file contains 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
@Suppress("FunctionName") | |
fun BroadcastReceiverFlow(c: Context, intentFilter: IntentFilter): Flow<Intent> { | |
return callbackFlow { | |
val broadcastReceiver = object : android.content.BroadcastReceiver() { | |
override fun onReceive(context: Context, intent: Intent) { | |
offer(intent) | |
} | |
} | |
c.registerReceiver(broadcastReceiver, intentFilter) | |
awaitClose { c.unregisterReceiver(broadcastReceiver) } |
This file contains 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 com.pixite.pigment.testing | |
import android.app.Activity | |
import android.app.Instrumentation | |
import android.content.Context | |
import android.content.Intent | |
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.FragmentActivity | |
import androidx.fragment.app.FragmentManager | |
import androidx.lifecycle.Lifecycle |
NewerOlder