Skip to content

Commit

Permalink
Merge pull request artem-zinnatullin#150 from lenguyenthanh/change-qu…
Browse files Browse the repository at this point in the history
…alityMattersApp-to-application-name

Update variables name
  • Loading branch information
artem-zinnatullin committed Apr 1, 2016
2 parents 2512550 + b304e43 commit 83557ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class DeveloperSettingsModelImpl implements DeveloperSettingsModel {

@NonNull
private final Application qualityMattersApp;
private final Application application;

@NonNull
private final DeveloperSettings developerSettings;
Expand All @@ -43,12 +43,12 @@ public class DeveloperSettingsModelImpl implements DeveloperSettingsModel {
@NonNull
private AtomicBoolean tinyDancerDisplayed = new AtomicBoolean();

public DeveloperSettingsModelImpl(@NonNull Application qualityMattersApp,
public DeveloperSettingsModelImpl(@NonNull Application application,
@NonNull DeveloperSettings developerSettings,
@NonNull HttpLoggingInterceptor httpLoggingInterceptor,
@NonNull LeakCanaryProxy leakCanaryProxy,
@NonNull Paperwork paperwork) {
this.qualityMattersApp = qualityMattersApp;
this.application = application;
this.developerSettings = developerSettings;
this.httpLoggingInterceptor = httpLoggingInterceptor;
this.leakCanaryProxy = leakCanaryProxy;
Expand Down Expand Up @@ -117,7 +117,7 @@ public void apply() {
// Stetho can not be enabled twice.
if (stethoAlreadyEnabled.compareAndSet(false, true)) {
if (isStethoEnabled()) {
Stetho.initializeWithDefaults(qualityMattersApp);
Stetho.initializeWithDefaults(application);
}
}

Expand All @@ -129,18 +129,18 @@ public void apply() {
}

if (isTinyDancerEnabled() && tinyDancerDisplayed.compareAndSet(false, true)) {
final DisplayMetrics displayMetrics = qualityMattersApp.getResources().getDisplayMetrics();
final DisplayMetrics displayMetrics = application.getResources().getDisplayMetrics();

TinyDancer.create()
.redFlagPercentage(0.2f)
.yellowFlagPercentage(0.05f)
.startingGravity(TOP | START)
.startingXPosition(displayMetrics.widthPixels / 10)
.startingYPosition(displayMetrics.heightPixels / 4)
.show(qualityMattersApp);
.show(application);
} else if (tinyDancerDisplayed.compareAndSet(true, false)) {
try {
TinyDancer.hide(qualityMattersApp);
TinyDancer.hide(application);
} catch (Exception e) {
// In some cases TinyDancer can not be hidden without exception: for example when you start it first time on Android 6.
Timber.e(e, "Can not hide TinyDancer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,34 @@ public DeveloperSettingsModel provideDeveloperSettingsModel(@NonNull DeveloperSe
@Provides
@NonNull
@Singleton
public DeveloperSettings provideDeveloperSettings(@NonNull Application qualityMattersApp) {
return new DeveloperSettings(qualityMattersApp.getSharedPreferences("developer_settings", MODE_PRIVATE));
public DeveloperSettings provideDeveloperSettings(@NonNull Application application) {
return new DeveloperSettings(application.getSharedPreferences("developer_settings", MODE_PRIVATE));
}

@Provides
@NonNull
@Singleton
public LeakCanaryProxy provideLeakCanaryProxy(@NonNull Application qualityMattersApp) {
return new LeakCanaryProxyImpl(qualityMattersApp);
public LeakCanaryProxy provideLeakCanaryProxy(@NonNull Application application) {
return new LeakCanaryProxyImpl(application);
}

@Provides
@NonNull
@Singleton
public Paperwork providePaperwork(@NonNull Application qualityMattersApp) {
return new Paperwork(qualityMattersApp);
public Paperwork providePaperwork(@NonNull Application application) {
return new Paperwork(application);
}

// We will use this concrete type for debug code, but main code will see only DeveloperSettingsModel interface.
@Provides
@NonNull
@Singleton
public DeveloperSettingsModelImpl provideDeveloperSettingsModelImpl(@NonNull Application qualityMattersApp,
public DeveloperSettingsModelImpl provideDeveloperSettingsModelImpl(@NonNull Application application,
@NonNull DeveloperSettings developerSettings,
@NonNull HttpLoggingInterceptor httpLoggingInterceptor,
@NonNull LeakCanaryProxy leakCanaryProxy,
@NonNull Paperwork paperwork) {
return new DeveloperSettingsModelImpl(qualityMattersApp, developerSettings, httpLoggingInterceptor, leakCanaryProxy, paperwork);
return new DeveloperSettingsModelImpl(application, developerSettings, httpLoggingInterceptor, leakCanaryProxy, paperwork);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public class ApplicationModule {
public static final String MAIN_THREAD_HANDLER = "main_thread_handler";

@NonNull
private final Application qualityMattersApp;
private final Application application;

public ApplicationModule(@NonNull Application qualityMattersApp) {
this.qualityMattersApp = qualityMattersApp;
public ApplicationModule(@NonNull Application application) {
this.application = application;
}

@Provides @NonNull @Singleton
public Application provideQualityMattersApp() {
return qualityMattersApp;
return application;
}

@Provides @NonNull @Singleton
Expand Down

0 comments on commit 83557ef

Please sign in to comment.