// Path: app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BaseActivity.java
// public abstract class BaseActivity extends AppCompatActivity implements BaseMvpView {
// 
//   private ActivityFragmentComponent activityFragmentComponent;
//   private Unbinder unbinder;
//   private ProgressDialog progressDialog;
// 
//   @Override protected void attachBaseContext(Context newBase) {
//     super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
//   }
// 
//   @Override public void onCreate(@Nullable Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     activityFragmentComponent = DaggerActivityFragmentComponent.builder()
//         .activityFragmentModule(new ActivityFragmentModule(this))
//         .applicationComponent(WeatherGuruApplication.getApplicationComponent())
//         .build();
//   }
// 
//   public void showBackButton(boolean shouldShow) {
//     if (getSupportActionBar() != null) {
//       Drawable backArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material);
//       backArrow.setColorFilter(ContextCompat.getColor(this, android.R.color.white),
//           PorterDuff.Mode.SRC_ATOP);
//       getSupportActionBar().setHomeAsUpIndicator(backArrow);
//       getSupportActionBar().setHomeButtonEnabled(shouldShow);
//       getSupportActionBar().setDisplayHomeAsUpEnabled(shouldShow);
//     }
//   }
// 
//   public ActivityFragmentComponent getActivityFragmentComponent() {
//     return activityFragmentComponent;
//   }
// 
//   @Override public void showLoading() {
//     hideLoading();
//     progressDialog = AppUtils.showLoadingDialog(this);
//   }
// 
//   @Override public void hideLoading() {
//     if (progressDialog != null && progressDialog.isShowing()) {
//       progressDialog.cancel();
//     }
//   }
// 
//   @Override public void onError(@StringRes int resId) {
//     Toast.makeText(this, getString(resId), Toast.LENGTH_LONG).show();
//   }
// 
//   @Override public void onError(String message) {
//     Toast.makeText(this, message, Toast.LENGTH_LONG).show();
//   }
// 
//   @Override public boolean isNetworkConnected() {
//     return AppUtils.isNetworkAvailable(getApplicationContext());
//   }
// 
//   @Override public void hideKeyboard() {
//     AppUtils.hideKeyboard(this);
//   }
// 
//   public void setUnBinder(Unbinder unBinder) {
//     unbinder = unBinder;
//   }
// 
//   @Override protected void onDestroy() {
//     if (unbinder != null) {
//       unbinder.unbind();
//     }
//     super.onDestroy();
//   }
// 
//   @Override public boolean onOptionsItemSelected(MenuItem item) {
//     switch (item.getItemId()) {
//       case android.R.id.home:
//         onBackPressed();
//         return true;
//     }
//     return super.onOptionsItemSelected(item);
//   }
// 
//   protected abstract void init();
// }


import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.view.inputmethod.InputMethodManager;
import mk.petrovski.weathergurumvp.R;
import mk.petrovski.weathergurumvp.ui.base.BaseActivity;
package mk.petrovski.weathergurumvp.utils;


/**
 * Created by Nikola Petrovski on 2/14/2017.
 */

public class AppUtils {

  /**
   * Check for internet connection
   */
  public static boolean isNetworkAvailable(Context context) {
    ConnectivityManager cm =
        (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
    return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
  }

  /**
   * Show loading progress
   */
  public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();

    if (progressDialog.getWindow() != null) {
      progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.dialog_progress);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);

    return progressDialog;
  }

  /**
   * Hide keyboard
   */
  public static void hideKeyboard(Context context) {
    InputMethodManager inputManager =
        (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (((Activity) context).getCurrentFocus() != null) {
      try {
        inputManager.hideSoftInputFromWindow(
// Path: app/src/main/java/mk/petrovski/weathergurumvp/ui/base/BaseActivity.java
// public abstract class BaseActivity extends AppCompatActivity implements BaseMvpView {
// 
//   private ActivityFragmentComponent activityFragmentComponent;
//   private Unbinder unbinder;
//   private ProgressDialog progressDialog;
// 
//   @Override protected void attachBaseContext(Context newBase) {
//     super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
//   }
// 
//   @Override public void onCreate(@Nullable Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     activityFragmentComponent = DaggerActivityFragmentComponent.builder()
//         .activityFragmentModule(new ActivityFragmentModule(this))
//         .applicationComponent(WeatherGuruApplication.getApplicationComponent())
//         .build();
//   }
// 
//   public void showBackButton(boolean shouldShow) {
//     if (getSupportActionBar() != null) {
//       Drawable backArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material);
//       backArrow.setColorFilter(ContextCompat.getColor(this, android.R.color.white),
//           PorterDuff.Mode.SRC_ATOP);
//       getSupportActionBar().setHomeAsUpIndicator(backArrow);
//       getSupportActionBar().setHomeButtonEnabled(shouldShow);
//       getSupportActionBar().setDisplayHomeAsUpEnabled(shouldShow);
//     }
//   }
// 
//   public ActivityFragmentComponent getActivityFragmentComponent() {
//     return activityFragmentComponent;
//   }
// 
//   @Override public void showLoading() {
//     hideLoading();
//     progressDialog = AppUtils.showLoadingDialog(this);
//   }
// 
//   @Override public void hideLoading() {
//     if (progressDialog != null && progressDialog.isShowing()) {
//       progressDialog.cancel();
//     }
//   }
// 
//   @Override public void onError(@StringRes int resId) {
//     Toast.makeText(this, getString(resId), Toast.LENGTH_LONG).show();
//   }
// 
//   @Override public void onError(String message) {
//     Toast.makeText(this, message, Toast.LENGTH_LONG).show();
//   }
// 
//   @Override public boolean isNetworkConnected() {
//     return AppUtils.isNetworkAvailable(getApplicationContext());
//   }
// 
//   @Override public void hideKeyboard() {
//     AppUtils.hideKeyboard(this);
//   }
// 
//   public void setUnBinder(Unbinder unBinder) {
//     unbinder = unBinder;
//   }
// 
//   @Override protected void onDestroy() {
//     if (unbinder != null) {
//       unbinder.unbind();
//     }
//     super.onDestroy();
//   }
// 
//   @Override public boolean onOptionsItemSelected(MenuItem item) {
//     switch (item.getItemId()) {
//       case android.R.id.home:
//         onBackPressed();
//         return true;
//     }
//     return super.onOptionsItemSelected(item);
//   }
// 
//   protected abstract void init();
// }


// Path: app/src/main/java/mk/petrovski/weathergurumvp/utils/AppUtils.java
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.view.inputmethod.InputMethodManager;
import mk.petrovski.weathergurumvp.R;
import mk.petrovski.weathergurumvp.ui.base.BaseActivity;

package mk.petrovski.weathergurumvp.utils;


/**
 * Created by Nikola Petrovski on 2/14/2017.
 */

public class AppUtils {

  /**
   * Check for internet connection
   */
  public static boolean isNetworkAvailable(Context context) {
    ConnectivityManager cm =
        (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
    return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
  }

  /**
   * Show loading progress
   */
  public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();

    if (progressDialog.getWindow() != null) {
      progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.dialog_progress);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);

    return progressDialog;
  }

  /**
   * Hide keyboard
   */
  public static void hideKeyboard(Context context) {
    InputMethodManager inputManager =
        (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (((Activity) context).getCurrentFocus() != null) {
      try {
        inputManager.hideSoftInputFromWindow(
            ((BaseActivity) context).getCurrentFocus().getWindowToken(), 0);