Skip to content

Instantly share code, notes, and snippets.

Bartosz Kosarzycki kosiara

Block or report user

Report or block kosiara

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
@kosiara
kosiara / gist:eec35300b92d8a3e92a9
Created Oct 23, 2015
Android Studio/ IntelliJ custom search scope without R.java classes with usual *.xml files from an Android project
View gist:eec35300b92d8a3e92a9
Edit->Find->Find in path
Custom -> ... -> Add scope
search pattern:
file:*java&&!file:*R.java*&&!file:*_.java||file:*strings.xml||file:*dimes.xml||file:*styles.xml||file:*attrs.xml||file:*colors.xml||file:*layout/*xml&&!file:*build/*xml
<component name="DependencyValidationManager"><scope name="PekaJavaWithoutRWithStrings" pattern="file:*java&&!file:*R.java*&&!file:*_.java||file:*strings.xml||file:*dimes.xml||file:*styles.xml||file:*attrs.xml||file:*colors.xml||file:*layout/*xml&&!file:*build/*xml"/></component>
@kosiara
kosiara / HowToInstallGPOnAnEmulator.txt
Last active Oct 2, 2018
Android - Install Google Play Services / Google Play on android emulator
View HowToInstallGPOnAnEmulator.txt
1. Download Google Apps from basketbuild.com:
https://basketbuild.com/gapps
2. Extract GPE services apk files from the zip:
unzip -j gapps-lp-20150222-signed.zip system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk system/priv-app/GoogleLoginService/GoogleLoginService.apk system/priv-app/Phonesky/Phonesky.apk system/priv-app/GmsCore/GmsCore.apk -d ./
3. Start the emulator with the command:
/home/path/to/your/android/Sdk/tools/emulator -no-boot-anim -netdelay none -netspeed full -avd YOUR_EMULATOR_NAME
@kosiara
kosiara / main.dart
Created Sep 2, 2018
Flutter portrait only
View main.dart
void main() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(new MyApp());
});
}
@kosiara
kosiara / proguard-rules.pro
Last active Sep 1, 2018
proguard rules for Twitter UI
View proguard-rules.pro
# Twitter core rules
-keepattributes *Annotation* #GSON
-dontwarn java.nio.file.** #Okio
-dontwarn org.codehaus.mojo.animal_sniffer.** #Okio
-dontwarn javax.annotation.* #Okio
-dontwarn javax.annotation.concurrent.* #Okio
-dontnote retrofit2.Platform #Retrofit 2
-dontnote retrofit2.Platform$IOS$MainThreadExecutor #Retrofit 2
-dontwarn retrofit2.Platform$Java8 #Retrofit 2
-keepattributes Signature #Retrofit 2
@kosiara
kosiara / TweetViewUtil.kt
Last active Aug 30, 2018
Reformat Twitter date
View TweetViewUtil.kt
/**
* Reformat Twitter date to a new pattern
*/
fun TweetView.reformatDate(newDatePattern: String) {
val twitterDatePattern = "EEE MMM dd HH:mm:ss Z yyyy" // Mon Apr 21 04:08:37 +0000 2018
val dateTextView = findViewById<AppCompatTextView>(R.id.tw__tweet_timestamp)
dateTextView.text = parseDate(tweet.createdAt, twitterDatePattern).format(newDatePattern)
}
/**
@kosiara
kosiara / TwitterViewComponent.kt
Last active Aug 30, 2018
Custom Twitter TweetView Style
View TwitterViewComponent.kt
override fun success(result: Result<Tweet>?) {
val tweet = result!!.data
componentInstance.addView(TweetView(componentInstance.context, tweet, R.style.CustomTwitterStyle))
invalidate()
}
View item_list_twitter_comment.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="tweetId"
type="com.bk.sample.android.util.databinding.ObservableString" />
</data>
@kosiara
kosiara / TwitterViewComponent.kt
Created Aug 30, 2018
TwitterViewComponent - simple
View TwitterViewComponent.kt
package com.bk.sample.android.component
[...]
import com.bk.sample.android.util.databinding.ObservableString
import com.twitter.sdk.android.core.Callback
import com.twitter.sdk.android.core.Result
import com.twitter.sdk.android.core.TwitterException
import com.twitter.sdk.android.core.models.Tweet
import com.twitter.sdk.android.tweetui.TweetUtils
import com.twitter.sdk.android.tweetui.TweetView
@kosiara
kosiara / proguard-rules.pro
Created Nov 3, 2015
RxJava RxAndroid Proguard rules
View proguard-rules.pro
#build.gradle
#
# compile 'io.reactivex:rxandroid:1.0.1'
# compile 'io.reactivex:rxjava:1.0.14'
# compile 'io.reactivex:rxjava-math:1.0.0'
# compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
@kosiara
kosiara / MyAlphaInAnimationAdapter.java
Last active Jun 12, 2018
Android RecyclerView sequential items fade-in animation
View MyAlphaInAnimationAdapter.java
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class MyAlphaInAnimationAdapter extends MyAnimationAdapter {
private static final float DEFAULT_ALPHA_FROM = 0.0F;
private final float mFrom;
private RecyclerView recyclerView;
You can’t perform that action at this time.