// Path: example/src/main/java/net/skoumal/forceupdate/example/ExampleApp.java
// public class ExampleApp extends Application {
// 
//     private final static boolean SHOW_CUSTOM_FORCED_VIEW = false;
// 
//     private static ExampleApp instance;
// 
//     private VersionProvider currentVersionProvider;
//     private SharedPreferencesVersionProvider minAllowedVersionProvider;
//     private SharedPreferencesVersionProvider recommendedVersionProvider;
//     private SharedPreferencesVersionProvider excludedVersionProvider;
// 
//     private ForceUpdate forceUpdate;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         instance = this;
// 
//         SharedPreferences preferences = getSharedPreferences(Constants.SHARED_PREFERENCES_VERSIONS,
//                 MODE_PRIVATE);
// 
//         /*
//             -- Current version --
// 
//             The simples way to provide current version is via ApkVersionProvider, but you can
//             implement your own provider of course.
//           */
//         currentVersionProvider = new ApkVersionProvider(this);
// 
//         /*
//             -- Min allowed and recommended version --
// 
//             For this example purposes we use SharedPreferencesVersionProvider to fake min-allowed
//             and recommended version. It is also great example of custom VersionProvider, but for
//             real world purposes see use one of ready-to-use VersionProviders, or implement your own:
// 
//             https://github.com/skoumalcz/force-update/blob/master/doc/VersionProviders.md
//          */
//         Version defaultVersion = currentVersionProvider.getVersionResult().getVersion(); // default version when SharedPreferences are empty
//         minAllowedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_MIN_ALLOWED_VERSION, defaultVersion);
//         recommendedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_RECOMMENDED_VERSION, defaultVersion);
// 
//         /*
//             -- Excluded version --
// 
//             To ban particular version we also use SharedPreferencesVersionProvider to fake it.
//          */
//         int [] apkVersionParts = currentVersionProvider.getVersionResult().getVersion().getVersionParts();
//         Versions.decrementVersion(apkVersionParts);
//         excludedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_EXCLUDED_VERSION, new Version(apkVersionParts));
// 
//         ForceUpdate.Builder builder = new ForceUpdate.Builder()
//                 .application(this)
//                 .debug(true)
//                 .currentVersionProvider(currentVersionProvider)
//                 .minAllowedVersionProvider(minAllowedVersionProvider)
//                 .recommendedVersionProvider(recommendedVersionProvider)
//                 .excludedVersionListProvider(excludedVersionProvider)
//                 .minAllowedVersionCheckMinInterval(1)
//                 .recommendedVersionCheckMinInterval(1)
//                 .excludedVersionListCheckMinInterval(1)
//                 .forcedUpdateView(new ActivityUpdateView(ResetVersionsForceUpdateActivity.class))
//                 .recommendedUpdateView(new ActivityUpdateView(RecommendedUpdateActivity.class));
// 
//         if (SHOW_CUSTOM_FORCED_VIEW) {
//             //here you can show your custom activity or just exclude forcedUpdateView function to use default activity
//             builder.addForceUpdateActivity(CustomForceUpdateActivity.class);
//             builder.forcedUpdateView(new UpdateView() {
//                 @Override
//                 public void showView(Activity gActivity, Version gCurrentVersion, Version gRequiredVersion, String gUpdateMessage) {
//                     CustomForceUpdateActivity.start(gActivity, gCurrentVersion.toString(), gRequiredVersion.toString(), gUpdateMessage);
//                 }
//             });
//         }
// 
//         forceUpdate = builder.buildAndInit();
//     }
// 
//     public static ExampleApp getInstance() {
//         return instance;
//     }
// 
//     public VersionProvider getCurrentVersionProvider() {
//         return currentVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getMinAllowedVersionProvider() {
//         return minAllowedVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getRecommendedVersionProvider() {
//         return recommendedVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getExcludedVersionProvider() {
//         return excludedVersionProvider;
//     }
// 
//     public ForceUpdate getForceUpdate() {
//         return forceUpdate;
//     }
// }
// 
// Path: force-update/src/main/java/net/skoumal/forceupdate/view/activity/ForceUpdateActivity.java
// public class ForceUpdateActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         onCreate(savedInstanceState, R.style.NoActionBarTheme);
// 
//     }
// 
//     public void onCreate(Bundle savedInstanceState, int gTheme) {
//         super.onCreate(savedInstanceState);
// 
//         setTheme(gTheme);
// 
//         setContentView(R.layout.force_update_activity);
// 
//         findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 openGooglePlay();
//             }
//         });
//     }
// 
// 
//     public void openGooglePlay() {
//         GooglePlay.openAppDetail(this);
//     }
// 
//     public static void start(Activity gActivity) {
//         Intent starter = new Intent(gActivity, ForceUpdateActivity.class);
//         gActivity.startActivity(starter);
//     }
// }


import android.os.Bundle;
import android.view.View;
import com.jakewharton.processphoenix.ProcessPhoenix;
import net.skoumal.forceupdate.example.ExampleApp;
import net.skoumal.forceupdate.view.activity.ForceUpdateActivity;

package net.skoumal.forceupdate.example.activites;




/**
 * Created by gingo on 3.1.2017.
 */
