-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* design improvements
- Loading branch information
Showing
28 changed files
with
381 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
app/src/androidTest/java/io/stanwood/framework/dialog/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/src/main/java/io/stanwood/framework/demo/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.stanwood.framework.demo; | ||
|
||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import javax.inject.Inject; | ||
|
||
import dagger.android.AndroidInjection; | ||
import io.stanwood.framework.dialog.RatingDialog; | ||
import io.stanwood.framework.dialog.RatingService; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Inject | ||
RatingService ratingService; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
AndroidInjection.inject(this); | ||
|
||
setContentView(R.layout.activity_main); | ||
if (ratingService.shouldBeDisplayed()) { | ||
RatingDialog.builder() | ||
.setParagraph1("Hi,\nI'm the developer of this app.") | ||
.setParagraph2("Developers like me live on good ratings in Google Play.") | ||
.setParagraph3("If you like the app, please rate it.") | ||
.setParagraph4("It takes only 1 minute.") | ||
.setCancelText("Cancel") | ||
.setOkText("Ok") | ||
.setBannerUrl("https://media.istockphoto.com/photos/plitvice-lakes-picture-id500463760?s=2048x2048") | ||
.setBannerUrl("https://www.istockphoto.com/photo/mountain-landscape-gm517188688-89380423") | ||
.setFaceUrl("https://lh5.googleusercontent.com/-_w2wo1s6SkI/AAAAAAAAAAI/AAAAAAAAhMU/s78iSxXwVZk/photo.jpg") | ||
.build() | ||
.show(getSupportFragmentManager(), "dialog"); | ||
} | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
super.onResume(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.stanwood.framework.demo; | ||
|
||
import android.app.Activity; | ||
import android.app.Application; | ||
|
||
import javax.inject.Inject; | ||
|
||
import dagger.android.DispatchingAndroidInjector; | ||
import dagger.android.HasActivityInjector; | ||
import io.stanwood.framework.demo.di.DaggerAppComponent; | ||
import io.stanwood.framework.dialog.RatingService; | ||
|
||
public class MyApp extends Application implements HasActivityInjector { | ||
@Inject | ||
DispatchingAndroidInjector<Activity> dispatchingAndroidInjector; | ||
|
||
@Inject | ||
RatingService ratingService; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
DaggerAppComponent.builder().application(this).build().inject(this); | ||
ratingService.setLaunchTimes(2); | ||
} | ||
|
||
@Override | ||
public DispatchingAndroidInjector<Activity> activityInjector() { | ||
return dispatchingAndroidInjector; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/io/stanwood/framework/demo/di/AppComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.stanwood.framework.demo.di; | ||
|
||
import android.app.Application; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.BindsInstance; | ||
import dagger.Component; | ||
import dagger.android.AndroidInjectionModule; | ||
import io.stanwood.framework.demo.MyApp; | ||
|
||
@Singleton | ||
@Component(modules = { | ||
AndroidInjectionModule.class, | ||
AppModule.class, | ||
MainActivityModule.class | ||
}) | ||
public interface AppComponent { | ||
void inject(MyApp application); | ||
|
||
@Component.Builder | ||
interface Builder { | ||
@BindsInstance | ||
Builder application(Application application); | ||
|
||
AppComponent build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/io/stanwood/framework/demo/di/AppModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.stanwood.framework.demo.di; | ||
|
||
import android.app.Application; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import io.stanwood.framework.dialog.RatingService; | ||
|
||
@Module | ||
class AppModule { | ||
|
||
@Singleton | ||
@Provides | ||
RatingService provideRatingService(Application context) { | ||
return new RatingService(context); | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/io/stanwood/framework/demo/di/MainActivityModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.stanwood.framework.demo.di; | ||
|
||
import dagger.Module; | ||
import dagger.android.ContributesAndroidInjector; | ||
import io.stanwood.framework.demo.MainActivity; | ||
|
||
@Module | ||
public abstract class MainActivityModule { | ||
|
||
@ContributesAndroidInjector | ||
abstract MainActivity contributeMainActivity(); | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
...dialog/glide/ImageRequestGlideModule.java → ...k/demo/glide/ImageRequestGlideModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
app/src/main/java/io/stanwood/framework/dialog/MainActivity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="io.stanwood.framework.dialog.MainActivity"> | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Hello World!" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
android:text="Hello World!" /> | ||
|
||
</android.support.constraint.ConstraintLayout> | ||
<ImageView | ||
android:id="@+id/img" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
app/src/test/java/io/stanwood/framework/dialog/ExampleUnitTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.