• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.intelligence.suggestions.model;
18 
19 /**
20  * A category for {@link android.service.settings.suggestions.Suggestion}.
21  * <p/>
22  * Each suggestion can sepcify it belongs to 1 or more categories. This metadata will be used to
23  * help determine when to show a suggestion to user.
24  */
25 public class SuggestionCategory {
26     private final String mCategory;
27     private final boolean mExclusive;
28     private final long mExclusiveExpireDaysInMillis;
29 
SuggestionCategory(Builder builder)30     private SuggestionCategory(Builder builder) {
31         this.mCategory = builder.mCategory;
32         this.mExclusive = builder.mExclusive;
33         this.mExclusiveExpireDaysInMillis = builder.mExclusiveExpireDaysInMillis;
34     }
35 
getCategory()36     public String getCategory() {
37         return mCategory;
38     }
39 
isExclusive()40     public boolean isExclusive() {
41         return mExclusive;
42     }
43 
getExclusiveExpireDaysInMillis()44     public long getExclusiveExpireDaysInMillis() {
45         return mExclusiveExpireDaysInMillis;
46     }
47 
48     public static class Builder {
49         private String mCategory;
50         private boolean mExclusive;
51         private long mExclusiveExpireDaysInMillis;
52 
setCategory(String category)53         public Builder setCategory(String category) {
54             mCategory = category;
55             return this;
56         }
57 
setExclusive(boolean exclusive)58         public Builder setExclusive(boolean exclusive) {
59             mExclusive = exclusive;
60             return this;
61         }
62 
setExclusiveExpireDaysInMillis(long exclusiveExpireDaysInMillis)63         public Builder setExclusiveExpireDaysInMillis(long exclusiveExpireDaysInMillis) {
64             mExclusiveExpireDaysInMillis = exclusiveExpireDaysInMillis;
65             return this;
66         }
67 
build()68         public SuggestionCategory build() {
69             return new SuggestionCategory(this);
70         }
71     }
72 }
73