Skip to content

Instantly share code, notes, and snippets.

💭
Check out the surf report app I'm working on https://pitted.app

Etienne Lawlor lawloretienne

💭
Check out the surf report app I'm working on https://pitted.app
Block or report user

Report or block lawloretienne

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
View RxLogging.kt
package com.getsomeheadspace.android.foundation.utils
// https://proandroiddev.com/briefly-about-rxjava-logging-20308b013e6d
import io.reactivex.*
import timber.log.Timber
inline fun <reified T> printEvent(tag: String, success: T?, error: Throwable?) =
when {
success == null && error == null -> Timber.d("$tag Complete") /* Only with Maybe */
View CustomTextView.java
public class CustomTextView extends AppCompatTextView {
public CustomTextView(Context context) {
super(context);
init(context,null);
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
View Future Projects.md

Update MovieHub

  • Package by Feature
  • Dagger
  • MVP
    • The MVP Pattern is a user interface software architecture pattern that reduces the behavior of the UI components, in this case those are the views, widgets, fragments, and activities. The MVP Pattern reduces the UI components behavior to a bare minimum by using a presenter. A presenter is simply a controller like class that handles the presentation logic and updates the view accordingly. Using this pattern, you can pull your UI logic out of the Android components and place it into your presenters, making it much easier to test and much faster to test. It is faster to test since we no longer need the Android framework to test our inputs and outputs. The Android context is gone. We don't need to fire up an Android emulator or an Android device. We can just rely solely on the JVM which is very fast.
    • A repository is essentially a location where data may be stored. This can be stored in mem
View MoviesFragment.java
public class MoviesFragment extends BaseFragment {
// region Member Variables
private CompositeSubscription compositeSubscription;
// endregion
// region Lifecycle Methods
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View BaseFragment.java
public abstract class BaseFragment extends Fragment {
// region Member Variables
protected List<Call> calls;
// endregion
// region Lifecycle Methods
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View RoundedBitmapDrawableUtility.java
public class RoundedBitmapDrawableUtility {
public static RoundedBitmapDrawable getRoundedSquareBitmapDrawable(Context context, Bitmap originalBitmap, int cornerRadius){
return getRoundedSquareBitmapDrawable(context, originalBitmap, cornerRadius, -1, -1);
}
public static RoundedBitmapDrawable getRoundedSquareBitmapDrawable(Context context, Bitmap originalBitmap, int cornerRadius, int borderWidth, int borderColor){
int originalBitmapWidth = originalBitmap.getWidth();
int originalBitmapHeight = originalBitmap.getHeight();
View Dagger_Notes.md
  • A dependency is a coupling between two classes usually because one of them uses the other to do something.
  • Dependency injection consists of passing dependencies (inject them) via constructor in order to extract the task of creating modules out from other modules. Objects are instantiated somewhere else and passed as constructor attributes when creating the current object.
  • A dependency injector is another module in our app that is in charge of providing instances of the rest of modules and inject their dependencies. It's responsibility is the creation of modules is localized in a single point in our app, and we have full control over it.
  • Dagger is a dependency injector designed for low-end devices. Most dependency injectors rely on reflection to create and inject dependencies. Reflection is very time consuming on low-end devices, and specially on old android versions. Dagger, however, uses a pre-compiler that creates all the classes it needs to work. That way, no reflection is needed. Dagger is
View User Testing.md
  • Test most important flows in the app (Request a table flow). By focusing the test you will get more actionable results.
  • Test popular phone manufacturers (Samsung, LG, HTC, Motorola)
  • Changing the look of an app can create intense dissatisfaction among your user base. Run user tests on major UI changes before you push them out to market.
  • Test for usability and emotional engagement
    • Usability means the ability of a typical user to easily figure out how to use your app. Mobile users are notoriously impatient; if an app confuses them, they will probably move on to something else.
      • Do users understand what they're supposed to do?
      • Have you made the most important features easy to find?
  • Emotional engagement measures the user's motivation to use your app.
    • Are you providing features that users actually want, and have you made it easy to get to them?
    • Do people feel rewarded enough by your app that they want to return?
View EffectiveJava.md
  • Consider static factory methods instead of constructors
    • One advantage of static factory methods is that, unlike constructors, they have names.
    • A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they’re invoked.
    • A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type.
    • A fourth advantage of static factory methods is that they reduce the verbosity of creating parameterized type instances.
    • The main disadvantage of providing only static factory methods is that classes without public or protected constructors cannot be subclassed.
    • A second disadvantage of static factory methods is that they are not readily distinguishable from other static methods.
  • Consider a builder when faced with many constructor parameters
    • The telescoping constructor pattern works, but it is hard to write client code when there are many parameters, and hard
You can’t perform that action at this time.