7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #Image Searcher
2 |
3 | Send anything from Google Image Search right from your favorite apps!
4 |
5 | Bug reports and pull requests always welcome.
6 |
7 | Free on the Play Store: https://play.google.com/store/apps/details?id=com.stevenschoen.imagesearchernew
8 |
9 | Don't have the right picture for a message or email?
10 | Attach a photo and select Image Searcher from the list. Then, search through Google Images' massive collection and pick what you want!
11 | It's a lot quicker than searching for the image, downloading it, sharing it, and picking the app you were just in before you were interrupted.
12 |
13 | Works great with Messaging, Hangouts, Gmail, and many others!
14 |
15 |
16 | ###Libraries used:
17 |
18 | Ion by Koush: https://github.com/koush/ion
19 |
20 | Retrofit by Square: http://square.github.io/retrofit/
21 |
22 | Crashlytics: https://www.crashlytics.com/
23 |
24 | PhotoView by Chris Banes: https://github.com/chrisbanes/PhotoView
25 |
26 | Material Dialogs by Aidan Follestad: https://github.com/afollestad/material-dialogs
27 |
28 | Play Services by Google: https://developer.android.com/google/play-services/index.html
29 |
30 | Android Support Library by Google: http://developer.android.com/tools/support-library/index.html
31 |
32 | ###License
33 |
34 | Copyright 2014 Steven Schoen
35 |
36 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
37 |
38 | http://www.apache.org/licenses/LICENSE-2.0
39 |
40 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
41 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
This version of the pager is best for use when there are a handful of
34 | * typically more static fragments to be paged through, such as a set of tabs.
35 | * The fragment of each page the user visits will be kept in memory, though its
36 | * view hierarchy may be destroyed when not visible. This can result in using
37 | * a significant amount of memory since fragment instances can hold on to an
38 | * arbitrary amount of state. For larger sets of pages, consider
39 | * {@link android.support.v4.app.FragmentStatePagerAdapter}.
40 | *
41 | *
When using FragmentPagerAdapter the host ViewPager must have a
42 | * valid ID set.
43 | *
44 | *
Subclasses only need to implement {@link #getItem(int)}
45 | * and {@link #getCount()} to have a working adapter.
46 | *
47 | *
Here is an example implementation of a pager containing fragments of
48 | * lists:
49 | *
50 | * {@sample development/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
51 | * complete}
52 | *
53 | *
The R.layout.fragment_pager resource of the top-level fragment is:
54 | *
55 | * {@sample development/samples/Support4Demos/res/layout/fragment_pager.xml
56 | * complete}
57 | *
58 | *
The R.layout.fragment_pager_list resource containing each
59 | * individual fragment's layout is:
60 | *
61 | * {@sample development/samples/Support4Demos/res/layout/fragment_pager_list.xml
62 | * complete}
63 | *
64 | * Edited by Steven Schoen, based on FragmentPagerAdapter
65 | */
66 | public abstract class PublicFragmentPagerAdapter extends PagerAdapter {
67 | private static final String TAG = "FragmentPagerAdapter";
68 | private static final boolean DEBUG = false;
69 |
70 | private final FragmentManager mFragmentManager;
71 | private FragmentTransaction mCurTransaction = null;
72 | private Fragment mCurrentPrimaryItem = null;
73 |
74 | public PublicFragmentPagerAdapter(FragmentManager fm) {
75 | mFragmentManager = fm;
76 | }
77 |
78 | /**
79 | * Return the Fragment associated with a specified position.
80 | */
81 | public abstract Fragment getItem(int position);
82 |
83 | @Override
84 | public void startUpdate(ViewGroup container) {
85 | }
86 |
87 | @Override
88 | public Object instantiateItem(ViewGroup container, int position) {
89 | if (mCurTransaction == null) {
90 | mCurTransaction = mFragmentManager.beginTransaction();
91 | }
92 |
93 | final long itemId = getItemId(position);
94 |
95 | // Do we already have this fragment?
96 | String name = makeFragmentName(container.getId(), itemId);
97 | Fragment fragment = mFragmentManager.findFragmentByTag(name);
98 | if (fragment != null) {
99 | if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
100 | mCurTransaction.attach(fragment);
101 | } else {
102 | fragment = getItem(position);
103 | if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
104 | mCurTransaction.add(container.getId(), fragment,
105 | makeFragmentName(container.getId(), itemId));
106 | }
107 | if (fragment != mCurrentPrimaryItem) {
108 | fragment.setMenuVisibility(false);
109 | fragment.setUserVisibleHint(false);
110 | }
111 |
112 | return fragment;
113 | }
114 |
115 | @Override
116 | public void destroyItem(ViewGroup container, int position, Object object) {
117 | if (mCurTransaction == null) {
118 | mCurTransaction = mFragmentManager.beginTransaction();
119 | }
120 | if (DEBUG) Log.v(TAG, "Detaching item #" + getItemId(position) + ": f=" + object
121 | + " v=" + ((Fragment)object).getView());
122 | mCurTransaction.detach((Fragment)object);
123 | }
124 |
125 | @Override
126 | public void setPrimaryItem(ViewGroup container, int position, Object object) {
127 | Fragment fragment = (Fragment)object;
128 | if (fragment != mCurrentPrimaryItem) {
129 | if (mCurrentPrimaryItem != null) {
130 | mCurrentPrimaryItem.setMenuVisibility(false);
131 | mCurrentPrimaryItem.setUserVisibleHint(false);
132 | }
133 | if (fragment != null) {
134 | fragment.setMenuVisibility(true);
135 | fragment.setUserVisibleHint(true);
136 | }
137 | mCurrentPrimaryItem = fragment;
138 | }
139 | }
140 |
141 | @Override
142 | public void finishUpdate(ViewGroup container) {
143 | if (mCurTransaction != null) {
144 | mCurTransaction.commitAllowingStateLoss();
145 | mCurTransaction = null;
146 | mFragmentManager.executePendingTransactions();
147 | }
148 | }
149 |
150 | @Override
151 | public boolean isViewFromObject(View view, Object object) {
152 | return ((Fragment)object).getView() == view;
153 | }
154 |
155 | @Override
156 | public Parcelable saveState() {
157 | return null;
158 | }
159 |
160 | @Override
161 | public void restoreState(Parcelable state, ClassLoader loader) {
162 | }
163 |
164 | /**
165 | * Return a unique identifier for the item at the given position.
166 | *
167 | *
The default implementation returns the given position.
168 | * Subclasses should override this method if the positions of items can change.
169 | *
170 | * @param position Position within this adapter
171 | * @return Unique identifier for the item at position
172 | */
173 | public long getItemId(int position) {
174 | return position;
175 | }
176 |
177 | private static String makeFragmentName(int viewId, long id) {
178 | return "android:switcher:" + viewId + ":" + id;
179 | }
180 |
181 | public Fragment getFragmentAtPosition(View container, int position) {
182 | return mFragmentManager.findFragmentByTag(makeFragmentName(container.getId(), getItemId(position)));
183 | }
184 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/ResultActivity.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew;
2 |
3 | import android.app.Fragment;
4 | import android.content.Intent;
5 | import android.graphics.Bitmap;
6 | import android.os.Bundle;
7 | import android.support.v4.app.NavUtils;
8 | import android.support.v4.view.ViewPager;
9 | import android.support.v7.app.ActionBarActivity;
10 | import android.view.Menu;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 | import android.widget.TextView;
14 |
15 | import com.afollestad.materialdialogs.MaterialDialog;
16 | import com.afollestad.materialdialogs.Theme;
17 | import com.stevenschoen.imagesearchernew.model.Image;
18 |
19 | import java.util.List;
20 |
21 | public class ResultActivity extends ActionBarActivity {
22 |
23 | public static final String EXTRA_IMAGES = "images";
24 | public static final String EXTRA_IMAGE_POSITION = "imagePosition";
25 | public static final String EXTRA_THUMBNAIL_BITMAP = "thumbnailBitmap";
26 |
27 | public static final String EXTRA_RESULT_IMAGE_RESULT = "imageResult";
28 |
29 | private ViewPager pager;
30 |
31 | private List images;
32 | private int imagePosition;
33 | private Bitmap thumbnailBitmap;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.imageresult_pager);
39 |
40 | if (getIntent() != null) {
41 | images = getIntent().getParcelableArrayListExtra(EXTRA_IMAGES);
42 | imagePosition = getIntent().getIntExtra(EXTRA_IMAGE_POSITION, 0);
43 | thumbnailBitmap = getIntent().getParcelableExtra(EXTRA_THUMBNAIL_BITMAP);
44 | } else {
45 | finish();
46 | }
47 |
48 | pager = (ViewPager) findViewById(R.id.imageresult_pager_pager);
49 | final PublicFragmentPagerAdapter pagerAdapter = new PublicFragmentPagerAdapter(getFragmentManager()) {
50 | @Override
51 | public Fragment getItem(int position) {
52 | Bundle args = new Bundle();
53 | args.putParcelable(ResultFragment.EXTRA_IMAGE_RESULT, images.get(position));
54 | if (position == imagePosition) {
55 | args.putParcelable(ResultFragment.EXTRA_THUMBNAIL_BITMAP, thumbnailBitmap);
56 | }
57 | return Fragment.instantiate(ResultActivity.this, ResultFragment.class.getName(), args);
58 | }
59 |
60 | @Override
61 | public int getCount() {
62 | return images.size();
63 | }
64 | };
65 | pager.setAdapter(pagerAdapter);
66 | pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
67 | @Override
68 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { }
69 |
70 | @Override
71 | public void onPageSelected(int position) {
72 | setTitle(images.get(position).title);
73 | }
74 |
75 | @Override
76 | public void onPageScrollStateChanged(int state) { }
77 | });
78 | pager.setCurrentItem(imagePosition, false);
79 |
80 | View selectButton = findViewById(R.id.imageresult_pager_select);
81 | Utils.setupFab(selectButton);
82 | selectButton.setOnClickListener(new View.OnClickListener() {
83 | @Override
84 | public void onClick(View v) {
85 | finishWithResult(getCurrentImageResult());
86 | }
87 | });
88 | }
89 |
90 | public Image getCurrentImageResult() {
91 | return images.get(pager.getCurrentItem());
92 | }
93 |
94 | private void showDetailsDialog() {
95 | Image imageResult = getCurrentImageResult();
96 |
97 | MaterialDialog dialog = new MaterialDialog.Builder(this)
98 | .title(imageResult.title)
99 | .customView(R.layout.imageresult_details)
100 | .neutralText(R.string.close)
101 | .theme(Theme.DARK)
102 | .build();
103 |
104 | TextView linkText = (TextView) dialog.getCustomView().findViewById(R.id.imageresult_details_link);
105 | linkText.setText(imageResult.link);
106 |
107 | TextView siteText = (TextView) dialog.getCustomView().findViewById(R.id.imageresult_details_site);
108 | siteText.setText(imageResult.displayLink);
109 |
110 | TextView typeText = (TextView) dialog.getCustomView().findViewById(R.id.imageresult_details_type);
111 | typeText.setText(imageResult.mimeType);
112 |
113 | TextView sizeText = (TextView) dialog.getCustomView().findViewById(R.id.imageresult_details_size);
114 | sizeText.setText(Utils.humanReadableByteCount(imageResult.size, false));
115 |
116 | TextView resolutionText = (TextView) dialog.getCustomView().findViewById(R.id.imageresult_details_resolution);
117 | String resolution = imageResult.width + " x " + imageResult.height;
118 | resolutionText.setText(resolution);
119 |
120 | dialog.show();
121 | }
122 |
123 | @Override
124 | public boolean onCreateOptionsMenu(Menu menu) {
125 | super.onCreateOptionsMenu(menu);
126 | getMenuInflater().inflate(R.menu.menu_result, menu);
127 | return true;
128 | }
129 |
130 | @Override
131 | public boolean onOptionsItemSelected(MenuItem item) {
132 | switch (item.getItemId()) {
133 | case android.R.id.home:
134 | NavUtils.navigateUpFromSameTask(this);
135 | return true;
136 | case R.id.menu_result_details:
137 | showDetailsDialog();
138 | return true;
139 | }
140 |
141 | return super.onOptionsItemSelected(item);
142 | }
143 |
144 | private void finishWithResult(Image imageResult) {
145 | Intent intent = new Intent();
146 | intent.putExtra(EXTRA_RESULT_IMAGE_RESULT, imageResult);
147 |
148 | setResult(RESULT_OK, intent);
149 | finish();
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/ResultFragment.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.app.Fragment;
6 | import android.graphics.Bitmap;
7 | import android.os.Bundle;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ImageView;
12 |
13 | import com.koushikdutta.async.future.FutureCallback;
14 | import com.koushikdutta.ion.ImageViewBitmapInfo;
15 | import com.koushikdutta.ion.Ion;
16 | import com.stevenschoen.imagesearchernew.model.Image;
17 |
18 | public class ResultFragment extends Fragment {
19 |
20 | public static final String EXTRA_IMAGE_RESULT = "imageResult";
21 | public static final String EXTRA_THUMBNAIL_BITMAP = "thumbnailBitmap";
22 |
23 | private Image result;
24 |
25 | private Bitmap thumbnailBitmap;
26 |
27 | @Override
28 | public void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 |
31 | thumbnailBitmap = getArguments().getParcelable(EXTRA_THUMBNAIL_BITMAP);
32 | result = getArguments().getParcelable(EXTRA_IMAGE_RESULT);
33 |
34 | if (savedInstanceState != null) {
35 | if (savedInstanceState.containsKey(EXTRA_THUMBNAIL_BITMAP)) {
36 | thumbnailBitmap = savedInstanceState.getParcelable(EXTRA_THUMBNAIL_BITMAP);
37 | }
38 | }
39 | }
40 |
41 | @Override
42 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
43 | View view = inflater.inflate(R.layout.imageresult_full, container, false);
44 |
45 | final ImageView thumbnailImage = (ImageView) view.findViewById(R.id.imageresult_full_thumbnail);
46 | if (thumbnailBitmap != null) {
47 | thumbnailImage.setImageBitmap(thumbnailBitmap);
48 | } else {
49 | Ion.with(getActivity()).load(result.thumbnailLink).intoImageView(thumbnailImage)
50 | .withBitmapInfo().setCallback(new FutureCallback() {
51 | @Override
52 | public void onCompleted(Exception e, ImageViewBitmapInfo result) {
53 | thumbnailBitmap = result.getBitmapInfo().bitmap;
54 | }
55 | });
56 | }
57 |
58 | final ImageView image = (ImageView) view.findViewById(R.id.imageresult_full_image);
59 | image.setAlpha(0f);
60 | Ion.with(getActivity()).load(result.link).intoImageView(image)
61 | .withBitmapInfo().setCallback(new FutureCallback() {
62 | @Override
63 | public void onCompleted(Exception e, ImageViewBitmapInfo result) {
64 | image.animate().alpha(1f).setListener(new AnimatorListenerAdapter() {
65 | @Override
66 | public void onAnimationEnd(Animator animation) {
67 | thumbnailImage.setVisibility(View.GONE);
68 | }
69 | });
70 | }
71 | });
72 |
73 | return view;
74 | }
75 |
76 | public Image getImageResult() {
77 | return result;
78 | }
79 |
80 | @Override
81 | public void onSaveInstanceState(Bundle outState) {
82 | super.onSaveInstanceState(outState);
83 |
84 | if (thumbnailBitmap != null) {
85 | outState.putParcelable(EXTRA_THUMBNAIL_BITMAP, thumbnailBitmap);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/SearchInterface.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew;
2 |
3 | import com.squareup.okhttp.Authenticator;
4 | import com.squareup.okhttp.Credentials;
5 | import com.squareup.okhttp.OkHttpClient;
6 | import com.squareup.okhttp.Request;
7 | import com.squareup.okhttp.Response;
8 | import com.stevenschoen.imagesearchernew.model.Image;
9 | import com.stevenschoen.imagesearchernew.model.Search;
10 | import com.stevenschoen.imagesearchernew.model.bing.BingImage;
11 | import com.stevenschoen.imagesearchernew.model.bing.BingSearchResponse;
12 | import com.stevenschoen.imagesearchernew.model.google.GoogleImage;
13 | import com.stevenschoen.imagesearchernew.model.google.GoogleSearchResponse;
14 |
15 | import java.io.IOException;
16 | import java.net.Proxy;
17 | import java.util.ArrayList;
18 |
19 | import retrofit.RequestInterceptor;
20 | import retrofit.RestAdapter;
21 | import retrofit.client.OkClient;
22 |
23 | public class SearchInterface {
24 | public static enum Service {
25 | FakeGoogle, Google, Bing
26 | }
27 |
28 | public Service service;
29 |
30 | private FakeGoogleSearchInterface fakeGoogleSearchInterface;
31 | private GoogleSearchInterface googleSearchInterface;
32 | private BingSearchInterface bingSearchInterface;
33 |
34 | public SearchInterface(Service service) {
35 | this.service = service;
36 |
37 | switch (service) {
38 | case FakeGoogle:
39 | fakeGoogleSearchInterface = new FakeGoogleSearchInterface();
40 | break;
41 | case Google:
42 | RestAdapter.Builder googleBuilder = new RestAdapter.Builder()
43 | .setEndpoint(GoogleSearchInterface.BASE_URL)
44 | .setLogLevel(RestAdapter.LogLevel.BASIC)
45 | .setRequestInterceptor(new RequestInterceptor() {
46 | @Override
47 | public void intercept(RequestFacade request) {
48 | request.addQueryParam("key", GoogleSearchInterface.API_KEY);
49 | request.addQueryParam("cx", GoogleSearchInterface.CUSTOM_SEARCH_ID);
50 | }
51 | });
52 | RestAdapter googleAdapter = googleBuilder.build();
53 | googleSearchInterface = googleAdapter.create(GoogleSearchInterface.class);
54 | break;
55 | case Bing:
56 | OkHttpClient httpClient = new OkHttpClient();
57 | httpClient.setAuthenticator(new Authenticator() {
58 | @Override
59 | public Request authenticate(Proxy proxy, Response response) throws IOException {
60 | // "API keys are for hipsters and squares" - Microsoft
61 | String credential = Credentials.basic(BingSearchInterface.API_KEY, BingSearchInterface.API_KEY);
62 | return response.request().newBuilder()
63 | .header("Authorization", credential)
64 | .build();
65 | }
66 |
67 | @Override
68 | public Request authenticateProxy(Proxy proxy, Response response) throws IOException {
69 | return null;
70 | }
71 | });
72 | RestAdapter.Builder bingBuilder = new RestAdapter.Builder()
73 | .setClient(new OkClient(httpClient))
74 | .setEndpoint(BingSearchInterface.BASE_URL)
75 | .setLogLevel(RestAdapter.LogLevel.BASIC);
76 | RestAdapter bingAdapter = bingBuilder.build();
77 | bingSearchInterface = bingAdapter.create(BingSearchInterface.class);
78 | break;
79 | }
80 | }
81 |
82 | public Search searchImages(String query) {
83 | switch (service) {
84 | case FakeGoogle:
85 | return buildSearch(fakeGoogleSearchInterface.search(), query);
86 | case Google:
87 | return buildSearch(googleSearchInterface.search(
88 | query,
89 | 1,
90 | GoogleSearchInterface.SEARCH_TYPE_IMAGE),
91 | query);
92 | case Bing:
93 | // crossFingers();
94 | return buildSearch(bingSearchInterface.search(
95 | Utils.wrapInBingQuotes(BingSearchInterface.SOURCE_IMAGE),
96 | Utils.wrapInBingQuotes(query),
97 | 0,
98 | BingSearchInterface.FORMAT_JSON),
99 | query);
100 | }
101 |
102 | return null;
103 | }
104 |
105 | public Search nextPage(Search search, long firstIndex) {
106 | // Google starts 'startIndex' at 1, Bing starts 'skip' at 0
107 | // Starting at 0
108 | switch (service) {
109 | case FakeGoogle:
110 | break;
111 | case Google:
112 | Search newGoogleSearch = buildSearch(googleSearchInterface.search(
113 | search.input.query,
114 | firstIndex + 1,
115 | GoogleSearchInterface.SEARCH_TYPE_IMAGE),
116 | search.input.query);
117 | search.images.addAll(newGoogleSearch.images);
118 | break;
119 | case Bing:
120 | Search newBingSearch = buildSearch(bingSearchInterface.search(
121 | Utils.wrapInBingQuotes(BingSearchInterface.SOURCE_IMAGE),
122 | Utils.wrapInBingQuotes(search.input.query),
123 | firstIndex,
124 | BingSearchInterface.FORMAT_JSON),
125 | search.input.query);
126 | search.images.addAll(newBingSearch.images);
127 | break;
128 | }
129 |
130 | return search;
131 | }
132 |
133 | private Search buildSearch(GoogleSearchResponse googleResponse, String query) {
134 | Search search = new Search(query);
135 |
136 | search.images = new ArrayList<>(googleResponse.items.length);
137 | for (GoogleImage image : googleResponse.items) {
138 | search.images.add(buildResult(image));
139 | }
140 |
141 | search.totalResults = googleResponse.searchInformation.totalResults;
142 |
143 | return search;
144 | }
145 |
146 | private Search buildSearch(BingSearchResponse bingResponse, String query) {
147 | Search search = new Search(query);
148 |
149 | search.images = new ArrayList<>(bingResponse.d.results[0].Image.length);
150 | for (BingImage image : bingResponse.d.results[0].Image) {
151 | search.images.add(buildImage(image));
152 | }
153 |
154 | search.totalResults = bingResponse.d.results[0].ImageTotal;
155 |
156 | return search;
157 | }
158 |
159 | private Image buildResult(GoogleImage googleImage) {
160 | Image image = new Image();
161 |
162 | image.title = googleImage.title;
163 | image.link = googleImage.link;
164 | image.thumbnailLink = googleImage.image.thumbnailLink;
165 | image.displayLink = googleImage.displayLink;
166 | image.mimeType = googleImage.mime;
167 | image.width = googleImage.image.width;
168 | image.height = googleImage.image.height;
169 | image.size = googleImage.image.byteSize;
170 |
171 | return image;
172 | }
173 |
174 | private Image buildImage(BingImage bingImage) {
175 | Image image = new Image();
176 |
177 | image.title = bingImage.Title;
178 | image.link = bingImage.MediaUrl;
179 | image.thumbnailLink = bingImage.Thumbnail.MediaUrl;
180 | image.displayLink = bingImage.SourceUrl;
181 | image.mimeType = bingImage.ContentType;
182 | image.width = bingImage.Width;
183 | image.height = bingImage.Height;
184 | image.size = bingImage.FileSize;
185 |
186 | return image;
187 | }
188 | }
189 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/Utils.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew;
2 |
3 | import android.annotation.TargetApi;
4 | import android.graphics.Outline;
5 | import android.os.Build;
6 | import android.view.View;
7 | import android.view.ViewOutlineProvider;
8 |
9 | import java.util.Locale;
10 |
11 | public class Utils {
12 |
13 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
14 | public static void setupFab(View floatingActionButton) {
15 | if (hasLollipop()) {
16 | floatingActionButton.setOutlineProvider(new ViewOutlineProvider() {
17 | @Override
18 | public void getOutline(View view, Outline outline) {
19 | outline.setOval(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
20 | }
21 | });
22 | floatingActionButton.setClipToOutline(true);
23 | floatingActionButton.setElevation(
24 | floatingActionButton.getResources().getDimension(R.dimen.fab_elevation));
25 | }
26 | }
27 |
28 | public static String humanReadableByteCount(long bytes, boolean si) {
29 | int unit = si ? 1000 : 1024;
30 | if (bytes < unit)
31 | return bytes + " B";
32 | int exp = (int) (Math.log(bytes) / Math.log(unit));
33 | String pre = ("KMGTPE").charAt(exp - 1)
34 | + "";
35 | return String.format(Locale.US, "%.1f %sB", bytes / Math.pow(unit, exp), pre);
36 | }
37 |
38 | public static String wrapInBingQuotes(String string) {
39 | // Thanks, Microsoft. Super intuitive.
40 | return "'" + string + "'";
41 | }
42 |
43 | public static boolean hasLollipop() {
44 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/Image.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | public class Image implements Parcelable {
7 | public String title;
8 | public String link;
9 | public String thumbnailLink;
10 | public String displayLink;
11 | public String mimeType;
12 | public long width, height;
13 | public long size;
14 |
15 | @Override
16 | public int describeContents() {
17 | return 0;
18 | }
19 |
20 | @Override
21 | public void writeToParcel(Parcel dest, int flags) {
22 | dest.writeString(this.title);
23 | dest.writeString(this.link);
24 | dest.writeString(this.thumbnailLink);
25 | dest.writeString(this.displayLink);
26 | dest.writeString(this.mimeType);
27 | dest.writeLong(this.width);
28 | dest.writeLong(this.height);
29 | dest.writeLong(this.size);
30 | }
31 |
32 | public Image() { }
33 |
34 | private Image(Parcel in) {
35 | this.title = in.readString();
36 | this.link = in.readString();
37 | this.thumbnailLink = in.readString();
38 | this.displayLink = in.readString();
39 | this.mimeType = in.readString();
40 | this.width = in.readLong();
41 | this.height = in.readLong();
42 | this.size = in.readLong();
43 | }
44 |
45 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
46 | public Image createFromParcel(Parcel source) {
47 | return new Image(source);
48 | }
49 |
50 | public Image[] newArray(int size) {
51 | return new Image[size];
52 | }
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/Search.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class Search implements Parcelable {
10 | public Input input; // Not from APIs, details from this app
11 |
12 | public static class Input implements Parcelable {
13 | public String query;
14 |
15 | @Override
16 | public int describeContents() {
17 | return 0;
18 | }
19 |
20 | @Override
21 | public void writeToParcel(Parcel dest, int flags) {
22 | dest.writeString(this.query);
23 | }
24 |
25 | public Input(String query) {
26 | this.query = query;
27 | }
28 |
29 | private Input(Parcel in) {
30 | this.query = in.readString();
31 | }
32 |
33 | public static final Creator CREATOR = new Creator() {
34 | public Input createFromParcel(Parcel source) {
35 | return new Input(source);
36 | }
37 |
38 | public Input[] newArray(int size) {
39 | return new Input[size];
40 | }
41 | };
42 | }
43 |
44 | public List images;
45 | public long totalResults;
46 |
47 | @Override
48 | public int describeContents() {
49 | return 0;
50 | }
51 |
52 | @Override
53 | public void writeToParcel(Parcel dest, int flags) {
54 | dest.writeParcelable(this.input, flags);
55 | dest.writeTypedList(images);
56 | dest.writeLong(totalResults);
57 | }
58 |
59 | public Search() {
60 | images = new ArrayList<>();
61 | totalResults = -1;
62 | }
63 |
64 | public Search(String query) {
65 | super();
66 | input = new Input(query);
67 | }
68 |
69 | private Search(Parcel in) {
70 | super();
71 | this.input = in.readParcelable(Input.class.getClassLoader());
72 | in.readTypedList(images, Image.CREATOR);
73 | this.totalResults = in.readLong();
74 | }
75 |
76 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
77 | public Search createFromParcel(Parcel source) {
78 | return new Search(source);
79 | }
80 |
81 | public Search[] newArray(int size) {
82 | return new Search[size];
83 | }
84 | };
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/bing/BingImage.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model.bing;
2 |
3 | public class BingImage {
4 | public String Title;
5 | public String MediaUrl;
6 | public String SourceUrl;
7 | public String DisplayUrl;
8 | public long Width, Height;
9 | public long FileSize;
10 | public String ContentType;
11 | public Thumbnail Thumbnail;
12 |
13 | public static class Thumbnail {
14 | public String MediaUrl;
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/bing/BingSearchResponse.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model.bing;
2 |
3 | public class BingSearchResponse {
4 | public BingInnerResponse d; // "What should we call the actual content that was asked for?
5 | // "I know! 'd'!"
6 | // "But why not just put that in the response?"
7 | // "You're fired."
8 |
9 | public class BingInnerResponse {
10 | public BingInnerResult[] results; // "So this array, called 'results'.. it's going to
11 | // contain the results, right?"
12 | // "No, you imbecile! It'll have just one object, and
13 | // THAT object will have an array with all the results!"
14 | // "Then why have the original array in the first place?"
15 | // "You're fired, too."
16 |
17 | public class BingInnerResult {
18 | public long ImageTotal;
19 | public BingImage[] Image;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/google/GoogleImage.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model.google;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | public class GoogleImage implements Parcelable {
7 | public String title;
8 | public String link;
9 | public String displayLink;
10 | public String mime;
11 | public Image image;
12 |
13 | public static class Image implements Parcelable {
14 | public long height;
15 | public long width;
16 | public long byteSize;
17 | public String thumbnailLink;
18 |
19 | @Override
20 | public int describeContents() {
21 | return 0;
22 | }
23 |
24 | @Override
25 | public void writeToParcel(Parcel dest, int flags) {
26 | dest.writeLong(this.height);
27 | dest.writeLong(this.width);
28 | dest.writeLong(this.byteSize);
29 | dest.writeString(this.thumbnailLink);
30 | }
31 |
32 | public Image() { }
33 |
34 | private Image(Parcel in) {
35 | this.height = in.readLong();
36 | this.width = in.readLong();
37 | this.byteSize = in.readLong();
38 | this.thumbnailLink = in.readString();
39 | }
40 |
41 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
42 | public Image createFromParcel(Parcel source) {
43 | return new Image(source);
44 | }
45 |
46 | public Image[] newArray(int size) {
47 | return new Image[size];
48 | }
49 | };
50 | }
51 |
52 | @Override
53 | public int describeContents() {
54 | return 0;
55 | }
56 |
57 | @Override
58 | public void writeToParcel(Parcel dest, int flags) {
59 | dest.writeString(this.title);
60 | dest.writeString(this.link);
61 | dest.writeString(this.displayLink);
62 | dest.writeString(this.mime);
63 | dest.writeParcelable(this.image, 0);
64 | }
65 |
66 | public GoogleImage() {
67 | }
68 |
69 | private GoogleImage(Parcel in) {
70 | this.title = in.readString();
71 | this.link = in.readString();
72 | this.displayLink = in.readString();
73 | this.mime = in.readString();
74 | this.image = in.readParcelable(Image.class.getClassLoader());
75 | }
76 |
77 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
78 | public GoogleImage createFromParcel(Parcel source) {
79 | return new GoogleImage(source);
80 | }
81 |
82 | public GoogleImage[] newArray(int size) {
83 | return new GoogleImage[size];
84 | }
85 | };
86 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/stevenschoen/imagesearchernew/model/google/GoogleSearchResponse.java:
--------------------------------------------------------------------------------
1 | package com.stevenschoen.imagesearchernew.model.google;
2 |
3 | public class GoogleSearchResponse {
4 | public GoogleImage[] items;
5 | public GoogleQueries queries;
6 | public GoogleSearchInformation searchInformation;
7 |
8 | public static class GoogleQueries {
9 | public GooglePage[] nextPage = new GooglePage[1];
10 | public GooglePage[] request = new GooglePage[1];
11 |
12 | public static class GooglePage {
13 | public int startIndex;
14 | public int count;
15 | }
16 |
17 | public GooglePage getNextPage() {
18 | return nextPage[0];
19 | }
20 |
21 | public GooglePage getRequest() {
22 | return request[0];
23 | }
24 | }
25 |
26 | public static class GoogleSearchInformation {
27 | public long totalResults;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/de/ankri/views/AutoScaleTextView.java:
--------------------------------------------------------------------------------
1 | package de.ankri.views;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Paint;
6 | import android.util.AttributeSet;
7 | import android.util.TypedValue;
8 | import android.widget.TextView;
9 |
10 | import com.stevenschoen.imagesearchernew.R;
11 |
12 | /**
13 | * A custom Text View that lowers the text size when the text is to big for the TextView. Modified version of one found on stackoverflow
14 | *
15 | * @author Andreas Krings - www.ankri.de
16 | * @version 1.0
17 | *
18 | */
19 | public class AutoScaleTextView extends TextView
20 | {
21 | private Paint textPaint;
22 |
23 | private float preferredTextSize;
24 | private float minTextSize;
25 |
26 | public AutoScaleTextView(Context context)
27 | {
28 | this(context, null);
29 | }
30 |
31 | public AutoScaleTextView(Context context, AttributeSet attrs)
32 | {
33 | this(context, attrs, R.attr.autoScaleTextViewStyle);
34 |
35 | // Use this constructor, if you do not want use the default style
36 | // super(context, attrs);
37 | }
38 |
39 | public AutoScaleTextView(Context context, AttributeSet attrs, int defStyle)
40 | {
41 | super(context, attrs, defStyle);
42 |
43 | this.textPaint = new Paint();
44 |
45 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AutoScaleTextView, defStyle, 0);
46 | this.minTextSize = a.getDimension(R.styleable.AutoScaleTextView_minTextSize, 10f);
47 | a.recycle();
48 |
49 | this.preferredTextSize = this.getTextSize();
50 | }
51 |
52 | /**
53 | * Set the minimum text size for this view
54 | *
55 | * @param minTextSize
56 | * The minimum text size
57 | */
58 | public void setMinTextSize(float minTextSize)
59 | {
60 | this.minTextSize = minTextSize;
61 | }
62 |
63 | /**
64 | * Resize the text so that it fits
65 | *
66 | * @param text
67 | * The text. Neither null nor empty.
68 | * @param textWidth
69 | * The width of the TextView. > 0
70 | */
71 | private void refitText(String text, int textWidth)
72 | {
73 | if (textWidth <= 0 || text == null || text.length() == 0)
74 | return;
75 |
76 | // the width
77 | int targetWidth = textWidth - this.getPaddingLeft() - this.getPaddingRight();
78 |
79 | final float threshold = 0.5f; // How close we have to be
80 |
81 | this.textPaint.set(this.getPaint());
82 |
83 | while ((this.preferredTextSize - this.minTextSize) > threshold)
84 | {
85 | float size = (this.preferredTextSize + this.minTextSize) / 2;
86 | this.textPaint.setTextSize(size);
87 | if (this.textPaint.measureText(text) >= targetWidth)
88 | this.preferredTextSize = size; // too big
89 | else
90 | this.minTextSize = size; // too small
91 | }
92 | // Use min size so that we undershoot rather than overshoot
93 | this.setTextSize(TypedValue.COMPLEX_UNIT_PX, this.minTextSize);
94 | }
95 |
96 | @Override
97 | protected void onTextChanged(final CharSequence text, final int start, final int before, final int after)
98 | {
99 | this.refitText(text.toString(), this.getWidth());
100 | }
101 |
102 | @Override
103 | protected void onSizeChanged(int width, int height, int oldwidth, int oldheight)
104 | {
105 | if (width != oldwidth)
106 | this.refitText(this.getText().toString(), width);
107 | }
108 |
109 | }
--------------------------------------------------------------------------------
/app/src/main/res/animator-v21/fab_state_list_anim.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/fab_shadow_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/fab_shadow_mini.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/fab_shadow_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/fab_shadow_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_about_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/ic_about_action_github.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_about_action_rate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/ic_about_action_rate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_fab_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/ic_fab_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_fab_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/ic_fab_select.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/fab_shadow_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/fab_shadow_mini.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/fab_shadow_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/fab_shadow_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_about_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/ic_about_action_github.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_about_action_rate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/ic_about_action_rate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_fab_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/ic_fab_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_fab_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/ic_fab_select.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-nodpi/more.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/fab_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/fab_shadow.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/fab_shadow_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/fab_shadow_mini.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/fab_shadow_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/fab_shadow_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_about_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/ic_about_action_github.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_about_action_rate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/ic_about_action_rate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_fab_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/ic_fab_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_fab_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/ic_fab_select.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/fab_shadow_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/fab_shadow_mini.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/fab_shadow_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/fab_shadow_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_about_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/ic_about_action_github.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_about_action_rate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/ic_about_action_rate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_fab_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/ic_fab_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_fab_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/ic_fab_select.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/fab_shadow_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxxhdpi/fab_shadow_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/app/src/main/res/drawable-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fab_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-v21/fab_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-v21/fab_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/about.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
16 |
17 |
30 |
31 |
44 |
45 |
46 |
50 |
51 |
62 |
63 |
69 |
70 |
71 |
72 |
73 |
85 |
86 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/about_actions.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
28 |
29 |
37 |
38 |
39 |
48 |
49 |
56 |
57 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fab_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fab_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/imageresult_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
22 |
23 |
28 |
29 |
30 |
31 |
37 |
38 |
52 |
53 |
54 |
55 |
56 |
62 |
63 |
73 |
74 |
75 |
76 |
77 |
83 |
84 |
94 |
95 |
96 |
97 |
98 |
104 |
105 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/imageresult_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
17 |
18 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/imageresult_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/imageresult_pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
16 |
17 |
24 |
25 |
38 |
39 |
40 |
47 |
48 |
53 |
54 |
67 |
68 |
69 |
72 |
73 |
81 |
82 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_result.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 56dp
4 | 28dp
5 | -28dp
6 | 40dp
7 | 20dp
8 | -20dp
9 |
10 | 8dp
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w400dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 100dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 120dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 | 160dp
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #03A9F4
4 | #0288D1
5 |
6 | #40C4FF
7 | #75D3FF
8 | #A8E4FF
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 | 16dp
4 |
5 | 64dp
6 | 32dp
7 | -32dp
8 | 56dp
9 | 28dp
10 | -28dp
11 | 4dp
12 | 16dp
13 |
14 | 0dp
15 |
16 | 80dp
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Image Searcher
5 | Search images
6 | Select
7 | About
8 | Version %s
9 | Rate on the Play Store
10 | View source on GitHub
11 | Details
12 | Link
13 | Site
14 | Type
15 | Resolution
16 | Size
17 | Close
18 | %s results
19 | Select service
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
20 |
21 |
28 |
29 |
36 |
37 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | maven { url 'http://download.crashlytics.com/maven' }
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.0.0'
8 | classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | jcenter()
15 | maven { url 'http://download.crashlytics.com/maven' }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/promo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/promo.psd
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/web_icon.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DSteve595/Image-Searcher/e8e002c736566925ff717e39015d1b37c416bad8/web_icon.psd
--------------------------------------------------------------------------------