Skip to content

Instantly share code, notes, and snippets.

View Sinyuk7's full-sized avatar
🌴
On vacation

Sinyuk Sinyuk7

🌴
On vacation
View GitHub Profile
@Sinyuk7
Sinyuk7 / ComposePathMorphing.kt
Created October 28, 2022 17:04 — forked from vganin/ComposePathMorphing.kt
Jetpack Compose path morphing animation
@Composable
fun animatePathAsState(path: String): State<List<PathNode>> {
return animatePathAsState(remember(path) { addPathNodes(path) })
}
@Composable
fun animatePathAsState(path: List<PathNode>): State<List<PathNode>> {
var from by remember { mutableStateOf(path) }
var to by remember { mutableStateOf(path) }
val fraction = remember { Animatable(0f) }
@Sinyuk7
Sinyuk7 / LogActivity.java
Created January 30, 2019 08:07
LogActivity.java
package com.aliyun.iot.aghanim.log;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
@Sinyuk7
Sinyuk7 / delete_git_submodule.md
Created July 17, 2018 09:46 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
package test;
import android.arch.lifecycle.LiveData;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@Sinyuk7
Sinyuk7 / ParcelableUtil.java
Created January 26, 2018 06:08 — forked from omarmiatello/ParcelableUtil.java
Parcelable to byte array, byte array to parcelable
/**
* Copyright 2013 Omar Miatello - [email protected]
* Based on http://stackoverflow.com/a/18000094/1228545
*
* 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
*
@Sinyuk7
Sinyuk7 / ClickableTextView.java
Created January 10, 2018 09:00 — forked from dafi/ClickableTextView.java
Android TextView changing color when clicked. It uses the setSelect(); to change color. Show how to change text color and background
package com.ternaryop.phototumblrshare.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.TextView;
public class ClickableTextView extends TextView implements OnTouchListener {
@Sinyuk7
Sinyuk7 / ThrottledSearch.java
Created January 5, 2018 10:03 — forked from gotev/ThrottledSearch.java
Android Throttled Search
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.util.Timer;
import java.util.TimerTask;
/**
@Sinyuk7
Sinyuk7 / SharedPreferenceLiveData.kt
Created December 28, 2017 06:26 — forked from rharter/SharedPreferenceLiveData.kt
Creates LiveData objects that observe a value in SharedPreferences while they have active listeners.
import android.arch.lifecycle.LiveData
import android.content.SharedPreferences
abstract class SharedPreferenceLiveData<T>(val sharedPrefs: SharedPreferences,
val key: String,
val defValue: T) : LiveData<T>() {
private val preferenceChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
if (key == this.key) {
value = getValueFromPreferences(key, defValue)
@Sinyuk7
Sinyuk7 / RecyclerToListViewScrollListener
Created June 17, 2016 09:58 — forked from sjudd/RecyclerToListViewScrollListener
RecyclerView scroll listener to AbsListView scroll listener
public class RecyclerToListViewScrollListener extends RecyclerView.OnScrollListener {
private final AbsListView.OnScrollListener scrollListener;
private int lastFirstVisible = -1;
private int lastVisibleCount = -1;
private int lastItemCount = -1;
public RecyclerToListViewScrollListener(AbsListView.OnScrollListener scrollListener) {
this.scrollListener = scrollListener;
}
Sync Settings for Atom