release 0.1 #30
@ -18,6 +18,7 @@ import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor
|
|||||||
|
|
||||||
import kotlinx.android.synthetic.main.activity_boards_lists.*
|
import kotlinx.android.synthetic.main.activity_boards_lists.*
|
||||||
import kotlinx.android.synthetic.main.content_boards_lists.*
|
import kotlinx.android.synthetic.main.content_boards_lists.*
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class BoardsListsActivity : AppCompatActivity() {
|
class BoardsListsActivity : AppCompatActivity() {
|
||||||
private lateinit var viewModel: BoardsListViewModel
|
private lateinit var viewModel: BoardsListViewModel
|
||||||
@ -118,7 +119,11 @@ class BoardsListsActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val isPrivate = data.getBooleanExtra(NewBoardActivity.BOARD_PRIVATE, true)
|
val isPrivate = data.getBooleanExtra(NewBoardActivity.BOARD_PRIVATE, true)
|
||||||
|
|
||||||
viewModel.insertBoard(title, isPrivate, BoardBackgroundColor.LIMEGREEN) // TODO
|
val colorName = data.getStringExtra(NewBoardActivity.BOARD_BACKGROUND_COLOR) ?: "belize"
|
||||||
|
val backgroundColor = BoardBackgroundColor
|
||||||
|
.valueOf(colorName.toUpperCase(Locale.ROOT))
|
||||||
|
|
||||||
|
viewModel.insertBoard(title, isPrivate, backgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -6,16 +6,21 @@ import android.os.Bundle;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import it.unisannio.ding.ids.wedroid.app.R;
|
import it.unisannio.ding.ids.wedroid.app.R;
|
||||||
|
import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor;
|
||||||
|
|
||||||
public class NewBoardActivity extends AppCompatActivity {
|
public class NewBoardActivity extends AppCompatActivity {
|
||||||
private EditText boardName;
|
private EditText boardName;
|
||||||
private Switch isPrivate;
|
private Switch isPrivate;
|
||||||
|
private Spinner colorPicker;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -26,6 +31,16 @@ public class NewBoardActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
boardName = findViewById(R.id.newBoardName);
|
boardName = findViewById(R.id.newBoardName);
|
||||||
isPrivate = findViewById(R.id.newBoardPermission);
|
isPrivate = findViewById(R.id.newBoardPermission);
|
||||||
|
|
||||||
|
colorPicker = findViewById(R.id.newBoardColor);
|
||||||
|
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
||||||
|
this,
|
||||||
|
R.array.board_background_colors,
|
||||||
|
android.R.layout.simple_spinner_item
|
||||||
|
);
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
colorPicker.setAdapter(adapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDone(View v) {
|
public void onDone(View v) {
|
||||||
@ -38,6 +53,7 @@ public class NewBoardActivity extends AppCompatActivity {
|
|||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra(BOARD_NAME, boardName.getText().toString());
|
data.putExtra(BOARD_NAME, boardName.getText().toString());
|
||||||
data.putExtra(BOARD_PRIVATE, isPrivate.isChecked());
|
data.putExtra(BOARD_PRIVATE, isPrivate.isChecked());
|
||||||
|
data.putExtra(BOARD_BACKGROUND_COLOR, colorPicker.getSelectedItem().toString());
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -49,4 +65,5 @@ public class NewBoardActivity extends AppCompatActivity {
|
|||||||
public static final int RESULT_OK = 17;
|
public static final int RESULT_OK = 17;
|
||||||
public static final String BOARD_NAME = "BOARD_NAME";
|
public static final String BOARD_NAME = "BOARD_NAME";
|
||||||
public static final String BOARD_PRIVATE = "BOARD_PRIVATE";
|
public static final String BOARD_PRIVATE = "BOARD_PRIVATE";
|
||||||
|
public static final String BOARD_BACKGROUND_COLOR = "BOARD_BACKGROUND_COLOR";
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,18 @@
|
|||||||
tools:showIn="@layout/activity_new_board">
|
tools:showIn="@layout/activity_new_board">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/newBoardName"
|
android:id="@+id/newBoardName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="@string/new_board_name_field"
|
android:hint="@string/new_board_name_field"
|
||||||
android:inputType="textPersonName"
|
android:importantForAutofill="no"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:inputType="textPersonName"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.25"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:importantForAutofill="no" />
|
app:layout_constraintVertical_bias="0.20999998" />
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/newBoardPermission"
|
android:id="@+id/newBoardPermission"
|
||||||
@ -35,28 +35,38 @@
|
|||||||
app:layout_constraintVertical_bias="0.1" />
|
app:layout_constraintVertical_bias="0.1" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/newBoardDone"
|
android:id="@+id/newBoardDone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:onClick="onDone"
|
android:onClick="onDone"
|
||||||
android:text="@string/new_board_done_button"
|
android:text="@string/new_board_done_button"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/newBoardPermission"
|
app:layout_constraintEnd_toStartOf="@+id/newBoardPermission"
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/newBoardPermission"
|
app:layout_constraintTop_toTopOf="@+id/newBoardColor"
|
||||||
app:layout_constraintVertical_bias="0.40" />
|
app:layout_constraintVertical_bias="0.40" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/newBoardCancel"
|
android:id="@+id/newBoardCancel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:onClick="onCancel"
|
android:onClick="onCancel"
|
||||||
android:text="@string/new_board_cancel_button"
|
android:text="@string/new_board_cancel_button"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toEndOf="@+id/newBoardPermission"
|
app:layout_constraintStart_toEndOf="@+id/newBoardPermission"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/newBoardPermission"
|
app:layout_constraintTop_toTopOf="@+id/newBoardColor"
|
||||||
app:layout_constraintVertical_bias="0.40" />
|
app:layout_constraintVertical_bias="0.40" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/newBoardColor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/newBoardPermission"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/newBoardPermission"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/newBoardPermission"
|
||||||
|
app:layout_constraintVertical_bias="0.120000005" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -9,4 +9,19 @@
|
|||||||
<string name="on_null_new_board_name">There was a problem with the name of the new board</string>
|
<string name="on_null_new_board_name">There was a problem with the name of the new board</string>
|
||||||
<string name="on_add_new_board_error">It was not possible to add a new board</string>
|
<string name="on_add_new_board_error">It was not possible to add a new board</string>
|
||||||
<string name="on_add_new_board_empty_name">Name cannot be empty</string>
|
<string name="on_add_new_board_empty_name">Name cannot be empty</string>
|
||||||
|
|
||||||
|
<string-array name="board_background_colors">
|
||||||
|
<item>Belize</item>
|
||||||
|
<item>Nephritis</item>
|
||||||
|
<item>Pomegranate</item>
|
||||||
|
<item>Pumpkin</item>
|
||||||
|
<item>Wisteria</item>
|
||||||
|
<item>Moderatepink</item>
|
||||||
|
<item>Strongcyan</item>
|
||||||
|
<item>Limegreen</item>
|
||||||
|
<item>Midnight</item>
|
||||||
|
<item>Dark</item>
|
||||||
|
<item>Relax</item>
|
||||||
|
<item>Corteza</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -10,7 +10,7 @@ public enum BoardBackgroundColor {
|
|||||||
@SerializedName("pomegranate")
|
@SerializedName("pomegranate")
|
||||||
POMEGRANATE,
|
POMEGRANATE,
|
||||||
@SerializedName("pumpkin")
|
@SerializedName("pumpkin")
|
||||||
PUMPIK,
|
PUMPKIN,
|
||||||
@SerializedName("wisteria")
|
@SerializedName("wisteria")
|
||||||
WISTERIA,
|
WISTERIA,
|
||||||
@SerializedName("moderatepink")
|
@SerializedName("moderatepink")
|
||||||
|
Loading…
Reference in New Issue
Block a user