add login and board_list #26
@ -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.content_boards_lists.*
|
||||
import java.util.Locale
|
||||
|
||||
class BoardsListsActivity : AppCompatActivity() {
|
||||
private lateinit var viewModel: BoardsListViewModel
|
||||
@ -118,7 +119,11 @@ class BoardsListsActivity : AppCompatActivity() {
|
||||
|
||||
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 {
|
||||
|
@ -6,16 +6,21 @@ import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import it.unisannio.ding.ids.wedroid.app.R;
|
||||
import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor;
|
||||
|
||||
public class NewBoardActivity extends AppCompatActivity {
|
||||
private EditText boardName;
|
||||
private Switch isPrivate;
|
||||
private Spinner colorPicker;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -26,6 +31,16 @@ public class NewBoardActivity extends AppCompatActivity {
|
||||
|
||||
boardName = findViewById(R.id.newBoardName);
|
||||
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) {
|
||||
@ -38,6 +53,7 @@ public class NewBoardActivity extends AppCompatActivity {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(BOARD_NAME, boardName.getText().toString());
|
||||
data.putExtra(BOARD_PRIVATE, isPrivate.isChecked());
|
||||
data.putExtra(BOARD_BACKGROUND_COLOR, colorPicker.getSelectedItem().toString());
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
@ -49,4 +65,5 @@ public class NewBoardActivity extends AppCompatActivity {
|
||||
public static final int RESULT_OK = 17;
|
||||
public static final String BOARD_NAME = "BOARD_NAME";
|
||||
public static final String BOARD_PRIVATE = "BOARD_PRIVATE";
|
||||
public static final String BOARD_BACKGROUND_COLOR = "BOARD_BACKGROUND_COLOR";
|
||||
}
|
||||
|
@ -14,13 +14,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/new_board_name_field"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPersonName"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.25"
|
||||
android:importantForAutofill="no" />
|
||||
app:layout_constraintVertical_bias="0.20999998" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/newBoardPermission"
|
||||
@ -44,7 +44,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/newBoardPermission"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/newBoardPermission"
|
||||
app:layout_constraintTop_toTopOf="@+id/newBoardColor"
|
||||
app:layout_constraintVertical_bias="0.40" />
|
||||
|
||||
<Button
|
||||
@ -57,6 +57,16 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/newBoardPermission"
|
||||
app:layout_constraintTop_toBottomOf="@+id/newBoardPermission"
|
||||
app:layout_constraintTop_toTopOf="@+id/newBoardColor"
|
||||
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>
|
@ -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_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-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>
|
||||
|
@ -10,7 +10,7 @@ public enum BoardBackgroundColor {
|
||||
@SerializedName("pomegranate")
|
||||
POMEGRANATE,
|
||||
@SerializedName("pumpkin")
|
||||
PUMPIK,
|
||||
PUMPKIN,
|
||||
@SerializedName("wisteria")
|
||||
WISTERIA,
|
||||
@SerializedName("moderatepink")
|
||||
|
Loading…
Reference in New Issue
Block a user