PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/UniversalImageLoaderExample/src/com/nostra13/example/universalimageloader/HomeActivity.java

https://github.com/rashedulkabir/Android-Universal-Image-Loader
Java | 56 lines | 42 code | 11 blank | 3 comment | 0 complexity | 43684572e81e4aa2e8c3820dd1f15af7 MD5 | raw file
 1package com.nostra13.example.universalimageloader;
 2
 3import java.util.ArrayList;
 4import java.util.Arrays;
 5import java.util.List;
 6
 7import android.content.Intent;
 8import android.os.Bundle;
 9import android.view.View;
10
11/**
12 * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
13 */
14public class HomeActivity extends BaseActivity {
15
16	private String[] imageUrls;
17
18	@Override
19	public void onCreate(Bundle savedInstanceState) {
20		super.onCreate(savedInstanceState);
21		setContentView(R.layout.ac_home);
22
23		String[] heavyImages = getResources().getStringArray(R.array.heavy_images);
24		String[] lightImages = getResources().getStringArray(R.array.light_images);
25
26		imageUrls = new String[heavyImages.length + lightImages.length];
27		List<String> urls = new ArrayList<String>();
28		urls.addAll(Arrays.asList(heavyImages));
29		urls.addAll(Arrays.asList(lightImages));
30		imageUrls = (String[]) urls.toArray(new String[0]);
31	}
32
33	public void onImageListClick(View view) {
34		Intent intent = new Intent(this, ImageListActivity.class);
35		intent.putExtra(Extra.IMAGES, imageUrls);
36		startActivity(intent);
37	}
38
39	public void onImageGridClick(View view) {
40		Intent intent = new Intent(this, ImageGridActivity.class);
41		intent.putExtra(Extra.IMAGES, imageUrls);
42		startActivity(intent);
43	}
44
45	public void onImagePagerClick(View view) {
46		Intent intent = new Intent(this, ImagePagerActivity.class);
47		intent.putExtra(Extra.IMAGES, imageUrls);
48		startActivity(intent);
49	}
50
51	public void onImageGalleryClick(View view) {
52		Intent intent = new Intent(this, ImageGalleryActivity.class);
53		intent.putExtra(Extra.IMAGES, imageUrls);
54		startActivity(intent);
55	}
56}