Nit Fixes

Signed-off-by: Priyank Shankar <shankarpriyank312002@gmail.com>
This commit is contained in:
Priyank Shankar 2022-06-13 12:23:13 +05:30
parent f0167ca55f
commit a04175edbd
3 changed files with 51 additions and 44 deletions

View file

@ -95,17 +95,12 @@ dependencies {
implementation 'net.jcip:jcip-annotations:1.0'
// Test Dependencies
testImplementation "junit:junit:$jUnitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-inline:$mockitoVersion"
//Android Auto
implementation "androidx.car.app:app:1.2.0-rc01"
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.6.0'
testImplementation 'org.mockito:mockito-inline:4.6.0'
//Android Auto
implementation "androidx.car.app:app:1.2.0-rc01"
}
def run(cmd) {

View file

@ -9,17 +9,20 @@ import androidx.car.app.model.PaneTemplate;
import androidx.car.app.model.Row;
import androidx.car.app.model.Template;
public class HelloWorldScreen extends Screen {
public HelloWorldScreen(@NonNull CarContext carContext) {
super(carContext);
}
public class HelloWorldScreen extends Screen
{
public HelloWorldScreen(@NonNull CarContext carContext)
{
super(carContext);
}
@NonNull
@Override
public Template onGetTemplate() {
Row row = new Row.Builder().setTitle("Hello AA Organic Maps!").build();
return new PaneTemplate.Builder(new Pane.Builder().addRow(row).build())
.setHeaderAction(Action.APP_ICON)
.build();
}
@NonNull
@Override
public Template onGetTemplate()
{
Row row = new Row.Builder().setTitle("Hello AA Organic Maps!").build();
return new PaneTemplate.Builder(new Pane.Builder().addRow(row).build())
.setHeaderAction(Action.APP_ICON)
.build();
}
}

View file

@ -10,33 +10,42 @@ import androidx.car.app.Screen;
import androidx.car.app.Session;
import androidx.car.app.validation.HostValidator;
public final class HelloWorldService extends CarAppService {
public final class HelloWorldService extends CarAppService
{
public HelloWorldService() {
// Exported services must have an empty public constructor.
}
public HelloWorldService()
{
// Exported services must have an empty public constructor.
}
@Override
@NonNull
public Session onCreateSession() {
return new Session() {
@Override
@NonNull
public Screen onCreateScreen(@Nullable Intent intent) {
return new HelloWorldScreen(getCarContext());
}
};
}
@Override
@NonNull
public Session onCreateSession()
{
return new Session()
{
@Override
@NonNull
public Screen onCreateScreen(@Nullable Intent intent)
{
return new HelloWorldScreen(getCarContext());
}
};
}
@NonNull
@Override
public HostValidator createHostValidator() {
if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR;
} else {
return new HostValidator.Builder(getApplicationContext())
.addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample)
.build();
}
@NonNull
@Override
public HostValidator createHostValidator()
{
if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
{
return HostValidator.ALLOW_ALL_HOSTS_VALIDATOR;
}
else
{
return new HostValidator.Builder(getApplicationContext())
.addAllowedHosts(androidx.car.app.R.array.hosts_allowlist_sample)
.build();
}
}
}