diff options
author | uabdullah <uabdullah@google.com> | 2017-08-18 10:03:48 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-30 15:46:00 +0000 |
commit | d06fca4ec629533abc2e135d16b8b2865abe8e6c (patch) | |
tree | a284a5f47b0f7da2cd3767e8d70b4a1019ba8c1d | |
parent | 9d2de286eab5634d08790872bbce7bbd42535f03 (diff) |
Create NUI Voicemail Fragment.
Moves away from the dialer stub fragment to a new fragment for VM Tab.
Screenshot:http://screen/fdBhCDkQDVB
Test: VoicemailFragmentIntegrationTest, VoicemailFragment
PiperOrigin-RevId: 165718107
Change-Id: I5df8a707c9f33298e7f814193a576ce792447cef
6 files changed, 111 insertions, 3 deletions
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index 6dced3db2..52b39f0e9 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -32,7 +32,11 @@ import com.android.dialer.common.LogUtil; /** This is the main activity for dialer. It hosts favorites, call log, search, dialpad, etc... */ public final class MainActivity extends AppCompatActivity implements View.OnClickListener { - static Intent getIntent(Context context) { + /** + * @param context Context of the application package implementing MainActivity class. + * @return intent for MainActivity.class + */ + public static Intent getIntent(Context context) { return new Intent(context, MainActivity.class) .setAction(Intent.ACTION_VIEW) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); diff --git a/java/com/android/dialer/main/impl/MainPagerAdapter.java b/java/com/android/dialer/main/impl/MainPagerAdapter.java index c669a620a..33d85ca41 100644 --- a/java/com/android/dialer/main/impl/MainPagerAdapter.java +++ b/java/com/android/dialer/main/impl/MainPagerAdapter.java @@ -22,6 +22,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import com.android.dialer.common.Assert; +import com.android.dialer.voicemail.listui.VoicemailFragment; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -54,9 +55,14 @@ final class MainPagerAdapter extends FragmentStatePagerAdapter { } @Override - public Fragment getItem(int position) { + public Fragment getItem(@TabIndex int position) { // TODO(calderwoodra): implement tabs - return new StubFragment(); + switch (position) { + case TabIndex.VOICEMAIL: + return new VoicemailFragment(); + default: + return new StubFragment(); + } } @Override diff --git a/java/com/android/dialer/voicemail/listui/AndroidManifest.xml b/java/com/android/dialer/voicemail/listui/AndroidManifest.xml new file mode 100644 index 000000000..ae807bb62 --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/AndroidManifest.xml @@ -0,0 +1,16 @@ +<!-- + ~ Copyright (C) 2017 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<manifest package="com.android.dialer.voicemail.listui"/>
\ No newline at end of file diff --git a/java/com/android/dialer/voicemail/listui/VoicemailFragment.java b/java/com/android/dialer/voicemail/listui/VoicemailFragment.java new file mode 100644 index 000000000..e2b87a8db --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/VoicemailFragment.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.dialer.voicemail.listui; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** Fragment for Dialer Voicemail Tab. */ +public final class VoicemailFragment extends Fragment { + + @Nullable + @Override + public View onCreateView( + LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.voicemail_fragment, container, false); + } +} diff --git a/java/com/android/dialer/voicemail/listui/res/layout/voicemail_fragment.xml b/java/com/android/dialer/voicemail/listui/res/layout/voicemail_fragment.xml new file mode 100644 index 000000000..3b566daaa --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/layout/voicemail_fragment.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/voicemail_fragment_text_view" + android:text="@string/welcome_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center"/> +</FrameLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/voicemail/listui/res/values/strings.xml b/java/com/android/dialer/voicemail/listui/res/values/strings.xml new file mode 100644 index 000000000..85d41906e --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/values/strings.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + <string name="welcome_text" translatable="false">hello world! Welcome to the Voicemail Tab!</string> +</resources>
\ No newline at end of file |