Skip to content

Instantly share code, notes, and snippets.

View paolorotolo's full-sized avatar
🖖

Paolo Rotolo paolorotolo

🖖
View GitHub Profile
Y= aX + bZ
X 1000
Z 2000
Y 3000
A 4000
B 5000
N 6000
R1 <- N
@paolorotolo
paolorotolo / SplitDateTime.java
Last active April 18, 2022 09:06
Split a DateTime string to get single elements
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
// Use example:
// DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// SplitDateTime splitDateTime = new SplitDateTime("2015-09-01 14:05");
// timeEditText.setText(splitDateTime.getHour + ":" + splitDateTime.getMinute);
import androidx.work.WorkInfo
class PrintableStopReason(
private val stopReason: Int) {
override fun toString(): String = when (stopReason) {
WorkInfo.STOP_REASON_NOT_STOPPED -> "STOP_REASON_NOT_STOPPED"
WorkInfo.STOP_REASON_CANCELLED_BY_APP -> "STOP_REASON_CANCELLED_BY_APP"
WorkInfo.STOP_REASON_PREEMPT -> "STOP_REASON_PREEMPT"
WorkInfo.STOP_REASON_TIMEOUT -> "STOP_REASON_TIMEOUT"
WorkInfo.STOP_REASON_DEVICE_STATE -> "STOP_REASON_DEVICE_STATE"
@paolorotolo
paolorotolo / LabelledSpinner.java
Last active January 11, 2024 16:42 — forked from farbodsz/ LabelledSpinner.md
A Spinner component with a floating label for Android, similar to EditText components wrapped in a TextInputLayout.
/*
* Copyright 2015 Farbod Salamat-Zadeh
*
* 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