Skip to content

Commit

Permalink
update code for alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Huttner authored and Aaron Huttner committed Jul 15, 2016
1 parent 2d3958d commit 0ccabef
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 7 deletions.
Binary file added app/app-internal-release-unaligned.apk
Binary file not shown.
Binary file added app/app-internal-release.apk
Binary file not shown.
28 changes: 21 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ android {
compileSdkVersion 24
buildToolsVersion "23.0.3"

// signingConfigs {
// grommet {
//
// }
// }
signingConfigs {
grommet {
storeFile file('../keys/grommet.keystore')
storePassword System.env['KEYSTORE_PASSWORD']
keyAlias 'grommetKey'
keyPassword System.env['KEY_PASSWORD']
}
debug {
storeFile file('../keys/debug.keystore')
storePassword 'android'
keyAlias 'grommetDebugKey'
keyPassword 'android'
}
}

defaultConfig {
applicationId "com.rockthevote.grommet"
minSdkVersion 21
targetSdkVersion 24

Expand All @@ -53,11 +61,18 @@ android {

buildConfigField 'String', 'GIT_SHA', "\"${gitSha()}\""
buildConfigField 'long', 'GIT_TIMESTAMP', "${gitTimestamp()}L"

signingConfig signingConfigs.grommet
}

buildTypes {
debug {
applicationIdSuffix '.debug'
signingConfig signingConfigs.debug
minifyEnabled false
}
release{
minifyEnabled false
}
}

Expand Down Expand Up @@ -144,7 +159,6 @@ dependencies {

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

// retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'

androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
Expand Down
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 app/src/internalRelease/java/com/rockthevote/grommet/Modules.java
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.
}
}
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;
}
}
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();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 app/src/internalRelease/res/layout/internal_activity_frame.xml
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 app/src/internalRelease/res/layout/telescope_tutorial_dialog.xml
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 &amp; 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 app/src/internalRelease/res/layout/telescope_tutorial_toast.xml
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>
5 changes: 5 additions & 0 deletions app/src/internalRelease/res/values/titles.xml
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>

0 comments on commit 0ccabef

Please sign in to comment.