Skip to content

Instantly share code, notes, and snippets.

View frogermcs's full-sized avatar
🤓
Did you do good today?

Mirosław Stanek frogermcs

🤓
Did you do good today?
View GitHub Profile
@frogermcs
frogermcs / LoginActivity.java
Last active September 9, 2017 07:10
Sources for blog post "Dependency injection with Dagger 2 - Introdution to DI"
public class LoginActivity extends AppCompatActivity {
LoginActivityPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient okHttpClient = new OkHttpClient();
RestAdapter.Builder builder = new RestAdapter.Builder();
@frogermcs
frogermcs / ActivityScope.java
Last active April 23, 2020 17:14
Sources for blog post "Dependency injection with Dagger 2 - the API"
@Scope
public @interface ActivityScope {
}
@frogermcs
frogermcs / AppComponent.java
Last active March 29, 2019 04:11
Sources for blog post "Dependency injection with Dagger 2 - Scopes"
@Singleton
@Component(
modules = {
AppModule.class,
GithubApiModule.class
}
)
public interface AppComponent {
UserComponent plus(UserModule userModule);
@frogermcs
frogermcs / Snackbar.java
Last active August 29, 2015 14:25
InstaMaterial source files - Design Support Library
public void showLikedSnackbar() {
Snackbar.make(clContent, "Liked!", Snackbar.LENGTH_SHORT).show();
}
@frogermcs
frogermcs / MainActivity.java
Last active August 4, 2022 06:10
FlatBuffs source files
public class MainActivity extends AppCompatActivity {
@Bind(R.id.tvFlat)
TextView tvFlat;
@Bind(R.id.tvJson)
TextView tvJson;
private RawDataReader rawDataReader;
private ReposListJson reposListJson;
@frogermcs
frogermcs / HeavyExternalLibrary.java
Last active September 29, 2015 22:42
Dagger 2 performance improvements source code
public class HeavyExternalLibrary {
private boolean initialized = false;
public HeavyExternalLibrary() {
}
public void init() {
try {
Thread.sleep(500);
@frogermcs
frogermcs / FlatBuffersParser.java
Last active November 5, 2015 14:09
FlatBuffs - parsing JSON with FlatBuffers source files
public class FlatBuffersParser {
static {
System.loadLibrary("FlatBuffersParser");
}
public ByteBuffer parseJson(String json, String schema) {
final byte[] bytes = parseJsonNative(json, schema);
return ByteBuffer.wrap(bytes);
}
@frogermcs
frogermcs / ReposListFlat.java
Last active November 19, 2015 17:10
FlatBuffers performance in Android - sources
ByteBuffer bb = ByteBuffer.wrap(bytes);
ReposList reposListFlat = frogermcs.io.flatbuffs.model.flat.ReposList.getRootAsReposList(bb);
@frogermcs
frogermcs / animateAdd.java
Last active October 7, 2016 16:40
InstaMaterial source files (RecyclerView done right)
@Override
public boolean animateAdd(RecyclerView.ViewHolder viewHolder) {
if (viewHolder.getItemViewType() == FeedAdapter.VIEW_TYPE_DEFAULT) {
if (viewHolder.getLayoutPosition() > lastAddAnimatedItem) {
lastAddAnimatedItem++;
runEnterAnimation((FeedAdapter.CellFeedViewHolder) viewHolder);
return false;
}
}
@frogermcs
frogermcs / likebutton.xml
Last active July 28, 2019 16:52
LikeAnimation source files
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<frogermcs.io.likeanimation.DotsView
android:id="@+id/vDotsView"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center"/>