Methods Summary |
---|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.wallpaper);
mGallery = (Gallery) findViewById(R.id.gallery);
mGallery.setAdapter(new ImageAdapter(this));
mGallery.setOnItemSelectedListener(this);
mGallery.setOnItemClickListener(this);
|
public void | onItemClick(android.widget.AdapterView parent, android.view.View v, int position, long id)
selectWallpaper(position);
|
public void | onItemSelected(android.widget.AdapterView parent, android.view.View v, int position, long id)
getWindow().setBackgroundDrawableResource(IMAGE_IDS[position]);
|
public void | onNothingSelected(android.widget.AdapterView parent)
|
protected void | onResume()
super.onResume();
mIsWallpaperSet = false;
|
public boolean | onTouchEvent(android.view.MotionEvent event)
selectWallpaper(mGallery.getSelectedItemPosition());
return true;
|
private synchronized void | selectWallpaper(int position)
if (mIsWallpaperSet) {
return;
}
mIsWallpaperSet = true;
try {
InputStream stream = getResources().openRawResource(IMAGE_IDS[position]);
setWallpaper(stream);
setResult(RESULT_OK);
finish();
} catch (IOException e) {
Log.e(LOG_TAG, "Failed to set wallpaper " + e);
}
|