Skip to content

Commit 0ccabef

Browse files
Aaron HuttnerAaron Huttner
authored andcommitted
update code for alpha
1 parent 2d3958d commit 0ccabef

13 files changed

Lines changed: 248 additions & 7 deletions
2.7 MB
Binary file not shown.

app/app-internal-release.apk

2.7 MB
Binary file not shown.

app/build.gradle

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,22 @@ android {
3737
compileSdkVersion 24
3838
buildToolsVersion "23.0.3"
3939

40-
// signingConfigs {
41-
// grommet {
42-
//
43-
// }
44-
// }
40+
signingConfigs {
41+
grommet {
42+
storeFile file('../keys/grommet.keystore')
43+
storePassword System.env['KEYSTORE_PASSWORD']
44+
keyAlias 'grommetKey'
45+
keyPassword System.env['KEY_PASSWORD']
46+
}
47+
debug {
48+
storeFile file('../keys/debug.keystore')
49+
storePassword 'android'
50+
keyAlias 'grommetDebugKey'
51+
keyPassword 'android'
52+
}
53+
}
4554

4655
defaultConfig {
47-
applicationId "com.rockthevote.grommet"
4856
minSdkVersion 21
4957
targetSdkVersion 24
5058

@@ -53,11 +61,18 @@ android {
5361

5462
buildConfigField 'String', 'GIT_SHA', "\"${gitSha()}\""
5563
buildConfigField 'long', 'GIT_TIMESTAMP', "${gitTimestamp()}L"
64+
65+
signingConfig signingConfigs.grommet
5666
}
5767

5868
buildTypes {
5969
debug {
6070
applicationIdSuffix '.debug'
71+
signingConfig signingConfigs.debug
72+
minifyEnabled false
73+
}
74+
release{
75+
minifyEnabled false
6176
}
6277
}
6378

@@ -144,7 +159,6 @@ dependencies {
144159

145160
internalCompile 'com.mattprecious.telescope:telescope:1.5.0@aar'
146161

147-
// retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'
148162

149163
androidTestCompile 'junit:junit:4.12'
150164
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.rockthevote.grommet;
2+
3+
import com.rockthevote.grommet.ui.InternalReleaseUiModule;
4+
5+
import dagger.Module;
6+
7+
@Module(
8+
addsTo = GrommetModule.class,
9+
includes = InternalReleaseUiModule.class,
10+
overrides = true
11+
)
12+
public final class InternalReleaseGrommetModule {
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.rockthevote.grommet;
2+
3+
final class Modules {
4+
static Object[] list(GrommetApp app) {
5+
return new Object[]{
6+
new GrommetModule(app),
7+
new InternalReleaseGrommetModule()
8+
};
9+
}
10+
11+
private Modules() {
12+
// No instances.
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.rockthevote.grommet.ui;
2+
3+
import dagger.Module;
4+
import dagger.Provides;
5+
import javax.inject.Singleton;
6+
7+
@Module(
8+
overrides = true,
9+
library = true,
10+
complete = false
11+
)
12+
public final class InternalReleaseUiModule {
13+
@Provides @Singleton ViewContainer provideViewContainer(
14+
TelescopeViewContainer telescopeViewContainer) {
15+
return telescopeViewContainer;
16+
}
17+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package com.rockthevote.grommet.ui;
2+
3+
import android.app.Activity;
4+
import android.support.v7.app.AlertDialog;
5+
import android.content.Context;
6+
import android.view.ContextThemeWrapper;
7+
import android.view.Gravity;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
import android.widget.Toast;
12+
13+
import butterknife.BindView;
14+
import butterknife.ButterKnife;
15+
16+
import com.f2prateek.rx.preferences.Preference;
17+
import com.f2prateek.rx.preferences.RxSharedPreferences;
18+
19+
import com.mattprecious.telescope.Lens;
20+
import com.mattprecious.telescope.TelescopeLayout;
21+
import com.rockthevote.grommet.R;
22+
import com.rockthevote.grommet.data.LumberYard;
23+
import com.rockthevote.grommet.ui.bugreport.BugReportLens;
24+
25+
import java.io.File;
26+
27+
import javax.inject.Inject;
28+
import javax.inject.Singleton;
29+
30+
@Singleton
31+
public final class TelescopeViewContainer implements ViewContainer {
32+
private final LumberYard lumberYard;
33+
private final Preference<Boolean> seenTelescopeDialog;
34+
35+
@Inject
36+
public TelescopeViewContainer(LumberYard lumberYard, RxSharedPreferences preferences) {
37+
this.lumberYard = lumberYard;
38+
this.seenTelescopeDialog = preferences.getBoolean("internal-seen-telescope-dialog", false);
39+
}
40+
41+
@BindView(R.id.telescope_container) TelescopeLayout telescopeLayout;
42+
43+
@Override
44+
public ViewGroup forActivity(final Activity activity) {
45+
activity.setContentView(R.layout.internal_activity_frame);
46+
ButterKnife.bind(this, activity);
47+
48+
TelescopeLayout.cleanUp(activity); // Clean up any old screenshots.
49+
telescopeLayout.setLens(new BugReportLens(activity, lumberYard));
50+
51+
// If you have not seen the telescope dialog before, show it.
52+
if (!seenTelescopeDialog.get()) {
53+
telescopeLayout.postDelayed(new Runnable() {
54+
@Override
55+
public void run() {
56+
if (activity.isFinishing()) {
57+
return;
58+
}
59+
60+
seenTelescopeDialog.set(true);
61+
showTelescopeDialog(activity);
62+
}
63+
}, 1000);
64+
}
65+
66+
return telescopeLayout;
67+
}
68+
69+
public void showTelescopeDialog(final Activity activity) {
70+
LayoutInflater inflater = LayoutInflater.from(activity);
71+
TelescopeLayout content =
72+
(TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null);
73+
final AlertDialog dialog =
74+
new AlertDialog.Builder(activity).setView(content).setCancelable(false).create();
75+
76+
content.setLens(new Lens() {
77+
@Override
78+
public void onCapture(File file) {
79+
dialog.dismiss();
80+
81+
Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
82+
LayoutInflater toastInflater = LayoutInflater.from(toastContext);
83+
Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
84+
View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
85+
toast.setView(toastView);
86+
toast.setGravity(Gravity.CENTER, 0, 0);
87+
toast.show();
88+
}
89+
});
90+
91+
dialog.show();
92+
}
93+
}
16.3 KB
Loading
17.5 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<com.mattprecious.telescope.TelescopeLayout
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
6+
android:id="@+id/telescope_container"
7+
android:layout_width="match_parent"
8+
android:layout_height="match_parent"
9+
app:progressColor="@color/bugreport_frame"
10+
/>

0 commit comments

Comments
 (0)