Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Valeria Rogatchevskikh valllllll2000

🎯
Focusing
Block or report user

Report or block valllllll2000

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@juliusspencer
juliusspencer / WeatherStationActivity.java
Created Apr 24, 2017
Modified Weatherstation Codelab Activity to handle CPU temperature
View WeatherStationActivity.java
/*
* Copyright 2017, The Android Open Source Project
*
* 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
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active Aug 15, 2019
Add addOnItemClickListener easily to a RecyclerView using Kotlin
View RecyclerViewExtension.kt
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {
View store_api_keys.md

1. Store api keys in a xml file

Put xml file "api_keys.xml" in the directory "res/value/".

api_keys.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="THE_MOVIE_DB_API_TOKEN">XXXXX</string>
</resources>
@henrytao-me
henrytao-me / RecycleEmptyErrorView.java
Last active Dec 13, 2016
Empty and Error in RecycleView
View RecycleEmptyErrorView.java
/*
* Copyright 2015 "Henry Tao <hi@henrytao.me>"
*
* 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
@iperdomo
iperdomo / commit-msg
Last active Feb 25, 2019
Simple Git commit hook to enforce adding an issue number
View commit-msg
#!/bin/sh
if [[ -z "$(head -n1 "$1" | grep -o -E '#[0-9]+')" ]]; then
echo >&2 ERROR: Commit message must include issue number.
exit 1
fi
exit 0
@shirou
shirou / FileObserver on Android
Created Nov 2, 2010
Detect file change using FileObserver on Android
View FileObserver on Android
private class PathFileObserver extends FileObserver{
static final String TAG="FILEOBSERVER";
/**
* should be end with File.separator
*/
String rootPath;
static final int mask = (FileObserver.CREATE |
FileObserver.DELETE |
FileObserver.DELETE_SELF |
FileObserver.MODIFY |
You can’t perform that action at this time.