Skip to content

Commit

Permalink
Merge pull request #20 from b-lam/develop
Browse files Browse the repository at this point in the history
v1.0.6
  • Loading branch information
b-lam authored May 2, 2017
2 parents e7f05f3 + de332c5 commit 7f700b5
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 9 deletions.
8 changes: 6 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.b_lam.resplash"
minSdkVersion 21
targetSdkVersion 25
versionCode 6
versionName "1.0.5"
versionCode 7
versionName "1.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField("String", "RELEASE_APP_ID", RELEASE_APP_ID)
buildConfigField("String", "RELEASE_SECRET", RELEASE_SECRET)
Expand Down Expand Up @@ -67,6 +67,10 @@ dependencies {
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.github.clans:fab:1.6.4'
compile 'com.pacioianu.david:ink-page-indicator:1.2.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
}

apply plugin: 'com.google.gms.google-services'
Binary file added app/resplash-1.0.4.apk
Binary file not shown.
Binary file added app/resplash-1.0.5.apk
Binary file not shown.
Binary file added app/resplash-1.0.6.apk
Binary file not shown.
12 changes: 12 additions & 0 deletions app/src/main/java/com/b_lam/resplash/Resplash.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ public class Resplash extends Application{
// permission code.
public static final int WRITE_EXTERNAL_STORAGE = 1;

// Firebase
public static final String FIREBASE_EVENT_LOGIN = "unsplash_login";
public static final String FIREBASE_EVENT_VIEW_DONATE = "view_donate";
public static final String FIREBASE_EVENT_VIEW_ABOUT = "view_about";
public static final String FIREBASE_EVENT_RATE_FROM_APP = "rate_from_app";
public static final String FIREBASE_EVENT_DOWNLOAD = "download_photo";
public static final String FIREBASE_EVENT_SET_WALLPAPER = "set_wallpaper";
public static final String FIREBASE_EVENT_LIKE_PHOTO = "like_photo";
public static final String FIREBASE_EVENT_SHARE_PHOTO = "share_photo";
public static final String FIREBASE_EVENT_VIEW_PHOTO_STATS = "view_photo_stats";
public static final String FIREBASE_EVENT_VIEW_PHOTO_INFO = "view_photo_info";

/** <br> life cycle. */

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.widget.LinearLayout;

import com.b_lam.resplash.Resplash;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mikepenz.iconics.context.IconicsLayoutInflater;

import butterknife.BindView;
Expand All @@ -24,6 +25,7 @@
public class AboutActivity extends AppCompatActivity implements View.OnClickListener {

@BindView(R.id.toolbar_about) Toolbar mToolbar;
private FirebaseAnalytics mFirebaseAnalytics;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -67,6 +69,9 @@ protected void onCreate(Bundle savedInstanceState) {
for (LinearLayout r : containers) {
r.setOnClickListener(this);
}

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_VIEW_ABOUT, null);
}

@Override
Expand Down Expand Up @@ -104,6 +109,7 @@ public void onClick(View view) {
break;

case R.id.container_about_rate:
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_RATE_FROM_APP, null);
goToURL("https://play.google.com/store/apps/details?id=com.b_lam.resplash");
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.bumptech.glide.request.target.Target;
import com.github.clans.fab.FloatingActionButton;
import com.github.clans.fab.FloatingActionMenu;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;

import java.io.File;
Expand All @@ -81,6 +82,8 @@ public class DetailActivity extends AppCompatActivity {
final static int TYPE_DOWNLOAD = 1;
final static int TYPE_WALLPAPER = 2;

private FirebaseAnalytics mFirebaseAnalytics;

@BindView((R.id.toolbar_detail)) Toolbar toolbar;
@BindView(R.id.imgFull) ImageView imgFull;
@BindView(R.id.imgProfile) ImageView imgProfile;
Expand Down Expand Up @@ -194,6 +197,8 @@ public void onRequestPhotoDetailsFailed(Call<PhotoDetails> call, Throwable t) {
mService.requestPhotoDetails(mPhoto, mPhotoDetailsRequestListener);

imgFull.setOnClickListener(imageOnClickListener);

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}

private View.OnClickListener onClickListener = new View.OnClickListener() {
Expand All @@ -202,11 +207,12 @@ public void onClick(View view) {
switch (view.getId()) {
case R.id.fab_download:
if (mPhoto != null) {
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_DOWNLOAD, null);
floatingActionMenu.close(true);
Toast.makeText(getApplicationContext(), "Download started", Toast.LENGTH_SHORT).show();
progressBar.getIndeterminateDrawable().setColorFilter(Color.parseColor(mPhoto.color), PorterDuff.Mode.MULTIPLY);
progressBar.setVisibility(View.VISIBLE);
switch (sharedPreferences.getString("download_quality", "Raw")) {
switch (sharedPreferences.getString("download_quality", "Full")) {
case "Raw":
downloadImage(mPhoto.urls.raw, TYPE_DOWNLOAD);
break;
Expand All @@ -229,11 +235,12 @@ public void onClick(View view) {
break;
case R.id.fab_wallpaper:
if (mPhoto != null) {
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_SET_WALLPAPER, null);
floatingActionMenu.close(true);
progressBar.getIndeterminateDrawable().setColorFilter(Color.parseColor(mPhoto.color), PorterDuff.Mode.MULTIPLY);
progressBar.setVisibility(View.VISIBLE);

switch (sharedPreferences.getString("wallpaper_quality", "Raw")) {
switch (sharedPreferences.getString("wallpaper_quality", "Full")) {
case "Raw":
downloadImage(mPhoto.urls.raw, TYPE_WALLPAPER);
break;
Expand All @@ -257,6 +264,7 @@ public void onClick(View view) {
break;
case R.id.fab_info:
if (mPhoto != null) {
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_VIEW_PHOTO_INFO, null);
floatingActionMenu.close(true);
InfoDialog infoDialog = new InfoDialog();
infoDialog.setPhotoDetails(mPhotoDetails);
Expand All @@ -265,6 +273,7 @@ public void onClick(View view) {
break;
case R.id.fab_stats:
if (mPhoto != null) {
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_VIEW_PHOTO_STATS, null);
floatingActionMenu.close(true);
StatsDialog statsDialog = new StatsDialog();
statsDialog.setPhoto(mPhoto);
Expand Down Expand Up @@ -306,6 +315,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
supportFinishAfterTransition();
return true;
case R.id.action_share:
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_SHARE_PHOTO, null);
shareTextUrl();
return true;
case R.id.action_view_on_unsplash:
Expand Down Expand Up @@ -357,6 +367,8 @@ public void updateHeartButton(boolean like){

public void likeImage(View view){

mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_LIKE_PHOTO, null);

like = !like;

PhotoService.OnSetLikeListener mSetLikeListener = new PhotoService.OnSetLikeListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.b_lam.resplash.util.billing.Inventory;
import com.b_lam.resplash.util.billing.Purchase;
import com.b_lam.resplash.util.billing.SkuDetails;
import com.google.firebase.analytics.FirebaseAnalytics;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -53,6 +54,8 @@ public class DonateActivity extends AppCompatActivity implements View.OnClickLis
IabHelper mHelper;
IabBroadcastReceiver mBroadcastReceiver;

private FirebaseAnalytics mFirebaseAnalytics;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -107,6 +110,9 @@ public void onIabSetupFinished(IabResult result) {
for (LinearLayout r : containers) {
r.setOnClickListener(this);
}

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_VIEW_DONATE, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import com.b_lam.resplash.R;
import com.google.firebase.analytics.FirebaseAnalytics;

import retrofit2.Call;
import retrofit2.Response;

Expand All @@ -32,6 +34,7 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList

private String TAG = "LoginActivity";
private AuthorizeService mService;
private FirebaseAnalytics mFirebaseAnalytics;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -45,6 +48,8 @@ protected void onCreate(Bundle savedInstanceState) {
btnClose.setOnClickListener(this);

mService = AuthorizeService.getService();

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}

@Override
Expand Down Expand Up @@ -93,6 +98,7 @@ public void onRequestAccessTokenSuccess(Call<AccessToken> call, Response<AccessT
AuthManager.getInstance().refreshPersonalProfile();
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mFirebaseAnalytics.logEvent(Resplash.FIREBASE_EVENT_LOGIN, null);
startActivity(intent);
} else {
Snackbar.make(relativeLayout, getString(R.string.request_token_failed), Snackbar.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void animate(View view) {
holder.coverPhoto.setMinimumHeight((int) finalHeight);
}
}else{
holder.coverPhoto.setImageResource(R.drawable.placeholder);
holder.coverPhotoCard.setImageResource(R.drawable.placeholder);
}

if(sharedPreferences.getString("item_layout", "List").equals("Cards")){
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
<string name="about_unsplash_title">Unsplash.com</string>
<string name="about_unsplash_subtitle">Free (do whatever you want) high-resolution photos</string>
<string name="about_version_title">Version</string>
<string name="about_version_subtitle">1.0.5</string>
<string name="about_version_subtitle">1.0.6</string>
<string name="about_changelog_title">Changelog</string>
<string name="changelog">v1.0.0 - Initial Release\nv1.0.1 - Fixed loading bug\nv1.0.2 - Changed to dark status bar icons\nv1.0.3 - Fixed navigation bar and preview status bar icons\nv1.0.4 - Bug fixes, added option to use custom API keys, added future support for more languages\nv1.0.5 - Added various ways to support the development of Resplash, bug fixes</string>
<string name="changelog">v1.0.0 - Initial Release\nv1.0.1 - Fixed loading bug\nv1.0.2 - Changed to dark status bar icons\nv1.0.3 - Fixed navigation bar and preview status bar icons\nv1.0.4 - Bug fixes, added option to use custom API keys, added future support for more languages\nv1.0.5 - Added various ways to support the development of Resplash, bug fixes\nv1.0.6 - Improved performance, added better analytics and crash reporting, bug fixes</string>
<string name="about_introduction_title">Introduction</string>
<string name="about_github_title">GitHub</string>
<string name="about_support_development_card_title">Support development</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
android:dialogTitle="@string/title_download_quality_preference"
android:entries="@array/quality_options"
android:entryValues="@array/quality_options"
android:defaultValue="Raw"/>
android:defaultValue="Full"/>

<ListPreference
android:key="wallpaper_quality"
Expand All @@ -48,7 +48,7 @@
android:dialogTitle="@string/title_wallpaper_quality_preference"
android:entries="@array/quality_options"
android:entryValues="@array/quality_options"
android:defaultValue="Raw"/>
android:defaultValue="Full"/>

<!--<CheckBoxPreference-->
<!--android:key="checkbox_preference"-->
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}

Expand Down

0 comments on commit 7f700b5

Please sign in to comment.