public class ResetVersionsRecommendedUpdateActivity extends ForceUpdateActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        findViewById(net.skoumal.forceupdate.R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

// Path: example/src/main/java/net/skoumal/forceupdate/example/ExampleApp.java
// public class ExampleApp extends Application {
// 
//     private final static boolean SHOW_CUSTOM_FORCED_VIEW = false;
// 
//     private static ExampleApp instance;
// 
//     private VersionProvider currentVersionProvider;
//     private SharedPreferencesVersionProvider minAllowedVersionProvider;
//     private SharedPreferencesVersionProvider recommendedVersionProvider;
//     private SharedPreferencesVersionProvider excludedVersionProvider;
// 
//     private ForceUpdate forceUpdate;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         instance = this;
// 
//         SharedPreferences preferences = getSharedPreferences(Constants.SHARED_PREFERENCES_VERSIONS,
//                 MODE_PRIVATE);
// 
//         /*
//             -- Current version --
// 
//             The simples way to provide current version is via ApkVersionProvider, but you can
//             implement your own provider of course.
//           */
//         currentVersionProvider = new ApkVersionProvider(this);
// 
//         /*
//             -- Min allowed and recommended version --
// 
//             For this example purposes we use SharedPreferencesVersionProvider to fake min-allowed
//             and recommended version. It is also great example of custom VersionProvider, but for
//             real world purposes see use one of ready-to-use VersionProviders, or implement your own:
// 
//             https://github.com/skoumalcz/force-update/blob/master/doc/VersionProviders.md
//          */
//         Version defaultVersion = currentVersionProvider.getVersionResult().getVersion(); // default version when SharedPreferences are empty
//         minAllowedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_MIN_ALLOWED_VERSION, defaultVersion);
//         recommendedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_RECOMMENDED_VERSION, defaultVersion);
// 
//         /*
//             -- Excluded version --
// 
//             To ban particular version we also use SharedPreferencesVersionProvider to fake it.
//          */
//         int [] apkVersionParts = currentVersionProvider.getVersionResult().getVersion().getVersionParts();
//         Versions.decrementVersion(apkVersionParts);
//         excludedVersionProvider = new SharedPreferencesVersionProvider(preferences, Constants.SHARED_PREFERENCES_EXCLUDED_VERSION, new Version(apkVersionParts));
// 
//         ForceUpdate.Builder builder = new ForceUpdate.Builder()
//                 .application(this)
//                 .debug(true)
//                 .currentVersionProvider(currentVersionProvider)
//                 .minAllowedVersionProvider(minAllowedVersionProvider)
//                 .recommendedVersionProvider(recommendedVersionProvider)
//                 .excludedVersionListProvider(excludedVersionProvider)
//                 .minAllowedVersionCheckMinInterval(1)
//                 .recommendedVersionCheckMinInterval(1)
//                 .excludedVersionListCheckMinInterval(1)
//                 .forcedUpdateView(new ActivityUpdateView(ResetVersionsForceUpdateActivity.class))
//                 .recommendedUpdateView(new ActivityUpdateView(RecommendedUpdateActivity.class));
// 
//         if (SHOW_CUSTOM_FORCED_VIEW) {
//             //here you can show your custom activity or just exclude forcedUpdateView function to use default activity
//             builder.addForceUpdateActivity(CustomForceUpdateActivity.class);
//             builder.forcedUpdateView(new UpdateView() {
//                 @Override
//                 public void showView(Activity gActivity, Version gCurrentVersion, Version gRequiredVersion, String gUpdateMessage) {
//                     CustomForceUpdateActivity.start(gActivity, gCurrentVersion.toString(), gRequiredVersion.toString(), gUpdateMessage);
//                 }
//             });
//         }
// 
//         forceUpdate = builder.buildAndInit();
//     }
// 
//     public static ExampleApp getInstance() {
//         return instance;
//     }
// 
//     public VersionProvider getCurrentVersionProvider() {
//         return currentVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getMinAllowedVersionProvider() {
//         return minAllowedVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getRecommendedVersionProvider() {
//         return recommendedVersionProvider;
//     }
// 
//     public SharedPreferencesVersionProvider getExcludedVersionProvider() {
//         return excludedVersionProvider;
//     }
// 
//     public ForceUpdate getForceUpdate() {
//         return forceUpdate;
//     }
// }
// 
// Path: force-update/src/main/java/net/skoumal/forceupdate/view/activity/ForceUpdateActivity.java
// public class ForceUpdateActivity extends Activity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         onCreate(savedInstanceState, R.style.NoActionBarTheme);
// 
//     }
// 
//     public void onCreate(Bundle savedInstanceState, int gTheme) {
//         super.onCreate(savedInstanceState);
// 
//         setTheme(gTheme);
// 
//         setContentView(R.layout.force_update_activity);
// 
//         findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 openGooglePlay();
//             }
//         });
//     }
// 
// 
//     public void openGooglePlay() {
//         GooglePlay.openAppDetail(this);
//     }
// 
//     public static void start(Activity gActivity) {
//         Intent starter = new Intent(gActivity, ForceUpdateActivity.class);
//         gActivity.startActivity(starter);
//     }
// }


// Path: example/src/main/java/net/skoumal/forceupdate/example/activites/ResetVersionsRecommendedUpdateActivity.java
import android.os.Bundle;
import android.view.View;
import com.jakewharton.processphoenix.ProcessPhoenix;
import net.skoumal.forceupdate.example.ExampleApp;
import net.skoumal.forceupdate.view.activity.ForceUpdateActivity;

package net.skoumal.forceupdate.example.activites;




/**
 * Created by gingo on 3.1.2017.
 */
public class ResetVersionsRecommendedUpdateActivity extends ForceUpdateActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        findViewById(net.skoumal.forceupdate.R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                ExampleApp.getInstance().getMinAllowedVersionProvider().resetVersion();
