Skip to content

Instantly share code, notes, and snippets.

View lawloretienne's full-sized avatar
💭
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
View GitHub Profile
object EmailUtils {
fun getEmailIntent(context: Context): Intent {
val intent = Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"))
val bodyText = getEmailBody(context)
val emailAddy = EMAIL_SUPPORT
val subject = context.resources.getString(R.string.email_subject)
intent.putExtra(Intent.EXTRA_EMAIL, arrayOf(emailAddy))
intent.putExtra(Intent.EXTRA_SUBJECT, subject)
intent.putExtra(Intent.EXTRA_TEXT, bodyText)
return intent
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 */
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);
}

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
public class MoviesFragment extends BaseFragment {
// region Member Variables
private CompositeSubscription compositeSubscription;
// endregion
// region Lifecycle Methods
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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);
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();
  • 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
  • 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?