Skip to content

Instantly share code, notes, and snippets.

View romtsn's full-sized avatar

Roman Zavarnitsyn romtsn

View GitHub Profile
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View parent = inflater.inflate(R.layout.your_fragment_layout, container, false);
new LoadTask().execute();
return parent;
}
@romtsn
romtsn / FavoritesFragment
Last active August 29, 2015 14:25
Code example
package com.stylezappmen.android.fragments;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
public class CurrentListRecyclerAdapter extends RecyclerView.Adapter<CurrentListRecyclerAdapter.ViewHolder> {
protected ArrayList<Order> dataset;
private ViewHolder.ViewHolderClickListener mListener;
public CurrentListRecyclerAdapter(ViewHolder.ViewHolderClickListener listener) {
super();
mListener = listener;
dataset = new ArrayList<>();
}
package com.eftimoff.empty;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import android.os.Handler;
import android.util.AttributeSet;
/*
* Copyright (C) The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
public void russian(View v) {
/* page1.setVisibility(View.INVISIBLE);
page2.setVisibility(View.INVISIBLE);
page3.setVisibility(View.INVISIBLE);
page4.setVisibility(View.VISIBLE);*/
page1=null;
page2=null;
page3=null;
@romtsn
romtsn / build.gradle
Created July 25, 2017 11:33
Stream + Retrolambda sample
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "rom4ek.com.sparktestapp"
minSdkVersion 14
09-12 09:34:23.899 5154-5154/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.runtastic.android.balance.lite, PID: 5154
java.lang.NullPointerException: Attempt to write to field 'java.lang.ref.WeakReference o.ト.ˊ' on a null object reference
at o.טּ.ˎ(:57041)
at o.טּ.ˋ(:64)
at o.nx$1.run(:90)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)

First off, sorry if something is heavily contradicting what you've done already, but I still wanna leave my 2 cents here, if you find time for that in the future to address that. If not, then this will be a todo list for my future self :) Regardless, everything here is purely subjective and discussable, as always.

A follow-up from our e-mail discussion:

  1. Flows instead of LiveData: you could take a look at this article as an example of how to use StateFlow with ViewModels. And here's an example on how to bring Flow to native. Not a must of course, just if you find time.

  2. About interactors: I'm not sure what did you mean by "sources are uncontrollable black boxes", when you are actually the one who's defining and implementing them :) IMHO it's just a yet another unnecessary layer (because essentially interact

@romtsn
romtsn / SentryPlugin.kt
Created December 6, 2021 07:26
Bytecode Transformations: Plugin
class SentryPlugin : Plugin<Project> {
override fun apply(project: Project) {
...
}
}