Skip to content

Commit

Permalink
Delete unused context
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinea committed May 28, 2014
1 parent a37752e commit 6780c03
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/cn/trinea/android/demo/DownloadManagerDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public class DownloadManagerDemo extends BaseActivity {
private DownloadManagerPro downloadManagerPro;
private long downloadId = 0;

private Context context;
private MyHandler handler;

private DownloadChangeObserver downloadObserver;
Expand All @@ -57,7 +56,6 @@ public class DownloadManagerDemo extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.download_manager_demo);

context = getApplicationContext();
handler = new MyHandler();
downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);
downloadManagerPro = new DownloadManagerPro(downloadManager);
Expand All @@ -71,7 +69,7 @@ protected void onCreate(Bundle savedInstanceState) {
*/
Uri data = intent.getData();
if (data != null) {
Toast.makeText(getApplicationContext(), data.toString(), Toast.LENGTH_LONG).show();
Toast.makeText(context, data.toString(), Toast.LENGTH_LONG).show();
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/cn/trinea/android/demo/HttpCacheDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.Date;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
Expand Down Expand Up @@ -35,7 +34,6 @@ public class HttpCacheDemo extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.http_cache_demo);

Context context = getApplicationContext();
// get the singleton instance of HttpCache
httpCache = CacheManager.getHttpCache(context);
// or create a new HttpCache, like this:
Expand Down
2 changes: 0 additions & 2 deletions src/cn/trinea/android/demo/ImageCacheDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
Expand Down Expand Up @@ -46,7 +45,6 @@ public class ImageCacheDemo extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.image_cache_demo);

Context context = getApplicationContext();
parentLayout = (RelativeLayout)findViewById(R.id.image_cache_parent_layout);
initImageUrlList();
IMAGE_CACHE.initData(this, TAG_CACHE);
Expand Down
2 changes: 1 addition & 1 deletion src/cn/trinea/android/demo/ImagePagerFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
imageIdList.add(R.drawable.banner2);
imageIdList.add(R.drawable.banner3);
imageIdList.add(R.drawable.banner4);
viewPager.setAdapter(new ImagePagerAdapter(getActivity().getApplicationContext(), imageIdList));
viewPager.setAdapter(new ImagePagerAdapter(context, imageIdList));
indicator.setViewPager(viewPager);

viewPager.setInterval(2000);
Expand Down
1 change: 0 additions & 1 deletion src/cn/trinea/android/demo/ImageSDCardCacheDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class ImageSDCardCacheDemo extends BaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.image_sdcard_cache_demo);

Context context = getApplicationContext();
initImageUrlList();
IMAGE_SD_CACHE.initData(context, TAG_CACHE);
IMAGE_SD_CACHE.setContext(context);
Expand Down
6 changes: 2 additions & 4 deletions src/cn/trinea/android/demo/ServiceDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public class ServiceDemo extends BaseActivity {
*/
@Override
public void onServiceDisconnected(ComponentName name) {
Toast.makeText(getApplicationContext(), "Service disconnect",
Toast.LENGTH_SHORT).show();
Toast.makeText(context, "Service disconnect", Toast.LENGTH_SHORT).show();
}

/**
Expand All @@ -55,8 +54,7 @@ public void onServiceDisconnected(ComponentName name) {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
myService = ((MyBinder)service).getService();
Toast.makeText(getApplicationContext(), "Service Connect", Toast.LENGTH_SHORT)
.show();
Toast.makeText(context, "Service Connect", Toast.LENGTH_SHORT).show();
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/cn/trinea/android/demo/SlideOnePageGalleryDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void onNothingSelected(AdapterView<?> parent) {
}
});

ImageListAdapter adapter = new ImageListAdapter(getApplicationContext());
ImageListAdapter adapter = new ImageListAdapter(context);
List<Integer> idList = new ArrayList<Integer>();
idList.add(R.drawable.image1);
idList.add(R.drawable.image2);
Expand Down

0 comments on commit 6780c03

Please sign in to comment.