release 0.1 #30

Manually merged
noemi3 merged 150 commits from release/0.1 into master 2020-01-18 14:59:02 +00:00
8 changed files with 116 additions and 8 deletions
Showing only changes of commit 6b2e7fab0f - Show all commits

View File

@ -68,11 +68,10 @@ dependencies {
testImplementation "com.squareup.okhttp3:mockwebserver:4.2.1"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
implementation "com.squareup.retrofit2:retrofit:2.6.2"
implementation "com.squareup.retrofit2:converter-gson:2.6.2"

View File

@ -0,0 +1,52 @@
package it.unisannio.ding.ids.wedroid.app.view
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.swipeDown
import androidx.test.espresso.action.ViewActions.swipeLeft
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import it.unisannio.ding.ids.wedroid.app.R
import it.unisannio.ding.ids.wedroid.app.view.adapter.BoardsListAdapter
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@LargeTest
class BoardsListsActivityTest {
@get:Rule
val activityRule = ActivityTestRule(BoardsListsActivity::class.java)
fun swipeLeftToDelete() {
onView(withId(R.id.boardList))
.perform(
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
0, swipeLeft()
)
)
}
fun pullToRefresh() {
onView(withId(R.id.pullToRefresh))
.perform(swipeDown())
}
@Test
fun openNewBoardActivity() {
onView(withId(R.id.fab))
.perform(click())
onView(withId(R.id.newBoardName))
.check(matches(isDisplayed()))
}
}

View File

@ -0,0 +1,37 @@
package it.unisannio.ding.ids.wedroid.app.view
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers.withDecorView
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import it.unisannio.ding.ids.wedroid.app.R
import org.hamcrest.core.IsNot.not
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@LargeTest
class NewBoardActivityTest {
@get:Rule
val activityRule = ActivityTestRule(NewBoardActivity::class.java)
@Test
fun showToastOnEmptyName() {
onView(withId(R.id.newBoardDone))
.perform(click())
onView(withText(R.string.on_add_new_board_empty_name))
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
.check(matches(isDisplayed()))
}
}

View File

@ -9,6 +9,7 @@ import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.Toast;
import it.unisannio.ding.ids.wedroid.app.R;
@ -28,6 +29,12 @@ public class NewBoardActivity extends AppCompatActivity {
}
public void onDone(View v) {
if (boardName.getText().toString().equals("")) {
Toast.makeText(this, R.string.on_add_new_board_empty_name, Toast.LENGTH_LONG)
.show();
return;
}
Intent data = new Intent();
data.putExtra(BOARD_NAME, boardName.getText().toString());
data.putExtra(BOARD_PRIVATE, isPrivate.isChecked());

View File

@ -33,6 +33,9 @@ class BoardsListAdapter internal constructor(
override fun onBindViewHolder(holder: BoardViewHolder, position: Int) {
val board = boards[position]
holder.itemView.setOnClickListener {
// TODO start board activity
}
holder.boardTitle.text = board.title
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

View File

@ -23,11 +23,11 @@
<include layout="@layout/content_boards_lists" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/ic_add_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -8,4 +8,5 @@
<string name="new_board_done_button">Done</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_empty_name">Name cannot be empty</string>
</resources>