diff options
Diffstat (limited to 'java/com/android/newbubble')
-rw-r--r-- | java/com/android/newbubble/NewBubble.java | 78 | ||||
-rw-r--r-- | java/com/android/newbubble/NewBubbleComponent.java | 39 | ||||
-rw-r--r-- | java/com/android/newbubble/NewBubbleInfo.java | 129 | ||||
-rw-r--r-- | java/com/android/newbubble/stub/NewBubbleStub.java | 57 | ||||
-rw-r--r-- | java/com/android/newbubble/stub/StubNewBubbleModule.java | 30 |
5 files changed, 0 insertions, 333 deletions
diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java deleted file mode 100644 index 785593c5c..000000000 --- a/java/com/android/newbubble/NewBubble.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.newbubble; - -import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import com.android.newbubble.NewBubbleInfo.Action; -import java.util.List; - -/** - * Creates and manages a bubble window from information in a {@link NewBubbleInfo}. Before creating, - * be sure to check whether bubbles may be shown using {@code Settings.canDrawOverlays(context)} and - * request permission if necessary - */ -public interface NewBubble { - - /** - * Make the bubble visible. Will show a short entrance animation as it enters. If the bubble is - * already showing this method does nothing. - */ - void show(); - - /** Hide the bubble. */ - void hide(); - - /** Returns whether the bubble is currently visible */ - boolean isVisible(); - - /** - * Set the info for this Bubble to display - * - * @param bubbleInfo the BubbleInfo to display in this Bubble. - */ - void setBubbleInfo(@NonNull NewBubbleInfo bubbleInfo); - - /** - * Update the state and behavior of actions. - * - * @param actions the new state of the bubble's actions - */ - void updateActions(@NonNull List<Action> actions); - - /** - * Update the avatar from photo. - * - * @param avatar the new photo avatar in the bubble's primary button - */ - void updatePhotoAvatar(@NonNull Drawable avatar); - - /** - * Update the avatar. - * - * @param avatar the new avatar in the bubble's primary button - */ - void updateAvatar(@NonNull Drawable avatar); - - /** - * Display text. The bubble's drawer is not expandable while text is showing, and the drawer will - * be closed if already open. - * - * @param text the text to display to the user - */ - void showText(@NonNull CharSequence text); -} diff --git a/java/com/android/newbubble/NewBubbleComponent.java b/java/com/android/newbubble/NewBubbleComponent.java deleted file mode 100644 index e7edba6b4..000000000 --- a/java/com/android/newbubble/NewBubbleComponent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.newbubble; - -import android.content.Context; -import android.support.annotation.NonNull; -import com.android.dialer.inject.HasRootComponent; -import dagger.Subcomponent; - -@Subcomponent -public abstract class NewBubbleComponent { - - @NonNull - public abstract NewBubble getNewBubble(); - - public static NewBubbleComponent get(Context context) { - return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) - .newBubbleComponent(); - } - - /** Used to refer to the root application component. */ - public interface HasComponent { - NewBubbleComponent newBubbleComponent(); - } -} diff --git a/java/com/android/newbubble/NewBubbleInfo.java b/java/com/android/newbubble/NewBubbleInfo.java deleted file mode 100644 index d9232a5a0..000000000 --- a/java/com/android/newbubble/NewBubbleInfo.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.newbubble; - -import android.app.PendingIntent; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.Icon; -import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.Px; -import com.google.auto.value.AutoValue; -import java.util.Collections; -import java.util.List; - -/** Info for displaying a {@link NewBubble} */ -@AutoValue -public abstract class NewBubbleInfo { - @ColorInt - public abstract int getPrimaryColor(); - - public abstract Icon getPrimaryIcon(); - - @Nullable - public abstract Drawable getAvatar(); - - @Px - public abstract int getStartingYPosition(); - - @NonNull - public abstract List<Action> getActions(); - - public static Builder builder() { - return new AutoValue_NewBubbleInfo.Builder().setActions(Collections.emptyList()); - } - - public static Builder from(@NonNull NewBubbleInfo bubbleInfo) { - return builder() - .setPrimaryColor(bubbleInfo.getPrimaryColor()) - .setPrimaryIcon(bubbleInfo.getPrimaryIcon()) - .setStartingYPosition(bubbleInfo.getStartingYPosition()) - .setActions(bubbleInfo.getActions()) - .setAvatar(bubbleInfo.getAvatar()); - } - - /** Builder for {@link NewBubbleInfo} */ - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder setPrimaryColor(@ColorInt int primaryColor); - - public abstract Builder setPrimaryIcon(@NonNull Icon primaryIcon); - - public abstract Builder setAvatar(@Nullable Drawable avatar); - - public abstract Builder setStartingYPosition(@Px int startingYPosition); - - public abstract Builder setActions(List<Action> actions); - - public abstract NewBubbleInfo build(); - } - - /** Represents actions to be shown in the bubble when expanded */ - @AutoValue - public abstract static class Action { - - public abstract Drawable getIconDrawable(); - - @Nullable - public abstract Drawable getSecondaryIconDrawable(); - - @NonNull - public abstract CharSequence getName(); - - @NonNull - public abstract PendingIntent getIntent(); - - public abstract boolean isCheckable(); - - public abstract boolean isChecked(); - - public static Builder builder() { - return new AutoValue_NewBubbleInfo_Action.Builder().setCheckable(true).setChecked(false); - } - - public static Builder from(@NonNull Action action) { - return builder() - .setIntent(action.getIntent()) - .setChecked(action.isChecked()) - .setCheckable(action.isCheckable()) - .setName(action.getName()) - .setIconDrawable(action.getIconDrawable()) - .setSecondaryIconDrawable(action.getSecondaryIconDrawable()); - } - - /** Builder for {@link Action} */ - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder setIconDrawable(Drawable iconDrawable); - - public abstract Builder setSecondaryIconDrawable(@Nullable Drawable secondaryIconDrawable); - - public abstract Builder setName(@NonNull CharSequence name); - - public abstract Builder setIntent(@NonNull PendingIntent intent); - - public abstract Builder setCheckable(boolean enabled); - - public abstract Builder setChecked(boolean checked); - - public abstract Action build(); - } - } -} diff --git a/java/com/android/newbubble/stub/NewBubbleStub.java b/java/com/android/newbubble/stub/NewBubbleStub.java deleted file mode 100644 index f5121cff9..000000000 --- a/java/com/android/newbubble/stub/NewBubbleStub.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.newbubble.stub; - -import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import com.android.newbubble.NewBubble; -import com.android.newbubble.NewBubbleInfo; -import com.android.newbubble.NewBubbleInfo.Action; -import java.util.List; -import javax.inject.Inject; - -public class NewBubbleStub implements NewBubble { - - @Inject - public NewBubbleStub() {} - - @Override - public void show() {} - - @Override - public void hide() {} - - @Override - public boolean isVisible() { - return false; - } - - @Override - public void setBubbleInfo(@NonNull NewBubbleInfo bubbleInfo) {} - - @Override - public void updateActions(@NonNull List<Action> actions) {} - - @Override - public void updatePhotoAvatar(@NonNull Drawable avatar) {} - - @Override - public void updateAvatar(@NonNull Drawable avatar) {} - - @Override - public void showText(@NonNull CharSequence text) {} -} diff --git a/java/com/android/newbubble/stub/StubNewBubbleModule.java b/java/com/android/newbubble/stub/StubNewBubbleModule.java deleted file mode 100644 index 227ba5e7e..000000000 --- a/java/com/android/newbubble/stub/StubNewBubbleModule.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.newbubble.stub; - -import com.android.newbubble.NewBubble; -import dagger.Binds; -import dagger.Module; -import javax.inject.Singleton; - -@Module -public abstract class StubNewBubbleModule { - - @Binds - @Singleton - public abstract NewBubble bindsNewBubble(NewBubbleStub newBubbleStub); -} |