1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.music; 18 19 import android.app.Activity; 20 import android.media.AudioManager; 21 import android.os.Bundle; 22 import android.view.View; 23 import android.view.Window; 24 import android.view.WindowManager; 25 import android.widget.Button; 26 import android.widget.TextView; 27 28 public class DeleteItems extends Activity 29 { 30 private TextView mPrompt; 31 private Button mButton; 32 private long [] mItemList; 33 34 @Override onCreate(Bundle icicle)35 public void onCreate(Bundle icicle) { 36 super.onCreate(icicle); 37 setVolumeControlStream(AudioManager.STREAM_MUSIC); 38 39 requestWindowFeature(Window.FEATURE_NO_TITLE); 40 setContentView(R.layout.confirm_delete); 41 getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, 42 WindowManager.LayoutParams.WRAP_CONTENT); 43 44 mPrompt = (TextView)findViewById(R.id.prompt); 45 mButton = (Button) findViewById(R.id.delete); 46 mButton.setOnClickListener(mButtonClicked); 47 48 ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() { 49 public void onClick(View v) { 50 finish(); 51 } 52 }); 53 54 Bundle b = getIntent().getExtras(); 55 String desc = b.getString("description"); 56 mItemList = b.getLongArray("items"); 57 58 mPrompt.setText(desc); 59 } 60 61 private View.OnClickListener mButtonClicked = new View.OnClickListener() { 62 public void onClick(View v) { 63 // delete the selected item(s) 64 MusicUtils.deleteTracks(DeleteItems.this, mItemList); 65 finish(); 66 } 67 }; 68 } 69