-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aaron Huttner
authored and
Aaron Huttner
committed
Jul 15, 2016
1 parent
2d3958d
commit 0ccabef
Showing
13 changed files
with
248 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
13 changes: 13 additions & 0 deletions
13
app/src/internalRelease/java/com/rockthevote/grommet/InternalReleaseGrommetModule.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 com.rockthevote.grommet; | ||
|
||
import com.rockthevote.grommet.ui.InternalReleaseUiModule; | ||
|
||
import dagger.Module; | ||
|
||
@Module( | ||
addsTo = GrommetModule.class, | ||
includes = InternalReleaseUiModule.class, | ||
overrides = true | ||
) | ||
public final class InternalReleaseGrommetModule { | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/internalRelease/java/com/rockthevote/grommet/Modules.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,14 @@ | ||
package com.rockthevote.grommet; | ||
|
||
final class Modules { | ||
static Object[] list(GrommetApp app) { | ||
return new Object[]{ | ||
new GrommetModule(app), | ||
new InternalReleaseGrommetModule() | ||
}; | ||
} | ||
|
||
private Modules() { | ||
// No instances. | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/internalRelease/java/com/rockthevote/grommet/ui/InternalReleaseUiModule.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,17 @@ | ||
package com.rockthevote.grommet.ui; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import javax.inject.Singleton; | ||
|
||
@Module( | ||
overrides = true, | ||
library = true, | ||
complete = false | ||
) | ||
public final class InternalReleaseUiModule { | ||
@Provides @Singleton ViewContainer provideViewContainer( | ||
TelescopeViewContainer telescopeViewContainer) { | ||
return telescopeViewContainer; | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
app/src/internalRelease/java/com/rockthevote/grommet/ui/TelescopeViewContainer.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,93 @@ | ||
package com.rockthevote.grommet.ui; | ||
|
||
import android.app.Activity; | ||
import android.support.v7.app.AlertDialog; | ||
import android.content.Context; | ||
import android.view.ContextThemeWrapper; | ||
import android.view.Gravity; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Toast; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
|
||
import com.f2prateek.rx.preferences.Preference; | ||
import com.f2prateek.rx.preferences.RxSharedPreferences; | ||
|
||
import com.mattprecious.telescope.Lens; | ||
import com.mattprecious.telescope.TelescopeLayout; | ||
import com.rockthevote.grommet.R; | ||
import com.rockthevote.grommet.data.LumberYard; | ||
import com.rockthevote.grommet.ui.bugreport.BugReportLens; | ||
|
||
import java.io.File; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
public final class TelescopeViewContainer implements ViewContainer { | ||
private final LumberYard lumberYard; | ||
private final Preference<Boolean> seenTelescopeDialog; | ||
|
||
@Inject | ||
public TelescopeViewContainer(LumberYard lumberYard, RxSharedPreferences preferences) { | ||
this.lumberYard = lumberYard; | ||
this.seenTelescopeDialog = preferences.getBoolean("internal-seen-telescope-dialog", false); | ||
} | ||
|
||
@BindView(R.id.telescope_container) TelescopeLayout telescopeLayout; | ||
|
||
@Override | ||
public ViewGroup forActivity(final Activity activity) { | ||
activity.setContentView(R.layout.internal_activity_frame); | ||
ButterKnife.bind(this, activity); | ||
|
||
TelescopeLayout.cleanUp(activity); // Clean up any old screenshots. | ||
telescopeLayout.setLens(new BugReportLens(activity, lumberYard)); | ||
|
||
// If you have not seen the telescope dialog before, show it. | ||
if (!seenTelescopeDialog.get()) { | ||
telescopeLayout.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
if (activity.isFinishing()) { | ||
return; | ||
} | ||
|
||
seenTelescopeDialog.set(true); | ||
showTelescopeDialog(activity); | ||
} | ||
}, 1000); | ||
} | ||
|
||
return telescopeLayout; | ||
} | ||
|
||
public void showTelescopeDialog(final Activity activity) { | ||
LayoutInflater inflater = LayoutInflater.from(activity); | ||
TelescopeLayout content = | ||
(TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null); | ||
final AlertDialog dialog = | ||
new AlertDialog.Builder(activity).setView(content).setCancelable(false).create(); | ||
|
||
content.setLens(new Lens() { | ||
@Override | ||
public void onCapture(File file) { | ||
dialog.dismiss(); | ||
|
||
Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog); | ||
LayoutInflater toastInflater = LayoutInflater.from(toastContext); | ||
Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT); | ||
View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null); | ||
toast.setView(toastView); | ||
toast.setGravity(Gravity.CENTER, 0, 0); | ||
toast.show(); | ||
} | ||
}); | ||
|
||
dialog.show(); | ||
} | ||
} |
Binary file added
BIN
+16.3 KB
app/src/internalRelease/res/drawable-xxhdpi/telescope_tutorial_thumbs_up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.5 KB
app/src/internalRelease/res/drawable-xxhdpi/telescope_tutorial_two_finger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
app/src/internalRelease/res/layout/internal_activity_frame.xml
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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<com.mattprecious.telescope.TelescopeLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/telescope_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:progressColor="@color/bugreport_frame" | ||
/> |
51 changes: 51 additions & 0 deletions
51
app/src/internalRelease/res/layout/telescope_tutorial_dialog.xml
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,51 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<com.mattprecious.telescope.TelescopeLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:progressColor="@color/bugreport_frame" | ||
> | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="56dp" | ||
android:gravity="center" | ||
android:text="Quick & Easy Bug Reports!" | ||
android:textSize="20sp" | ||
android:textStyle="bold" | ||
android:background="@color/colorAccent" | ||
android:textColor="@color/colorSecondaryText" | ||
/> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="16dp" | ||
android:gravity="center" | ||
android:text="Found a bug? Report it!\n\nPress and hold two fingers on the screen to launch the reporting dialog." | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:textSize="15sp" | ||
/> | ||
<ImageView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:src="@drawable/telescope_tutorial_two_finger" | ||
/> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="16dp" | ||
android:gravity="center" | ||
android:text="Try it out to continue." | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:textSize="15sp" | ||
android:textStyle="bold" | ||
/> | ||
</LinearLayout> | ||
</com.mattprecious.telescope.TelescopeLayout> |
24 changes: 24 additions & 0 deletions
24
app/src/internalRelease/res/layout/telescope_tutorial_toast.xml
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,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:background="?android:attr/windowBackground" | ||
android:gravity="center_horizontal" | ||
> | ||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="16dp" | ||
android:text="Perfect!" | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:textSize="20sp" | ||
/> | ||
<ImageView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/telescope_tutorial_thumbs_up" | ||
/> | ||
</LinearLayout> |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="application_name">Grommet Sample Internal Release</string> | ||
<string name="launcher_name">Grommet Internal (R)</string> | ||
</resources> |