Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from derekcsm/1.0.1
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
derekcsm committed Jun 7, 2015
2 parents e7c4a73 + 6baebaa commit fbbcaf7
Show file tree
Hide file tree
Showing 19 changed files with 90 additions and 95 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/.idea/libraries
.DS_Store
/build

app/fabric.properties
1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build

fabric.properties
16 changes: 8 additions & 8 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.afollestad/material-dialogs/0.7.4.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/21.0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.1.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/beta/1.1.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics/2.2.3/jars" />
Expand Down Expand Up @@ -103,23 +103,23 @@
<orderEntry type="library" exported="" name="library-1.0.1" level="project" />
<orderEntry type="library" exported="" name="androidsvg-1.2.2-beta-1" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="crashlytics-2.2.3" level="project" />
<orderEntry type="library" exported="" name="answers-1.1.2" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" name="butterknife-6.1.0" level="project" />
<orderEntry type="library" exported="" name="library-19.0.1" level="project" />
<orderEntry type="library" exported="" name="beta-1.1.2" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="palette-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="palette-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="library-1.1.3" level="project" />
<orderEntry type="library" exported="" name="material-dialogs-0.7.4.2" level="project" />
<orderEntry type="library" exported="" name="supertoasts-1.3.4" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="fabric-1.3.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.8.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
<orderEntry type="library" exported="" name="android-observablescrollview-1.5.0" level="project" />
</component>
</module>
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId 'com.derek_s.hubble_gallery'
minSdkVersion 16
targetSdkVersion 22
versionCode 10
versionName "1.0.0"
versionCode 11
versionName "1.0.1"
}
buildTypes {
release {
Expand All @@ -37,8 +37,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:palette-v7:21.0.3'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:palette-v7:22.2.0'
compile 'org.jsoup:jsoup:1.8.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.jakewharton:butterknife:6.1.0'
Expand Down
3 changes: 0 additions & 3 deletions app/fabric.properties

This file was deleted.

2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class Constants {
public static final String MODE_KEY = "current_mode";
public static final String PARAM_TILE_KEY = "tile_param";
public static final String PARAM_DETAILS_KEY = "details_param";
public static final String ALPHA_TITLE = "toolbar_current_alpha";
public static final String ONBOARDING_SHOWN ="onboarding_shown";

public static String imageDirectory() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.derek_s.hubble_gallery.ui.activities;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.derek_s.hubble_gallery.R;
import com.derek_s.hubble_gallery.base.Constants;
import com.derek_s.hubble_gallery.ui.fragments.FragDetails;

public class ActDetails extends AppCompatActivity implements FragDetails.OnFragmentInteractionListener {
public class ActDetails extends AppCompatActivity {

private String TAG = getClass().getSimpleName();
FragDetails fragDetails;
Expand All @@ -35,10 +34,4 @@ public void onBackPressed() {
super.onBackPressed();
this.overridePendingTransition(R.anim.fade_in_shadow, R.anim.slide_out_right);
}

@Override
public void onFragmentInteraction(Uri uri) {
// TODO
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.view.SurfaceView;
Expand All @@ -30,7 +31,6 @@ public class ActOnboarding extends AppCompatActivity {
VerticalViewPager verticalViewPager;

private StarField starField;

int width;
int height;

Expand All @@ -49,6 +49,12 @@ protected void onCreate(Bundle savedInstanceState) {
starField = new StarField(svStarfield.getHolder(), width, height);
starField.start();

// remove all fragments from manager
if (getSupportFragmentManager().getFragments() != null)
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
}

verticalViewPager.setAdapter(new OnboardingFragmentPager(getSupportFragmentManager()));
verticalViewPager.setOffscreenPageLimit(5);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// private String TAG = getClass().getSimpleName();
public class DialogAbout {
private Context context;
private TextView tvTitle, tvBuiltBy, tvSourceCode, tvBuiltContent, tvSourceContent, tvShowIntro;
private TextView tvTitle, tvBuiltBy, tvSourceCode, tvBuiltContent, tvShowIntro;
private View divider;

public DialogAbout(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
public class FragDetails extends android.support.v4.app.Fragment implements ObservableScrollViewCallbacks {

private static String TAG = "FragDetails";
private static final String TOOLBAR_CURRENT_ALPHA = "toolbar_current_alpha";
private static final String TOOLBAR_COLOR = "toolbar_current_color";

private TileObject tileObject;
private DetailsObject detailsObject;
@InjectView(R.id.iv_display)
Expand All @@ -85,15 +88,14 @@ public class FragDetails extends android.support.v4.app.Fragment implements Obse
TextView tvZeroStateInfo;
@InjectView(R.id.tv_retry)
TextView tvRetry;

int imgLoadAttempt = 0;
public static String successfulSrc;
int titleBgColor;
int alphaTitleBgColor;
FavoriteUtils favoriteUtils;
MenuItem actionFavorite;

private OnFragmentInteractionListener mCallbacks;

/*
must pass a TileObject for the fragment to use
*/
Expand Down Expand Up @@ -188,7 +190,7 @@ public boolean onMenuItemClick(MenuItem menuItem) {
if (imgUri != null) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("*/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "via Hubble Gallery"); // TODO replace with shortened playstore link
shareIntent.putExtra(Intent.EXTRA_TEXT, "via http://bit.ly/1dm23ZQ");
shareIntent.putExtra(Intent.EXTRA_STREAM, imgUri);

startActivity(Intent.createChooser(shareIntent, getActivity().getResources().getString(R.string.share_image)));
Expand All @@ -208,23 +210,9 @@ public boolean onMenuItemClick(MenuItem menuItem) {

Log.i(TAG, "imgUri" + imgUri);
if (imgUri != null) {
PackageManager pm = getActivity().getPackageManager();
Intent attachIntent = new Intent(Intent.ACTION_ATTACH_DATA);
attachIntent.setDataAndType(imgUri, "image/jpeg");
Intent openInChooser = Intent.createChooser(attachIntent, getActivity().getResources().getString(R.string.set_as));

List<ResolveInfo> resInfo = pm.queryIntentActivities(attachIntent, 0);
Intent[] extraIntents = new Intent[resInfo.size()];
for (int i = 0; i < resInfo.size(); i++) {
ResolveInfo ri = resInfo.get(i);
String packageName = ri.activityInfo.packageName;
Intent intent = new Intent();
intent.setComponent(new ComponentName(packageName, ri.activityInfo.name));
intent.setAction(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(imgUri, "image/jpeg");
extraIntents[i] = new Intent(intent);
}
openInChooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents);
startActivity(openInChooser);
} else {
Toasty.show(getActivity(), R.string.error_saving_image, Toasty.LENGTH_LONG);
Expand All @@ -236,8 +224,8 @@ public boolean onMenuItemClick(MenuItem menuItem) {
break;
case R.id.action_share_link:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND); // TODO replace with shortened playstore link
sendIntent.putExtra(Intent.EXTRA_TEXT, tileObject.getTitle() + " - http://hubblesite.org" + tileObject.getHref() + " via Hubble Gallery for Android");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, tileObject.getTitle() + " - http://hubblesite.org" + tileObject.getHref() + " via http://bit.ly/1dm23ZQ");
sendIntent.setType("text/plain");
startActivity(sendIntent);
break;
Expand Down Expand Up @@ -266,16 +254,21 @@ public void onClick(View v) {
showDialog();
}
});

scrollView.setScrollViewCallbacks(this);

showLoadingAnimation(true, 0);
if (savedInstanceState != null) {
loadImage(tileObject.getSrc());
onScrollChanged(scrollView.getCurrentScrollY(), false, false);
alphaTitleBgColor = savedInstanceState.getInt(Constants.ALPHA_TITLE);
titleBgColor = savedInstanceState.getInt(TOOLBAR_COLOR);
alphaTitleBgColor = savedInstanceState.getInt(TOOLBAR_CURRENT_ALPHA);
toolbar.setBackgroundColor(alphaTitleBgColor);

scrollView.post(new Runnable() {
public void run() {
scrollView.scrollTo(0, scrollView.getCurrentScrollY());
}
});

if (detailsObject == null) {
loadPage();
} else if (detailsObject.getDescription() == null || detailsObject.getDescription().length() == 0) {
Expand Down Expand Up @@ -478,26 +471,21 @@ public void onError() {
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mCallbacks = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}

@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}

@Override
public void onSaveInstanceState(Bundle outstate) {
outstate.putString(Constants.PARAM_TILE_KEY, tileObject.serialize());
if (detailsObject != null)
outstate.putString(Constants.PARAM_DETAILS_KEY, detailsObject.serialize());
outstate.putInt(Constants.ALPHA_TITLE, alphaTitleBgColor);

outstate.putInt(TOOLBAR_CURRENT_ALPHA, alphaTitleBgColor);
outstate.putInt(TOOLBAR_COLOR, titleBgColor);
super.onSaveInstanceState(outstate);
}

Expand All @@ -521,9 +509,4 @@ public void onDownMotionEvent() {
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
}

public interface OnFragmentInteractionListener {
public void onFragmentInteraction(Uri uri);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
* Created by dereksmith on 15-05-15.
*/
public class FragWelcomeInfo extends Fragment {

private static String TAG = "FragWelcomeInfo";
private static int pagePos = 1;
private static String PAGE_KEY = "page_number";
private static final String CURRENT_PAGE = "current_page";

public static FragWelcomeInfo newInstance(int position) {
FragWelcomeInfo fragment = new FragWelcomeInfo();
private static int pagePos = 1;

public static final FragWelcomeInfo newInstance(int position) {
final FragWelcomeInfo fragment = new FragWelcomeInfo();
// Supply int position as an argument.
Bundle args = new Bundle();
args.putInt(PAGE_KEY, position);
Expand All @@ -39,7 +39,11 @@ public static FragWelcomeInfo newInstance(int position) {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pagePos = getArguments() != null ? getArguments().getInt(PAGE_KEY) : 1;
if (savedInstanceState == null) {
pagePos = getArguments() != null ? getArguments().getInt(PAGE_KEY) : 1;
} else {
pagePos = savedInstanceState.getInt(CURRENT_PAGE);
}
}

@InjectView(R.id.tv_welcome_info)
Expand All @@ -50,7 +54,6 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View rootView = inflater.inflate(R.layout.frag_welcome_info, container, false);
ButterKnife.inject(this, rootView);

Expand Down Expand Up @@ -90,5 +93,11 @@ public void onClick(View v) {
return rootView;
}

@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt(CURRENT_PAGE, pagePos);
super.onSaveInstanceState(outState);
}


}
Loading

0 comments on commit fbbcaf7

Please # to comment.