-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profile] Replace individual extras with ProfileQueueItem
Signed-off-by: Muntashir Al-Islam <[email protected]>
- Loading branch information
1 parent
e0768ab
commit 7f9eed9
Showing
3 changed files
with
115 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
app/src/main/java/io/github/muntashirakon/AppManager/profiles/ProfileQueueItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
package io.github.muntashirakon.AppManager.profiles; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
import io.github.muntashirakon.AppManager.profiles.ProfileApplierActivity.ProfileApplierInfo; | ||
import io.github.muntashirakon.AppManager.profiles.struct.AppsProfile; | ||
|
||
public class ProfileQueueItem implements Parcelable { | ||
@NonNull | ||
public static ProfileQueueItem fromProfiledApplierInfo(@NonNull ProfileApplierInfo info) { | ||
return new ProfileQueueItem(info.profile, info.state); | ||
} | ||
|
||
@NonNull | ||
private final String mProfileId; | ||
@NonNull | ||
private final String mProfileName; | ||
@Nullable | ||
private final String mState; | ||
|
||
private ProfileQueueItem(@NonNull AppsProfile profile, @Nullable String state) { | ||
mProfileId = profile.profileId; | ||
mProfileName = profile.name; | ||
mState = state; | ||
} | ||
|
||
protected ProfileQueueItem(@NonNull Parcel in) { | ||
mProfileId = Objects.requireNonNull(in.readString()); | ||
mProfileName = Objects.requireNonNull(in.readString()); | ||
mState = in.readString(); | ||
} | ||
|
||
@NonNull | ||
public String getProfileId() { | ||
return mProfileId; | ||
} | ||
|
||
@NonNull | ||
public String getProfileName() { | ||
return mProfileName; | ||
} | ||
|
||
@Nullable | ||
public String getState() { | ||
return mState; | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(@NonNull Parcel dest, int flags) { | ||
dest.writeString(mProfileId); | ||
dest.writeString(mProfileName); | ||
dest.writeString(mState); | ||
} | ||
|
||
public static final Creator<ProfileQueueItem> CREATOR = new Creator<ProfileQueueItem>() { | ||
@NonNull | ||
@Override | ||
public ProfileQueueItem createFromParcel(@NonNull Parcel in) { | ||
return new ProfileQueueItem(in); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public ProfileQueueItem[] newArray(int size) { | ||
return new ProfileQueueItem[size]; | ||
} | ||
}; | ||
} |