This file contains hidden or 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
| public class TaskDeserializer extends StdDeserializer<TaskWrapper> { | |
| public TaskDeserializer() { | |
| super(TaskWrapper.class); | |
| } | |
| @Override | |
| public JsonParserUtil deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { | |
| List<Task> trackList = new ArrayList<>(); |
This file contains hidden or 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
| @JsonDeserialize(using = TaskDeserializer.class) | |
| public class TaskWrapper { | |
| @JsonProperty("tasks") | |
| private List<Task> tasks; | |
| } |
This file contains hidden or 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
| public class User { | |
| @JsonProperty("name") | |
| private String name; | |
| @JsonProperty("tasks") | |
| private TaskUtil tasks; | |
| } |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto"> | |
| <data> | |
| <variable | |
| name="vm" | |
| type="your.package.RecyclerViewWithClickVM" /> | |
| </data> |
This file contains hidden or 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
| public class RecyclerViewWithClickVM { | |
| private RecyclerView.LayoutManager layoutManager; | |
| private List<Object> objectList = new ArrayList<>(); | |
| @BindingAdapter("adapter") | |
| public static void bindAdapter(RecyclerView recyclerView, List<Object> objectList) { | |
| YourAdapter adapter = new YourAdapter(objectList); | |
| recyclerView.setAdapter(adapter); |
This file contains hidden or 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
| RecyclerViewWithClick recyclerViewWithClick = ...; | |
| recyclerViewWithClick.setOnItemClickListener(new RecyclerViewWithClick.OnItemClickListener() { | |
| @Override | |
| public void onItemClicked(RecyclerViewWithClick recyclerView, int position, View v) { | |
| } | |
| }); |
This file contains hidden or 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
| public class RecyclerViewWithClick extends RecyclerView { | |
| private OnItemClickListener mOnItemClickListener; | |
| private OnItemLongClickListener mOnItemLongClickListener; | |
| private View.OnClickListener mOnClickListener = new View.OnClickListener() { | |
| @Override | |
| public void onClick(View v) { | |
| if (mOnItemClickListener != null) { | |
| RecyclerView.ViewHolder holder = getChildViewHolder(v); |
This file contains hidden or 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
| spring.jpa.database=POSTGRESQL | |
| spring.datasource.platform=postgres | |
| spring.datasource.url=jdbc:postgresql://Host:Port/DatabaseName?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory | |
| spring.datasource.username=User | |
| spring.datasource.password=Password | |
| spring.datasource.driver-class-name=org.postgresql.Driver | |
| spring.datasource.testWhileIdle=true | |
| spring.datasource.validationQuery=SELECT 1 | |
| spring.datasource.timeBetweenEvictionRunsMillis=3600000 |
This file contains hidden or 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
| @SpringBootApplication | |
| @ComponentScan | |
| public class SpringBootApp extends SpringBootServletInitializer { | |
| public static void main(String[] args) { | |
| SpringApplication.run(SpringBootApp.class, args); | |
| } | |
| @Override | |
| protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | |
| return application.sources(SpringBootApp.class); |
This file contains hidden or 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
| @Configuration | |
| @PropertySource({ "classpath:application.properties" }) | |
| public class DatabaseConfig { | |
| @Bean | |
| @Primary | |
| @ConfigurationProperties(prefix = "spring.datasource") | |
| public DataSource dataSource() { | |
| return DataSourceBuilder.create().build(); | |
| } | |
| } |