2010-09-17 15:00:07 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2010 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-06-05 22:57:57 -04:00
|
|
|
package com.android.launcher3;
|
2010-09-17 15:00:07 -07:00
|
|
|
|
|
|
|
|
import android.content.ComponentName;
|
|
|
|
|
|
2022-09-07 15:40:41 -07:00
|
|
|
import androidx.annotation.NonNull;
|
2020-05-06 22:19:43 -07:00
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
2023-02-07 13:40:11 -08:00
|
|
|
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
2020-04-06 15:11:17 -07:00
|
|
|
|
2020-05-06 22:19:43 -07:00
|
|
|
import java.util.Optional;
|
|
|
|
|
|
2010-09-17 15:00:07 -07:00
|
|
|
/**
|
2020-05-06 22:19:43 -07:00
|
|
|
* Meta data that is used for deferred binding. e.g., this object is used to pass information on
|
|
|
|
|
* draggable targets when they are dropped onto the workspace from another container.
|
2010-09-17 15:00:07 -07:00
|
|
|
*/
|
2023-02-07 13:40:11 -08:00
|
|
|
public class PendingAddItemInfo extends ItemInfoWithIcon {
|
2015-04-08 19:01:34 -07:00
|
|
|
|
2010-09-17 15:00:07 -07:00
|
|
|
/**
|
|
|
|
|
* The component that will be created.
|
|
|
|
|
*/
|
2015-04-08 19:01:34 -07:00
|
|
|
public ComponentName componentName;
|
2016-09-01 10:55:20 -07:00
|
|
|
|
2023-02-07 13:40:11 -08:00
|
|
|
public PendingAddItemInfo() { }
|
|
|
|
|
|
|
|
|
|
public PendingAddItemInfo(PendingAddItemInfo info) {
|
|
|
|
|
super(info);
|
|
|
|
|
componentName = info.componentName;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-01 10:55:20 -07:00
|
|
|
@Override
|
|
|
|
|
protected String dumpProperties() {
|
|
|
|
|
return super.dumpProperties() + " componentName=" + componentName;
|
|
|
|
|
}
|
2020-05-06 22:19:43 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns shallow copy of the object.
|
|
|
|
|
*/
|
2022-09-07 15:40:41 -07:00
|
|
|
@NonNull
|
2020-05-06 22:19:43 -07:00
|
|
|
@Override
|
2023-02-07 13:40:11 -08:00
|
|
|
public PendingAddItemInfo makeShallowCopy() {
|
2020-05-06 22:19:43 -07:00
|
|
|
PendingAddItemInfo itemInfo = new PendingAddItemInfo();
|
|
|
|
|
itemInfo.copyFrom(this);
|
|
|
|
|
itemInfo.componentName = this.componentName;
|
|
|
|
|
return itemInfo;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-07 13:40:11 -08:00
|
|
|
@Override
|
|
|
|
|
public PendingAddItemInfo clone() {
|
|
|
|
|
return makeShallowCopy();
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-06 22:19:43 -07:00
|
|
|
@Nullable
|
|
|
|
|
@Override
|
|
|
|
|
public ComponentName getTargetComponent() {
|
|
|
|
|
return Optional.ofNullable(super.getTargetComponent()).orElse(componentName);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-13 19:27:37 -08:00
|
|
|
}
|