Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Did you do good today?

Mirosław Stanek frogermcs

🤓
Did you do good today?
View GitHub Profile
@frogermcs
frogermcs / LoginActivity.java
Last active Sep 9, 2017
Sources for blog post "Dependency injection with Dagger 2 - Introdution to DI"
View LoginActivity.java
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 Apr 23, 2020
Sources for blog post "Dependency injection with Dagger 2 - the API"
View ActivityScope.java
@Scope
public @interface ActivityScope {
}
@frogermcs
frogermcs / AppComponent.java
Last active Mar 29, 2019
Sources for blog post "Dependency injection with Dagger 2 - Scopes"
View AppComponent.java
@Singleton
@Component(
modules = {
AppModule.class,
GithubApiModule.class
}
)
public interface AppComponent {
UserComponent plus(UserModule userModule);
@frogermcs
frogermcs / Snackbar.java
Last active Aug 29, 2015
InstaMaterial source files - Design Support Library
View Snackbar.java
public void showLikedSnackbar() {
Snackbar.make(clContent, "Liked!", Snackbar.LENGTH_SHORT).show();
}
@frogermcs
frogermcs / MainActivity.java
Last active Dec 20, 2019
FlatBuffs source files
View MainActivity.java
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 Sep 29, 2015
Dagger 2 performance improvements source code
View HeavyExternalLibrary.java
public class HeavyExternalLibrary {
private boolean initialized = false;
public HeavyExternalLibrary() {
}
public void init() {
try {
Thread.sleep(500);
@frogermcs
frogermcs / FlatBuffersParser.java
Last active Nov 5, 2015
FlatBuffs - parsing JSON with FlatBuffers source files
View FlatBuffersParser.java
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 Nov 19, 2015
FlatBuffers performance in Android - sources
View ReposListFlat.java
ByteBuffer bb = ByteBuffer.wrap(bytes);
ReposList reposListFlat = frogermcs.io.flatbuffs.model.flat.ReposList.getRootAsReposList(bb);
@frogermcs
frogermcs / animateAdd.java
Last active Oct 7, 2016
InstaMaterial source files (RecyclerView done right)
View animateAdd.java
@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 Jul 28, 2019
LikeAnimation source files
View likebutton.xml
<?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"/>
You can’t perform that action at this time.