Merge remote-tracking branch 'origin/feature_integrate_login' into feature_board_view
Some checks failed
continuous-integration/drone/push Build is failing

# Conflicts:
#	app/build.gradle
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/it/unisannio/ding/ids/wedroid/app/MainActivity.kt
#	app/src/main/java/it/unisannio/ding/ids/wedroid/app/util/PreferenceReader.java
#	app/src/main/java/it/unisannio/ding/ids/wedroid/app/util/PreferenceWriter.java
#	app/src/main/java/it/unisannio/ding/ids/wedroid/app/util/ServicesFactory.kt
#	app/src/main/java/it/unisannio/ding/ids/wedroid/app/util/SharedPreferenceHelper.kt
#	app/src/main/res/layout/activity_main.xml
#	app/src/main/res/values/dimens.xml
#	app/src/main/res/values/strings.xml
#	app/src/main/res/values/styles.xml
#	build.gradle
This commit is contained in:
Umberto Furno 2020-01-10 16:27:30 +01:00
parent 7295be413d
commit 8b6104e0fa
19 changed files with 152 additions and 152 deletions

View File

@ -12,6 +12,7 @@ import it.unisannio.ding.ids.wedroid.app.data.entity.Board;
@Database(entities = Board.class, version = 1, exportSchema = false) @Database(entities = Board.class, version = 1, exportSchema = false)
public abstract class BoardDatabase extends RoomDatabase { public abstract class BoardDatabase extends RoomDatabase {
private static volatile BoardDatabase INSTANCE; private static volatile BoardDatabase INSTANCE;
public abstract BoardDao boardDao(); public abstract BoardDao boardDao();
public static BoardDatabase getDatabase(Context context) { public static BoardDatabase getDatabase(Context context) {

View File

@ -12,6 +12,7 @@ import it.unisannio.ding.ids.wedroid.app.data.entity.WList;
@Database(entities = WList.class, version = 2, exportSchema = false) @Database(entities = WList.class, version = 2, exportSchema = false)
public abstract class WListDatabase extends RoomDatabase { public abstract class WListDatabase extends RoomDatabase {
private static volatile WListDatabase INSTANCE; private static volatile WListDatabase INSTANCE;
public abstract WListDao wListDao(); public abstract WListDao wListDao();
public static WListDatabase getDatabase(Context context) { public static WListDatabase getDatabase(Context context) {

View File

@ -50,8 +50,8 @@ class WListRepository(
} }
private fun synchronizeCallback( private fun synchronizeCallback(
response: Response<MutableList<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>>) response: Response<MutableList<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>>
{ ) {
if (!response.isSuccessful) { if (!response.isSuccessful) {
logNetworkError("${response.code()} ${response.message()}") logNetworkError("${response.code()} ${response.message()}")
return return
@ -67,7 +67,10 @@ class WListRepository(
fun deleteWList(idBoard: String, idWList: String) { fun deleteWList(idBoard: String, idWList: String) {
service.deleteList(idBoard, idWList).enqueue( service.deleteList(idBoard, idWList).enqueue(
object : Callback<it.unisannio.ding.ids.wedroid.wrapper.entity.WList> { object : Callback<it.unisannio.ding.ids.wedroid.wrapper.entity.WList> {
override fun onFailure(call: Call<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>, t: Throwable) { override fun onFailure(
call: Call<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>,
t: Throwable
) {
logNetworkError(t.message) logNetworkError(t.message)
} }
@ -82,15 +85,15 @@ class WListRepository(
}) })
} }
private fun deleteWListCallBack(response: Response<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>, private fun deleteWListCallBack(
id: String) { response: Response<it.unisannio.ding.ids.wedroid.wrapper.entity.WList>,
id: String
) {
if (!response.isSuccessful) { if (!response.isSuccessful) {
logNetworkError("${response.code()} ${response.message()}") logNetworkError("${response.code()} ${response.message()}")
return return
} }
dao.delete(WList(id)) dao.delete(WList(id))
} }
private fun addNewWListToDb(wLists: Collection<WList>) { private fun addNewWListToDb(wLists: Collection<WList>) {
@ -99,7 +102,6 @@ class WListRepository(
} }
} }
private fun removeOldWListsFromDb(wLists: Collection<WList>) { private fun removeOldWListsFromDb(wLists: Collection<WList>) {
allWLists.value?.minus(wLists) allWLists.value?.minus(wLists)
?.forEach { ?.forEach {

View File

@ -2,7 +2,10 @@ package it.unisannio.ding.ids.wedroid.app.util;
public interface PreferenceReader { public interface PreferenceReader {
String getBaseUrl(); String getBaseUrl();
String getUserId(); String getUserId();
String getToken(); String getToken();
String getBoardId(); String getBoardId();
} }

View File

@ -2,7 +2,10 @@ package it.unisannio.ding.ids.wedroid.app.util;
public interface PreferenceWriter { public interface PreferenceWriter {
void setBaseUrl(String baseUrl); void setBaseUrl(String baseUrl);
void setUserId(String userId); void setUserId(String userId);
void setToken(String token); void setToken(String token);
void setBoardId(String boardId); void setBoardId(String boardId);
} }

View File

@ -1,6 +1,12 @@
package it.unisannio.ding.ids.wedroid.app.util package it.unisannio.ding.ids.wedroid.app.util
import it.unisannio.ding.ids.wedroid.wrapper.api.* import it.unisannio.ding.ids.wedroid.wrapper.api.BoardService
import it.unisannio.ding.ids.wedroid.wrapper.api.CardCommentService
import it.unisannio.ding.ids.wedroid.wrapper.api.CardService
import it.unisannio.ding.ids.wedroid.wrapper.api.ChecklistService
import it.unisannio.ding.ids.wedroid.wrapper.api.UserService
import it.unisannio.ding.ids.wedroid.wrapper.api.ListService
import it.unisannio.ding.ids.wedroid.wrapper.api.SwimlanesService
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory

View File

@ -20,7 +20,6 @@ class SharedPreferenceHelper(context : Context) : PreferenceReader, PreferenceWr
override fun setBaseUrl(baseUrl: String?) { override fun setBaseUrl(baseUrl: String?) {
val editor = sp.edit() val editor = sp.edit()
editor.putString("url", baseUrl).apply() editor.putString("url", baseUrl).apply()
} }
override fun setUserId(userId: String?) { override fun setUserId(userId: String?) {

View File

@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -149,6 +150,7 @@ public class BoardViewActivity extends AppCompatActivity {
listView.setAdapter(adapter); listView.setAdapter(adapter);
} }
} }
@Override @Override
public void onFailure(@NotNull Call<Board> call, @NotNull Throwable t) { public void onFailure(@NotNull Call<Board> call, @NotNull Throwable t) {
Toast.makeText(getApplicationContext(), Toast.makeText(getApplicationContext(),
@ -162,38 +164,27 @@ public class BoardViewActivity extends AppCompatActivity {
String encodedColor; String encodedColor;
if (color.equalsIgnoreCase("belize")) { if (color.equalsIgnoreCase("belize")) {
encodedColor = "#2980B9"; encodedColor = "#2980B9";
} } else if (color.equalsIgnoreCase("nephritis")) {
else if(color.equalsIgnoreCase("nephritis")){
encodedColor = "#27AE60"; encodedColor = "#27AE60";
} } else if (color.equalsIgnoreCase("pomegranate")) {
else if(color.equalsIgnoreCase("pomegranate")){
encodedColor = "#C0392B"; encodedColor = "#C0392B";
} } else if (color.equalsIgnoreCase("pumpkin")) {
else if(color.equalsIgnoreCase("pumpkin")){
encodedColor = "#E67E22"; encodedColor = "#E67E22";
} } else if (color.equalsIgnoreCase("wisteria")) {
else if(color.equalsIgnoreCase("wisteria")){
encodedColor = "#8E44AD"; encodedColor = "#8E44AD";
} } else if (color.equalsIgnoreCase("moderatepink")) {
else if(color.equalsIgnoreCase("moderatepink")){
encodedColor = "#CD5A91"; encodedColor = "#CD5A91";
} } else if (color.equalsIgnoreCase("strongcyan")) {
else if(color.equalsIgnoreCase("strongcyan")){
encodedColor = "#00AECC"; encodedColor = "#00AECC";
} } else if (color.equalsIgnoreCase("dark")) {
else if(color.equalsIgnoreCase("dark")){
encodedColor = "#2C3E51"; encodedColor = "#2C3E51";
} } else if (color.equalsIgnoreCase("midnight")) {
else if(color.equalsIgnoreCase("midnight")){
encodedColor = "#2C3E50"; encodedColor = "#2C3E50";
} } else if (color.equalsIgnoreCase("relax")) {
else if(color.equalsIgnoreCase("relax")){
encodedColor = "#27AE61"; encodedColor = "#27AE61";
} } else if (color.equalsIgnoreCase("corteza")) {
else if(color.equalsIgnoreCase("corteza")){
encodedColor = "#568BA2"; encodedColor = "#568BA2";
} } else
else
encodedColor = "#38DF87"; encodedColor = "#38DF87";
return encodedColor; return encodedColor;
@ -209,8 +200,7 @@ public class BoardViewActivity extends AppCompatActivity {
username = u.getUsername(); username = u.getUsername();
if (u.isAdmin()) { if (u.isAdmin()) {
members.append("Admin: " + username + ";\n"); members.append("Admin: " + username + ";\n");
} } else
else
members.append("Other member: " + username + ";\n"); members.append("Other member: " + username + ";\n");
} }

View File

@ -23,7 +23,7 @@ import java.util.Objects;
import it.unisannio.ding.ids.wedroid.app.R; import it.unisannio.ding.ids.wedroid.app.R;
import it.unisannio.ding.ids.wedroid.app.viewmodel.WListsListViewModel; import it.unisannio.ding.ids.wedroid.app.viewModel.WListsListViewModel;
import it.unisannio.ding.ids.wedroid.app.data.entity.WList; import it.unisannio.ding.ids.wedroid.app.data.entity.WList;
import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper; import it.unisannio.ding.ids.wedroid.app.util.SharedPreferenceHelper;
import it.unisannio.ding.ids.wedroid.app.view.adapter.WListsAdapter; import it.unisannio.ding.ids.wedroid.app.view.adapter.WListsAdapter;

View File

@ -42,7 +42,6 @@ class BoardsListAdapter internal constructor(
val intent = Intent(holder.itemView.context, BoardViewActivity::class.java) val intent = Intent(holder.itemView.context, BoardViewActivity::class.java)
intent.putExtra("idBoard", board.id) intent.putExtra("idBoard", board.id)
holder.itemView.context.startActivity(intent) holder.itemView.context.startActivity(intent)
} }
} }

View File

@ -51,6 +51,7 @@ public class WListsAdapter extends RecyclerView.Adapter<WListsAdapter.WListViewH
private final TextView wListItemView; private final TextView wListItemView;
ListView listView; ListView listView;
Button button; Button button;
private WListViewHolder(View itemView) { private WListViewHolder(View itemView) {
super(itemView); super(itemView);
wListItemView = itemView.findViewById(R.id.wListTitle); wListItemView = itemView.findViewById(R.id.wListTitle);
@ -92,6 +93,7 @@ public class WListsAdapter extends RecyclerView.Adapter<WListsAdapter.WListViewH
} }
}); });
} }
@Override @Override
public void onFailure(@NotNull Call<List<Card>> call, @NotNull Throwable t) { public void onFailure(@NotNull Call<List<Card>> call, @NotNull Throwable t) {
} }
@ -161,6 +163,7 @@ public class WListsAdapter extends RecyclerView.Adapter<WListsAdapter.WListViewH
Toast.makeText(mContext, "card doesn't posted", Toast.makeText(mContext, "card doesn't posted",
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
} }
@Override @Override
public void onFailure(@NotNull Call<Card> call, @NotNull Throwable t) { public void onFailure(@NotNull Call<Card> call, @NotNull Throwable t) {
@ -180,8 +183,7 @@ public class WListsAdapter extends RecyclerView.Adapter<WListsAdapter.WListViewH
} }
}); });
} } else
else
Toast.makeText(mContext, "cancel", Toast.LENGTH_LONG).show(); Toast.makeText(mContext, "cancel", Toast.LENGTH_LONG).show();
} }
}) })

View File

@ -1,4 +1,4 @@
package it.unisannio.ding.ids.wedroid.app.viewmodel; package it.unisannio.ding.ids.wedroid.app.viewModel;
import android.app.Application; import android.app.Application;

View File

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<shape <shape android:shape="rectangle">
android:shape="rectangle" > <solid android:color="@color/colorAccent"></solid>
<solid <corners android:radius="11dp"></corners>
android:color="@color/colorAccent" >
</solid>
<corners
android:radius="11dp" >
</corners>
</shape> </shape>
</selector> </selector>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/wListTitle" android:id="@+id/wListTitle"
@ -17,8 +17,7 @@
<ListView <ListView
android:id="@+id/listViewCard" android:id="@+id/listViewCard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" />
</ListView>
<Button <Button
android:id="@+id/buttonAddCard" android:id="@+id/buttonAddCard"