Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yccheok's full-sized avatar

Yan Cheng Cheok yccheok

View GitHub Profile
package io.github.luizgrp.sectionedrecyclerviewadapter;
import static io.github.luizgrp.sectionedrecyclerviewadapter.Section.State;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
@yccheok
yccheok / FadeScrollView.swift
Created March 15, 2024 03:13 — forked from luismachado/FadeScrollView.swift
Custom UIScrollView with fade effect
//
// FadeScrollView.swift
//
// Created by Luís Machado on 23/06/2017.
// Copyright © 2017 Luis Machado. All rights reserved.
//
import UIKit
class FadeScrollView: UIScrollView, UIScrollViewDelegate {
class ShopCollectionViewCell: UICollectionViewCell {
...
func collapse() {
zeroHeightConstraint.isActive = true
}
func expand() {
zeroHeightConstraint.isActive = false
}
public enum FragmentType implements Parcelable {
Notes,
Archive,
Trash,
Backup;
public static final Parcelable.Creator<FragmentType> CREATOR = new Parcelable.Creator<FragmentType>() {
public FragmentType createFromParcel(Parcel in) {
return FragmentType.valueOf(in.readString());
}
public static <E extends Enum<E>> void putExtra(
@NonNull Intent intent,
@NonNull String key,
@NonNull E enumValue) {
intent.putExtra(
key,
enumValue.name()
);
}
A user cancelled his subscription on order id "GPA.3383-0878-7727-50427..8" on 17 December 2023
Then same user subscribed again on order id "GPA.3359-8897-6679-16612" on 11 January 2024
I believe he is using same product_id "cloud" and same purchase token "npmlplegcoomopcgiigbhkne.AO-J1Oz2kDBGXjy0Q0aLYyCfq4XZouWBHtQHQdbBtxIdxxBZCV1RxSoCo9AH72AosddxEmPbeJFQszl2kvJ1tAI9BxD-wqqCog" (Such a purchase token is copied from Copy purchase token button at Google Play Console)
When I make query using
androidpublisher.purchases().subscriptions().get(
packageName = "...",
public static void expandAnimation(View view) {
int config_shortAnimTime = WeNoteApplication.instance().getResources().getInteger(android.R.integer.config_shortAnimTime);
int prevHeight = view.getHeight();
// TODO:
int targetHeight = dpToPixel(120);
ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, targetHeight);
valueAnimator.setInterpolator(new AccelerateInterpolator());
valueAnimator.setDuration(config_shortAnimTime);
@yccheok
yccheok / gist:8c42536adf986222f047ec56b37a7b0a
Created December 10, 2023 18:43
Update "order" column using Batch Update Operation
private func _updateOrdersIfPossible2(context: NSManagedObjectContext, updateOrders: [UpdateOrder]) {
let count = updateOrders.count
if count < 2 {
return
}
var prevOrder = updateOrders[0].order
var updatedObjectIDs = [NSManagedObjectID]()
@yccheok
yccheok / gist:d287fc6e67fad73800504a545cfebf8f
Created December 10, 2023 18:42
Update "order" column using NSManagedObject
private func _updateOrdersIfPossible(context: NSManagedObjectContext, updateOrders: [UpdateOrder]) {
let count = updateOrders.count
if count < 2 {
return
}
var prevOrder = updateOrders[0].order
var updatedObjectIDs = [NSManagedObjectID]()
func getFont(_ textSize: Int) -> UIFont {
switch self {
case .new_york:
let sfFont = UIFont.systemFont(ofSize: CGFloat(textSize))
var fontDescriptor = sfFont.fontDescriptor
fontDescriptor = fontDescriptor.withSymbolicTraits(.traitBold) ?? fontDescriptor
if let newYorkFontDescriptor = fontDescriptor.withDesign(.serif) {
let newYorkFont = UIFont(descriptor: newYorkFontDescriptor, size: 0.0)