diff options
author | calderwoodra <calderwoodra@google.com> | 2018-02-02 12:22:13 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-02 14:17:44 -0800 |
commit | 3a398a5adf0feae1f6dafe629a6c7cc4a0a968b4 (patch) | |
tree | 28107d07ea8259a86bd32b1e8d550daad35bfac1 /java/com/android/dialer/main/MainActivityPeer.java | |
parent | 7e5da60e990e153c8fd5ba4e146825bb8e9a2bd4 (diff) |
Split MainActivity into two peers, old and new to keep logic isolated.
This change updates MainActivity to defer lifecycle callbacks and other
relevant methods to which ever peer is active, old or new.
The old peer implements the logic for the old fragments.
The new peer implements the logic for the new fragments.
MainActivity implements the logic that is shared or common between the two like
last tab, post call, search, dialpad, ect.
Bug: 72525324
Test: pending
PiperOrigin-RevId: 184317828
Change-Id: Ie73733f2a3837c9d63e54cf5b142984633340731
Diffstat (limited to 'java/com/android/dialer/main/MainActivityPeer.java')
-rw-r--r-- | java/com/android/dialer/main/MainActivityPeer.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/java/com/android/dialer/main/MainActivityPeer.java b/java/com/android/dialer/main/MainActivityPeer.java new file mode 100644 index 000000000..6457b607b --- /dev/null +++ b/java/com/android/dialer/main/MainActivityPeer.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2018 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.main; + +import android.content.Intent; +import android.os.Bundle; + +/** Interface for peers of MainActivity. */ +public interface MainActivityPeer { + + void onActivityCreate(Bundle saveInstanceState); + + void onActivityResume(); + + void onActivityStop(); + + void onNewIntent(Intent intent); + + void onActivityResult(int requestCode, int resultCode, Intent data); + + void onSaveInstanceState(Bundle bundle); + + boolean onBackPressed(); + + /** Supplies the MainActivityPeer */ + interface PeerSupplier { + + MainActivityPeer getPeer(); + } +} |