-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from orhanobut/development
Development
- Loading branch information
Showing
36 changed files
with
857 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.orhanobut.waspsample" > | ||
<manifest | ||
package="com.orhanobut.waspsample" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<application | ||
android:name=".WaspApplication" | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" > | ||
android:label="@string/app_name"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".RecyclerViewActivity" | ||
android:label="@string/title_activity_list_test"> | ||
</activity> | ||
<activity | ||
android:name=".ListViewActivity" | ||
android:label="@string/title_activity_list_view"> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.orhanobut.waspsample; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
public class Dummy { | ||
|
||
static String[] IMAGE_LIST = { | ||
"http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-300mmf_35-56g_ed_vr/img/sample" + | ||
"/sample4_l.jpg", | ||
"http://upload.wikimedia.org/wikipedia/commons/1/16/HDRI_Sample_Scene_Balls_%28JPEG-HDR%29.jpg", | ||
"http://blogs.ubc.ca/CourseBlogSample01/wp-content/themes/thesis/rotator/sample-1.jpg", | ||
"http://res.cloudinary.com/demo/image/upload/sample.jpg", | ||
"http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-140mmf_35-56g_ed_vr/img/sample" + | ||
"/sample1_l.jpg", | ||
"http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_nikkor28-300mmf_35-56gd_ed_vr/img" + | ||
"/sample/sample4_l.jpg", | ||
"http://upload.wikimedia.org/wikipedia/en/9/9e/Lensbaby-sample.JPG", | ||
"http://petapixel.com/assets/uploads/2012/02/sample1_mini.jpg", | ||
"http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-300mmf_35-56g_ed_vr/img/sample" + | ||
"/sample1_l.jpg", | ||
"https://www.panda3d.org/manual/images/8/82/Screenshot-Sample-Programs-Media-Player.jpg", | ||
"http://upload.wikimedia.org/wikipedia/commons/5/55/Joe_Sample.jpg", | ||
"http://www.visioncritical.com/wp-content/uploads/2014/12/BLG_Andrew-G.-River-Sample_09.13.12.png", | ||
"http://cdn.redmondpie.com/wp-content/uploads/2010/06/iPhone4CameraSample3.jpg", | ||
"http://static.projects.iq.harvard" + | ||
".edu/files/styles/os_files_medium/public/smms/files/autosampler_vials_sample_vials_glass_vials_9-425_1.jpg%3Fitok%3DikJIf0xN", | ||
"http://cnet4.cbsistatic.com/hub/i/2011/10/27/a66dfbb7-fdc7-11e2-8c7c-d4ae52e62bcc/android" + | ||
"-wallpaper5_2560x1600_1.jpg", | ||
"http://1.bp.blogspot.com/-zudLVLaSBEY/T6puWoYjUsI/AAAAAAAAAV0/siDQwzx0uCw/s1600/Natural%2Bpictures-7.jpg", | ||
"http://www.natural-beginning.com/wp-content/uploads/2013/09/natural-beginning-home-4.png", | ||
"http://www.c2es.org/docUploads/nat-gas-photo.jpg", | ||
"http://www.mrshultz.com/lessons/economicresources/NaturalResources.JPG", | ||
"http://www.fubiz.net/wp-content/uploads/2012/05/Natural-Art-Installations13.jpg", | ||
"http://www.funmag.org/wp-content/uploads/2012/05/beautiful-natural-lakes-26-photos-04.jpg", | ||
"http://www.naturalnorthflorida.com/images/ss-home/Canoeing-a-Spring-Run-in-Natural-North-Florida.jpg", | ||
"https://www.sciencenews.org/sites/default/files/main/articles/gp_20100417_4_17gigjok_gos_free.jpg", | ||
"http://2.bp.blogspot.com/-urElkzK12z8/UDepIin-F8I/AAAAAAAAd9g/LeP2DaAReXk/s1600/Natural%2B%283%29.jpg", | ||
"http://www.fubiz.net/wp-content/uploads/2012/05/Natural-Art-Installations13.jpg" | ||
|
||
}; | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/orhanobut/waspsample/ImageHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.orhanobut.waspsample; | ||
|
||
import android.content.Context; | ||
import android.widget.ImageView; | ||
|
||
import com.android.volley.RequestQueue; | ||
import com.android.volley.toolbox.ImageLoader; | ||
import com.android.volley.toolbox.NetworkImageView; | ||
import com.android.volley.toolbox.Volley; | ||
import com.orhanobut.wasp.Wasp; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
public class ImageHandler { | ||
|
||
static RequestQueue requestQueue; | ||
static ImageLoader imageLoader; | ||
|
||
|
||
public static void volley(Context context, ImageView imageView, String url) { | ||
if (requestQueue == null) { | ||
requestQueue = Volley.newRequestQueue(context); | ||
// imageLoader = new ImageLoader(requestQueue, new BitmapWaspCache()); | ||
} | ||
|
||
((NetworkImageView) imageView).setImageUrl(url, imageLoader); | ||
|
||
} | ||
|
||
public static void wasp(Context context, ImageView imageView, String url) { | ||
Wasp.Image.from(url).to(imageView).load(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/orhanobut/waspsample/ListViewActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.orhanobut.waspsample; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.widget.ListView; | ||
|
||
|
||
public class ListViewActivity extends Activity { | ||
|
||
|
||
public static Intent newIntent(Context context) { | ||
return new Intent(context, ListViewActivity.class); | ||
} | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_list_view); | ||
|
||
ListView listView = (ListView) findViewById(R.id.list); | ||
listView.setAdapter(new MyListAdapter(this, Dummy.IMAGE_LIST)); | ||
|
||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.menu_list_view, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
|
||
//noinspection SimplifiableIfStatement | ||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
|
||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/orhanobut/waspsample/MyListAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.orhanobut.waspsample; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.ImageView; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
public class MyListAdapter extends BaseAdapter { | ||
|
||
final String[] list; | ||
final LayoutInflater layoutInflater; | ||
final Context context; | ||
|
||
public MyListAdapter(Context context, String[] list) { | ||
this.list = list; | ||
this.layoutInflater = LayoutInflater.from(context); | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return list.length; | ||
} | ||
|
||
@Override | ||
public String getItem(int position) { | ||
return list[position]; | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
View view = convertView; | ||
Holder holder; | ||
|
||
if (view == null) { | ||
view = layoutInflater.inflate(R.layout.item_list, parent, false); | ||
|
||
holder = new Holder(); | ||
holder.image = (ImageView) view.findViewById(R.id.image); | ||
|
||
view.setTag(holder); | ||
} else { | ||
holder = (Holder) view.getTag(); | ||
} | ||
|
||
// ImageHandler.volley(context, holder.image, getItem(position)); | ||
ImageHandler.wasp(context, holder.image, getItem(position)); | ||
|
||
return view; | ||
} | ||
|
||
static class Holder { | ||
ImageView image; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/orhanobut/waspsample/MyRecyclerViewAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.orhanobut.waspsample; | ||
|
||
import android.content.Context; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
@SuppressWarnings("unused") | ||
public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder> { | ||
|
||
private final String[] imageList; | ||
private final LayoutInflater layoutInflater; | ||
private final Context context; | ||
|
||
public MyRecyclerViewAdapter(Context context, String[] imageList) { | ||
this.imageList = imageList; | ||
this.layoutInflater = LayoutInflater.from(context); | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
View view = layoutInflater.inflate(R.layout.item_list, parent, false); | ||
return new ViewHolder(view); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(ViewHolder holder, int position) { | ||
// ImageHandler.volley(context, holder.image, imageList[position]); | ||
ImageHandler.wasp(context, holder.image, imageList[position]); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return imageList.length; | ||
} | ||
|
||
static class ViewHolder extends RecyclerView.ViewHolder { | ||
|
||
ImageView image; | ||
|
||
public ViewHolder(View v) { | ||
super(v); | ||
|
||
image = (ImageView) v.findViewById(R.id.image); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.