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 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 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 androidx.lifecycle.get | |
| import androidx.lifecycle.ViewModel | |
| import androidx.lifecycle.ViewModelProvider | |
| import androidx.lifecycle.ViewModelStore | |
| import androidx.lifecycle.ViewModelStoreOwner | |
| /** | |
| * Returns a property delegate to access the wrapped value, which will be retained for the | |
| * duration of the lifecycle of this [ViewModelStoreOwner]. | |
| * |
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
| // | |
| // Debug.swift | |
| // | |
| // Created by Craig Hockenberry on 3/15/17. | |
| // Updated by Craig Hockenberry on 2/20/24. | |
| // Usage: | |
| // | |
| // SplineReticulationManager.swift: | |
| // |
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
| /* | |
| MIT License | |
| Copyright (c) 2019 Erik Hellman | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
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
| #!/usr/bin/env bash | |
| # I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
| # well, so I wrote my own script to do the simple job of converting package names. | |
| # | |
| # You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
| # | |
| # It'll run faster on a clean build because then there are fewer files to scan over. | |
| # | |
| # Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
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
| /* | |
| * ---------------------------------------------------------------------------- | |
| * "THE BEER-WARE LICENSE" (Revision 42): | |
| * Sebastiano Poggi wrote this file. As long as you retain this notice you | |
| * can do whatever you want with this stuff. If we meet some day, and you think | |
| * this stuff is worth it, you can buy me a beer in return. Seb | |
| * ---------------------------------------------------------------------------- | |
| * Feel free to attribute this code in compiled products if you feel like it, | |
| * but it's not required. | |
| */ |
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
| /* | |
| * Copyright 2018 Google, Inc. | |
| * | |
| * 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 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 android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.LiveData | |
| import android.arch.lifecycle.MediatorLiveData | |
| import android.arch.lifecycle.Observer | |
| fun <T> LiveData<T>.toLiveEvent(): LiveEvent<T> { | |
| return when (this) { | |
| is LiveEvent -> this | |
| else -> LiveEvent<T>().apply { |
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
| # I use ZSH, here is what I added to my .zshrc file (config file) | |
| # at ~/.zshrc | |
| # ------------------ Android ------------------ # | |
| # Have the adb accessible, by including it in the PATH | |
| export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:path/to/android_sdk/platform-tools/" | |
| # Setup your Android SDK path in ANDROID_HOME variable | |
| export ANDROID_HOME=~/sdks/android_sdk |
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
| #!/bin/bash | |
| for i in "$@" | |
| do | |
| case $i in | |
| -f=*|--file=*) | |
| FILENAME="${i#*=}" | |
| ;; | |
| -o=*|--out=*) | |
| OUTPUT="${i#*=}" |
NewerOlder