• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.storagemanager;
18 
19 import android.app.Activity;
20 import android.app.Fragment;
21 import android.app.FragmentManager;
22 import android.app.FragmentTransaction;
23 import android.os.Bundle;
24 import android.view.ViewGroup;
25 import android.widget.Button;
26 import com.android.storagemanager.deletionhelper.DeletionHelperSettings;
27 
28 /**
29  * The DeletionHelperActivity is an activity for deleting apps, photos, and downloaded files which
30  * have not been recently used.
31  */
32 public class DeletionHelperActivity extends Activity implements ButtonBarProvider {
33     private ViewGroup mButtonBar;
34     private Button mNextButton, mSkipButton;
35     private Fragment f;
36 
37     @Override
onCreate(Bundle savedInstanceState)38     protected void onCreate(Bundle savedInstanceState) {
39         super.onCreate(savedInstanceState);
40         setContentView(R.layout.settings_main_prefs);
41 
42         // If we are not returning from an existing activity, create a new fragment.
43         if (savedInstanceState == null) {
44             FragmentManager manager = getFragmentManager();
45             f = DeletionHelperSettings.newInstance();
46             FragmentTransaction transaction = manager.beginTransaction();
47             transaction.replace(R.id.main_content, f);
48             transaction.commit();
49         }
50 
51         mButtonBar = (ViewGroup) findViewById(R.id.button_bar);
52         mNextButton = (Button) findViewById(R.id.next_button);
53         mSkipButton = (Button) findViewById(R.id.skip_button);
54     }
55 
56     @Override
onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults)57     public void onRequestPermissionsResult(int requestCode, String permissions[],
58             int[] grantResults) {
59         super.onRequestPermissionsResult(requestCode, permissions, grantResults);
60         f.onRequestPermissionsResult(requestCode, permissions, grantResults);
61     }
62 
63     @Override
getButtonBar()64     public ViewGroup getButtonBar() {
65         return mButtonBar;
66     }
67 
68     @Override
getNextButton()69     public Button getNextButton() {
70         return mNextButton;
71     }
72 
73     @Override
getSkipButton()74     public Button getSkipButton() {
75         return mSkipButton;
76     }
77 }