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
canvas.withTranslation(200f, 300f) { | |
drawCircle(150f, 150f, RADIUS, circlePaint) | |
withRotation(45f) { | |
drawRect(rect, rectPaint) | |
} | |
} |
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
val translateCheckpoint = canvas.save() | |
canvas.translate(200f, 300f) | |
canvas.drawCircle(150f, 150f, RADIUS, circlePaint) // drawn on the translated canvas | |
val rotateCheckpoint = canvas.save() | |
canvas.rotate(45f) | |
canvas.drawRect(rect, rectPaint) // drawn on the translated and rotated canvas | |
canvas.restoreToCount(rotateCheckpoint) | |
canvas.restoreToCount(translateCheckpoint) |
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
canvas.save() | |
canvas.translate(200f, 300f) | |
canvas.drawCircle(...) // drawn on the translated canvas | |
canvas.restore() |
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
<!--- Provide a general summary of your changes in the Title above --> | |
<!--- If there is no changelog entry, label this PR as trivial to bypass the Danger warning --> | |
## Description | |
<!--- Describe your changes in detail --> | |
## Motivation and Context | |
<!--- Why is this change required? What problem does it solve? --> |
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 ProjectEditorViewModel : ViewModel() { | |
private val _state = MutableLiveData<EditorState>() | |
val state: LiveData<EditorState> | |
get() = _state | |
} |
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 ProjectEditorFragment : Fragment { | |
@Inject | |
lateinit var viewModelFactory: ViewModelProvider.Factory | |
private lateinit var viewModel: ProjectEditorViewModel | |
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
val view = inflater.inflate(R.layout.fragment_editor_initial, container, false) |
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 za.co.riggaroo.motionsense | |
import android.app.Activity | |
import android.graphics.Bitmap | |
import android.os.Bundle | |
import android.os.Handler | |
import android.util.Log | |
import android.widget.ImageView | |
import com.google.android.things.pio.Gpio | |
import com.google.android.things.pio.GpioCallback |
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.Bitmap | |
import android.graphics.BitmapFactory | |
import android.graphics.ImageFormat | |
import android.graphics.Matrix | |
import android.hardware.camera2.* | |
import android.hardware.camera2.CameraAccessException.CAMERA_ERROR | |
import android.media.ImageReader | |
import android.os.Handler | |
import android.util.Log |
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/local/bin/bash | |
# Prerequistes: You need to install imagemagick and pdfimages for this script to work | |
# Usage - ./convert_book.sh pdf_name.pdf | |
# output - zip file with images and bookdetails.json file | |
# This script assumes the normal structure of a book dash book and wont work for bigger books or books with different formatting to the standard book dash book | |
# it is always advised to check the output zipped file to ensure its correct | |
folderName=$(basename "$1") | |
folderName="${folderName%.*}" |
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
public class FriendsActivity extends AppCompatActivity { | |
private static final String TAG = "MainActivity"; | |
public static final String FEATURE_FLAG_ADD_FRIENDS = "feature_add_friends"; | |
private FirebaseRemoteConfig remoteConfig; | |
private Button buttonAddFriend; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |