blob: c223723c6699c6c199fd09bf9f52f40c5b77c604 [file] [log] [blame]
calderwoodra9f16e172018-01-29 19:18:14 -08001/*
2 * Copyright (C) 2018 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
17package com.android.dialer.app;
18
calderwoodra9f16e172018-01-29 19:18:14 -080019import android.content.ComponentName;
20import android.content.Context;
21import android.content.Intent;
calderwoodra9f16e172018-01-29 19:18:14 -080022
zachhd74e72e2018-03-23 11:43:18 -070023/**
24 * Main activity intents.
25 *
26 * <p>TODO(calderwoodra): Move this elsewhere.
27 */
calderwoodra9f16e172018-01-29 19:18:14 -080028public class MainComponent {
29
calderwoodra9f16e172018-01-29 19:18:14 -080030 /**
31 * @param context Context of the application package implementing MainActivity class.
32 * @return intent for MainActivity.class
33 */
34 public static Intent getIntent(Context context) {
35 Intent intent = new Intent();
calderwoodra014ffe12018-02-05 15:59:47 -080036 intent.setComponent(new ComponentName(context, getComponentName()));
calderwoodra9f16e172018-01-29 19:18:14 -080037 intent.setAction(Intent.ACTION_VIEW);
38 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
39 return intent;
40 }
calderwoodra014ffe12018-02-05 15:59:47 -080041
42 public static Intent getShowCallLogIntent(Context context) {
43 Intent intent = new Intent();
44 intent.setComponent(new ComponentName(context, getComponentName()));
45 intent.setAction("ACTION_SHOW_TAB");
46 intent.putExtra("EXTRA_SHOW_TAB", 1);
47 return intent;
48 }
49
calderwoodra0c060572018-02-05 19:24:02 -080050 public static Intent getShowVoicemailIntent(Context context) {
51 Intent intent = new Intent();
52 intent.setComponent(new ComponentName(context, getComponentName()));
53 intent.setAction("ACTION_SHOW_TAB");
54 intent.putExtra("EXTRA_SHOW_TAB", 3);
55 return intent;
56 }
57
calderwoodra014ffe12018-02-05 15:59:47 -080058 private static String getComponentName() {
59 return "com.android.dialer.main.impl.MainActivity";
60 }
calderwoodra9f16e172018-01-29 19:18:14 -080061}