Skip to content

Instantly share code, notes, and snippets.

⚜️
:)

Anton Shkurenko tonyshkurenko

⚜️
:)
Block or report user

Report or block tonyshkurenko

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
@tonyshkurenko
tonyshkurenko / styles.xml
Created Oct 30, 2015
No ui activity theme for the AppCompat
View styles.xml
<!-- No ui for appcompat -->
<style name="NoUiAppTheme"
parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoDisplay">true</item>
</style>
@tonyshkurenko
tonyshkurenko / Dagger 2, quick start
Last active Jun 18, 2018
Everything I found about Dagger 2
View Dagger 2, quick start
Dagger step 1: Add android-apt, dagger 2, dagger2-compiler, and javax annotation to the build.gradle files.
Note that they're not all "compile" dependencies.
Step 2: Add our module. Our ApplicationModule will be able to inject the ApplicationContext to classes that need it.
Step 3: Add our Component.Dagger 2 generates code for each Component you create,
using the file name Dagger(NameOfComponent).
Example: DaggerApplicationComponent.
Components can have multiple modules, in our case we have one.
@tonyshkurenko
tonyshkurenko / PageProvider.java
Last active Mar 27, 2018
EndlessScrollListenerBothSides
View PageProvider.java
package io.github.tonyshkurenko.endlessscrollingbothsides;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* Project: EndlessScrollingBothSides
@tonyshkurenko
tonyshkurenko / ViewExpander.java
Created Sep 11, 2015
Util class to expand/collapse views with animations. Android.
View ViewExpander.java
package ua.com.i2i.futurum.utils;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Transformation;
/**
* credits: http://stackoverflow.com/a/13381228/4142087
* util class to expand/collapse view with animation
@tonyshkurenko
tonyshkurenko / MainActivity.java
Created Jul 14, 2016
Basic activity for demos
View MainActivity.java
package io.github.tonyshkurenko.slidinguppanelsetup;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
View Major-Minor-Patch-Build gradle
import java.util.regex.Pattern
task('increaseVersionCode') << {
def manifestFile = file("src/main/AndroidManifest.xml")
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
def versionCode = Integer.parseInt(matcher.group(1))
def manifestContent = matcher.replaceAll("versionCode=\"" + ++versionCode + "\"")
View Delimited String
public static <T> String toDelimitedString(List<T> list, String delimiter) {
final StringBuilder strb = new StringBuilder();
for (T t : list) {
strb.append(String.valueOf(t)).append(delimiter);
}
return strb.substring(0, strb.length() - delimiter.length());
}
View Adding contact to the contacts content provider
private static void addContact(Context ctx, String displayName, String mobileNumber, String homeNumber, String workNumber, String email, String company, String jobTitle) {
final ArrayList<ContentProviderOperation> ops = new ArrayList<>();
ops.add(ContentProviderOperation.newInsert(
ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
.build());
View OnSwipeTouchListener.java
public class OnSwipeTouchListener implements OnTouchListener {
private final GestureDetector gestureDetector;
public OnSwipeTouchListener (Context ctx){
gestureDetector = new GestureDetector(ctx, new GestureListener());
}
@Override
public boolean onTouch(View v, MotionEvent event) {
You can’t perform that action at this time.