package de.philipphager.disclosure.feature.navigation;

import android.app.Activity;
import de.philipphager.disclosure.database.app.model.App;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.feature.app.detail.DetailActivity;
import de.philipphager.disclosure.feature.home.HomeActivity;
import de.philipphager.disclosure.feature.library.detail.LibraryOverviewActivity;
import javax.inject.Inject;

public class Navigator {
  private Activity activity;

  @SuppressWarnings("PMD.UnnecessaryConstructor") @Inject public Navigator() {
    // Needed for dagger injection.
  }

  public void setActivity(Activity activity) {
    this.activity = activity;
  }

  public void toHome() {
    activity.startActivity(HomeActivity.launch(activity));
  }

  public void toAppDetail(App app) {
    activity.startActivity(DetailActivity.launch(activity, app));
  }

  public void toLibraryOverview(Library library) {
    activity.startActivity(LibraryOverviewActivity.launch(activity, library));
  }
}

@@ -70,32 +70,121 @@
 d.app.Activity;%0A
+import android.content.Intent;%0Aimport android.net.Uri;%0Aimport android.provider.Settings;%0A
 import de.philip
@@ -1119,11 +1119,441 @@
 y));%0A  %7D
+%0A%0A  public void toAppSystemSettings(String packageName) %7B%0A    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,%0A        Uri.fromParts(%22package%22, packageName, null));%0A    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);%0A    activity.startActivity(intent);%0A  %7D%0A%0A  public void toSystemUpdates() %7B%0A    Intent intent = new Intent(%22android.settings.SYSTEM_UPDATE_SETTINGS%22);%0A    activity.startActivity(intent);%0A  %7D
 %0A%7D%0A

Add navigation to system settings and updates