Define a constant Sliceable#NO_RES for no resource cases

Fix: 204733076
Test: build
Change-Id: Ifa3b9db0e915a3ec056ad68a9a1862811594d423
This commit is contained in:
Jason Chiu
2021-11-03 12:18:39 +08:00
parent 6821b6be32
commit 9fc0f18181
11 changed files with 21 additions and 14 deletions

View File

@@ -25,6 +25,7 @@ import android.content.IntentFilter;
import android.net.Uri;
import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.slice.Slice;
import com.android.settings.R;
@@ -135,10 +136,16 @@ public interface Sliceable {
}
/**
* @return a resource ID that indicates which menu entry should be highlighted in multi-pane
* mode.
* Used to mark a {@link Sliceable} that has no highlight menu string resource.
*/
default int getSliceHighlightMenuRes() {
return 0;
int NO_RES = 0;
/**
* @return a string resource declared in res/values/menu_keys.xml that indicates which menu
* entry should be highlighted in two-pane mode, or {@link #NO_RES} representing highlighting is
* not applicable.
*/
@StringRes default int getSliceHighlightMenuRes() {
return NO_RES;
}
}