Skip to content

Instantly share code, notes, and snippets.

View ziginsider's full-sized avatar
🤴
καὶ σύ, τέκνον

Aliaksei ziginsider

🤴
καὶ σύ, τέκνον
View GitHub Profile
@Antarix
Antarix / LocalBroadcastExampleActivity.java
Created December 26, 2013 08:31
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@kboyarshinov
kboyarshinov / checkstyle.gradle
Last active June 18, 2024 13:23
Code quality gradle scripts for Android
/**
* Checkstyle tasks
* Usage:
* - place this file under root dir of your project at /gradle directory
* - apply script from your gradle file:
* apply from : "{rootDir}/gradle/checkstyle.gradle"
*
* To configure checkstyle use configs at:
* "{rootDir}/config/checkstyle/checkstyle.xml" - for main projects
* "{rootDir}/config/checkstyle/checkstyle-test.xml" - for tests
@ademar111190
ademar111190 / lambdaExample.java
Last active January 14, 2018 20:03
One month with Kotlin: lambda example
// Using Lambdas on Kotlin
val items = ArrayList<String>()
items.sortBy { item ->
item.length()
}
//or more implicity
items.sortBy { it.length() }
//------------------------------------------------------------------------------
import android.support.v7.widget.RecyclerView;
public class RecyclerViewSwipeListener extends RecyclerView.OnFlingListener {
private static final int SWIPE_VELOCITY_THRESHOLD = 2000;
boolean mIsScrollingVertically;
// change swipe listener depending on whether we are scanning items horizontally or vertically
RecyclerViewSwipeListener(boolean vertical) {
@ziginsider
ziginsider / DialPadFragment.kt
Created October 9, 2021 12:16
Android: Request permission with rationale via registerForActivityResult example
package com.some.site.dialpad
import android.content.Context
import android.os.Bundle
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.Fragment