Skip to content

Instantly share code, notes, and snippets.

List<UIComponent> UIComponentList = new ArrayList<>();
executor.execute( () ->
{
for (Component component : components)
{
UIComponent uiComponent = new UIComponent(component.componentID, component.getName(), component.getCode(), component.getImgPath());
uiComponent.setCategoryName(getDao().getComponentCategory(component.componentCategoryID).getName());
uiComponent.setAmount(getDao().getAmountOfComponents(component.rackID));
UIComponentList.add(uiComponent);
private UICompany uiCompany;
public void setViewModelElements()
{
executor.execute(() ->
{
uiCompany = companyRepository.getUiCompany();
});
}
// manually sets the storage to storageUI
private List<UIStorage> createStorageUIList(List<Storage> storageUnits, Executor executor)
{
List<UIStorage> UIStorageList = new ArrayList<>();
for (Storage storage : storageUnits)
{
executor.execute(() ->
{
UIStorageList.add(createUIStorage(storage));
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/company_img">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/background"
tools:context=".RegistrationActivity">
<data>
<import type="android.view.View" />
// adds the component
// checks if category is new
public void addComponent()
{
if (newCategoryObsv.get())
{
executor.execute(() ->
{
componentRepository.insertComponent(rackID, processNewCategoryInput(), uiComponent.nameObsv.get(), uiComponent.codeObsv.get(),
uiComponent.getImgPath(), 0);
SELECT id, rack_id, component_category_id, name, code, img_path, COUNT(id) as count
FROM component
WHERE rack_id = 1
GROUP BY code
<?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"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#65030303">
// get all components belonging to a rack
@Query("SELECT c.id, cc.name as category_name, c.rack_id, c.component_category_id, c.name, c.img_path, c.code, " +
" (SELECT COUNT(c.name) " +
" FROM rack r " +
" WHERE c.rack_id = : rackID ) as count " +
"FROM component c " +
"INNER JOIN component_category cc ON cc.id = c.component_category_id " +
"WHERE c.rack_id = :rackID and cc.id = c.component_category_id " +
"ORDER BY c.name ASC")
LiveData<List<Component>> getRackComponents(long rackID);
package com.mwb.digitalstorage;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import com.mwb.digitalstorage.command_handlers.RegistrationCmdHandler;