1 /* 2 * Copyright (C) 2022 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 package com.android.adservices.ui.settings.activities; 17 18 import android.os.Build; 19 import android.os.Bundle; 20 21 import androidx.annotation.RequiresApi; 22 import androidx.lifecycle.ViewModelProvider; 23 24 import com.android.adservices.api.R; 25 import com.android.adservices.ui.settings.delegates.AppsActionDelegate; 26 import com.android.adservices.ui.settings.fragments.AdServicesSettingsAppsFragment; 27 import com.android.adservices.ui.settings.viewmodels.AppsViewModel; 28 29 /** 30 * Android application activity for controlling applications which interacted with FLEDGE 31 * (Remarketing) APIs. 32 */ 33 // TODO(b/269798827): Enable for R. 34 @RequiresApi(Build.VERSION_CODES.S) 35 public class AppsActivity extends AdServicesBaseActivity { 36 private AppsActionDelegate mActionDelegate; 37 38 /** @return the action delegate for the activity. */ getActionDelegate()39 public AppsActionDelegate getActionDelegate() { 40 return mActionDelegate; 41 } 42 43 @Override onCreate(Bundle savedInstanceState)44 protected void onCreate(Bundle savedInstanceState) { 45 super.onCreate(savedInstanceState); 46 setContentView(R.layout.adservices_settings_main_activity); 47 getSupportFragmentManager() 48 .beginTransaction() 49 .replace(R.id.fragment_container_view, AdServicesSettingsAppsFragment.class, null) 50 .setReorderingAllowed(true) 51 .commit(); 52 initActionDelegate(); 53 } 54 55 @Override initBeta()56 public void initBeta() {} 57 58 @Override initGA()59 public void initGA() {} 60 61 @Override initU18()62 public void initU18() {} 63 initActionDelegate()64 private void initActionDelegate() { 65 mActionDelegate = 66 new AppsActionDelegate(this, new ViewModelProvider(this).get(AppsViewModel.class)); 67 } 68 } 69