Commit 6ece9927 authored by Mathilde BALLOUHEY's avatar Mathilde BALLOUHEY
Browse files

Merge branch 'front' of gitlab.univ-nantes.fr:E20C136A/mobile21 into front

parents 18808227 abfdfa02
Pipeline #23346 failed with stages
in 2 minutes and 29 seconds
......@@ -39,10 +39,28 @@ Cette activité affiche les détails et les GIF associés du GIF sélectionné d
En dessous, une liste déroulante de GIF associé.
Le click sur l'un des GIf de la liste aura pour effet de remplacé par ce GIF, celui associé à la fiche personnage. L'activité `DisplayGIF` sera alors fermé et nous reviendrons sur l'activité `DisplayResult`.
## Pré-requis
Attention pour pouvoir exploiter pleinement notre dépôt nous vous conseillons soit d'exploiter l'un des fichiers .apk provenant des releases ou des pipelines de master.
Cependant si vous souhaiter développer ou faire avancer notre projet, il vous faudra :
* Créer un fichier nommé `apikey.properties` (Qui est ignoré par notre .gitignore donc ne le pousser pas merci par avance) à la racine de notre dépôt et y placer ceci `TENOR_KEY="Votre token tenor"`. Si vous n'avez pas de token tenor il vous suffit de vous [inscrire](https://tenor.com/developer/keyregistration) afin de l'obtenir.
* Créer un fichier `releasekey.properties` avec trois variables en son sein comme il suit :
```properties
KEY_FILE=releaseKey.jks
KEY_PASSWORD=MotDePasseALaCon
KEY_ALIAS=releaseKey
```
* Et également vous créer une clé si vous souhaitez produire une release soit :
* Si vous êtes sous Unix/Mac : en utilisant un script dédié à cet effet comme il suit `sh ./genKey.sh releaseKey.jks releaseKey MotDePasse "Scrum Mouton" "DnDGenerator" "The RAAD Team" "Nantes" "Pays de la Loire" "FR"`.
* Si vous êtes sur Windows nous n'avons pas travaillé sur cette plateforme et nous incitons donc à lire la [documentation](https://developer.android.com/studio/publish/app-signing#generate-key).
## tl;dr
Une app qui génère des fiches de D&D avec un GIF associé et un système de favoris.
Attention pour pouvoir exploiter pleinement notre dépôt nous vous conseillons soit d'exploité l'un des fichiers .apk provenant des releases ou des pipelines de master, cependant si vous souhaiter développer ou faire avancer notre projet, il vous faudra créer un fichier nommé `apikey.properties` (Qui est ignoré par notre .gitignore donc ne le pousser pas merci par avance) à la racine de notre dépôt et y placer ceci `TENOR_KEY="Votre token tenor"`. Si vous n'avez pas de token tenor il vous suffit de vous [inscrire](https://tenor.com/developer/keyregistration) afin de l'obtenir.
## Authors
......
......@@ -7,6 +7,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import android.content.Context;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import fr.iutnantes.miar.dndgenerator.api.tenor.GIFObjectTest;
......@@ -32,7 +33,7 @@ public class DnDSheetTest {
}
public static void testSheet(DnDSheet sheet, DnDSystem system, DnDClass dnDClass) {
assertNotNull(sheet);
GIFObjectTest.testGIF(sheet.gif);
GIFObjectTest.testGIF(sheet.getGIF());
if (system != null)
assertEquals(sheet.system, system);
if (dnDClass != null)
......@@ -351,4 +352,32 @@ public class DnDSheetTest {
List<DnDSheet> sheets = DnDSheet.getRandomsCaracterSheetFromRandomSystem(ctx, n, dnDClass);
checkManySheetsFromRandomSystem(sheets, n, dnDClass);
}
@Test
public void testComparatorBySystem() {
DnDSheet firstSheet = DnDSheet.getRandomCaracterSheet(ctx, DnDSystem.lotfp);
DnDSheet secondSheet = DnDSheet.getRandomCaracterSheet(ctx, DnDSystem.lbb);
List<DnDSheet> sheetsUnSorted = new ArrayList<>();
sheetsUnSorted.add(secondSheet);
sheetsUnSorted.add(firstSheet);
List<DnDSheet> sheetsSorted = new ArrayList<>();
sheetsSorted.add(firstSheet);
sheetsSorted.add(secondSheet);
assertNotEquals(sheetsSorted, sheetsUnSorted);
Collections.sort(sheetsUnSorted, DnDSheet.COMPARATOR_BY_SYSTEM);
assertEquals(sheetsUnSorted, sheetsSorted);
}
@Test
public void testComparatorByClass() {
DnDSheet firstSheet = DnDSheet.getRandomCaracterSheet(ctx, DnDClass.DWARF);
DnDSheet secondSheet = DnDSheet.getRandomCaracterSheet(ctx, DnDClass.FIGHTER);
List<DnDSheet> sheetsUnSorted = new ArrayList<>();
sheetsUnSorted.add(secondSheet);
sheetsUnSorted.add(firstSheet);
List<DnDSheet> sheetsSorted = new ArrayList<>();
sheetsSorted.add(firstSheet);
sheetsSorted.add(secondSheet);
assertNotEquals(sheetsSorted, sheetsUnSorted);
Collections.sort(sheetsUnSorted, DnDSheet.COMPARATOR_BY_CLASS);
assertEquals(sheetsUnSorted, sheetsSorted);
}
}
package fr.iutnantes.miar.dndgenerator.api.dnd.models;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import fr.iutnantes.miar.dndgenerator.api.dnd.DnDSheet;
import fr.iutnantes.miar.dndgenerator.api.dnd.DnDSheetTest;
import fr.iutnantes.miar.dndgenerator.api.tenor.GIFArtifact;
import fr.iutnantes.miar.dndgenerator.api.tenor.GIFObject;
import fr.iutnantes.miar.dndgenerator.api.tenor.GIFObjectTest;
import fr.iutnantes.miar.dndgenerator.api.tenor.TenorArgs;
import fr.iutnantes.miar.dndgenerator.api.tenor.models.GIFArtifactDB;
@RunWith(AndroidJUnit4.class)
public class DnDSheetDBTest {
......@@ -28,22 +20,17 @@ public class DnDSheetDBTest {
//Mock
public Context ctx = getMockContext();
public int dbVersion = DnDSheetDB.DATABASE_VERSION + 1;
@Before
@After
public void dropDBs() {
DnDSheetDB dbSheet = new DnDSheetDB(ctx);
GIFArtifactDB dbArtifact = new GIFArtifactDB(ctx);
DnDSavesDB dbSaves = new DnDSavesDB(ctx);
dbSaves.onUpgrade(dbSaves.getWritableDatabase(), 1, 1);
dbArtifact.onUpgrade(dbArtifact.getWritableDatabase(), 1, 1);
dbSheet.onUpgrade(dbSheet.getWritableDatabase(), 1, 1);
DnDSheet.removeAllFavs(ctx, dbVersion);
}
@Test
public void testBasicInteract() {
dropDBs();
DnDSheet sheet = DnDSheet.getRandomCaracterSheet(ctx);
DnDSheetDB db = new DnDSheetDB(ctx);
DnDSheetDB db = new DnDSheetDB(ctx, dbVersion);
assertNull(db.getDnDSheet(sheet.hashCode()));
assertFalse(db.updateGIF(sheet));
assertTrue(db.insertDnDSheet(sheet));
......@@ -55,35 +42,60 @@ public class DnDSheetDBTest {
assertFalse(db.removeDnDSheet(sheet));
assertTrue(db.insertDnDSheet(sheet));
assertEquals(db.getDnDSheet(sheet.hashCode()), sheet);
sheet.gif = GIFObject.getGIFObject(ctx, "Hi'");
sheet.changeGIF(ctx, GIFObject.getGIFObject(ctx, "Hi'"));
assertTrue(db.updateGIF(sheet));
assertEquals(db.getDnDSheet(sheet.hashCode()).gif, sheet.gif);
assertEquals(db.getDnDSheet(sheet.hashCode()).getGIF(), sheet.getGIF());
assertTrue(db.removeDnDSheet(sheet));
dropDBs();
}
@Test
public void TestBasicInteractWithManySheet() {
dropDBs();
DnDSheetDB db = new DnDSheetDB(ctx, dbVersion);
List<DnDSheet> sheets = DnDSheet.getRandomsCaracterSheet(ctx);
assertEquals(0, db.getAllDnDSheet().size());
for (DnDSheet caracter : sheets)
assertTrue(db.insertDnDSheet(caracter));
assertEquals(sheets.size(), db.getAllDnDSheet().size());
for (DnDSheet carac : db.getAllDnDSheet())
assertTrue(sheets.contains(carac));
for (DnDSheet carac : db.getAllDnDSheet())
assertTrue(db.removeDnDSheet(carac));
assertEquals(0, db.getAllDnDSheet().size());
dropDBs();
}
@Test
public void testBasicInteractViaDnDSheet() {
dropDBs();
DnDSheet sheet = DnDSheet.getRandomCaracterSheet(ctx);
assertTrue(sheet.addFav(ctx));
assertFalse(sheet.addFav(ctx));
assertTrue(sheet.removeFav(ctx));
assertFalse(sheet.removeFav(ctx));
assertFalse(sheet.updateFav(ctx));
sheet.gif = GIFObject.getGIFObject(ctx, "Hi'");
assertTrue(sheet.addFav(ctx));
assertTrue(sheet.updateFav(ctx));
assertTrue(sheet.removeFav(ctx));
GIFObject gif = GIFObject.getGIFObject(ctx, "Hi'");
assertTrue(sheet.addFav(ctx, dbVersion));
assertFalse(sheet.addFav(ctx, dbVersion));
assertTrue(sheet.removeFav(ctx, dbVersion));
assertFalse(sheet.removeFav(ctx, dbVersion));
assertFalse(sheet.updateFav(ctx, dbVersion));
sheet.changeGIF(ctx, gif);
assertTrue(sheet.addFav(ctx, dbVersion));
assertTrue(sheet.updateFav(ctx, dbVersion));
assertTrue(sheet.removeFav(ctx, dbVersion));
dropDBs();
}
@Test
public void testBasicInteractViaDnDSheetWithManySheet() {
dropDBs();
List<DnDSheet> sheets = DnDSheet.getRandomsCaracterSheet(ctx);
assertEquals(0, DnDSheet.getFavs(ctx, dbVersion).size());
for (DnDSheet caracter : sheets)
assertTrue(caracter.addFav(ctx));
assertEquals(sheets.size(), DnDSheet.getFavs(ctx).size());
for (DnDSheet carac : DnDSheet.getFavs(ctx))
assertTrue(caracter.addFav(ctx, dbVersion));
assertEquals(sheets.size(), DnDSheet.getFavs(ctx, dbVersion).size());
for (DnDSheet carac : DnDSheet.getFavs(ctx, dbVersion))
assertTrue(sheets.contains(carac));
for (DnDSheet carac : DnDSheet.getFavs(ctx, dbVersion))
assertTrue(carac.removeFav(ctx, dbVersion));
assertEquals(0, DnDSheet.getFavs(ctx, dbVersion).size());
dropDBs();
}
}
\ No newline at end of file
package fr.iutnantes.miar.dndgenerator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.Switch;
import android.widget.TextView;
......@@ -35,17 +37,21 @@ import fr.iutnantes.miar.dndgenerator.api.tenor.TenorArgs;
public class DisplayGIFActivity extends AppCompatActivity {
private static String TAG = "DisplayGIFActivity :: ";
private static final String GIF_LIST = "gifList";
private boolean m_searchOnChange = true;
private boolean m_searchPostChange = true;
private boolean m_enableResearchListener = false;
private int m_nbResult;
private Context m_context = this;
private DnDSheet m_sheet;
private List<GIFObject> m_listGif;
private ListGifAdapter m_adapter;
private AsyncTaskGetGifList m_asyncTaskGetGifList;
private TextView lbl_displayGif_name, lbl_displayGif_tag;
private EditText txt_displayGif_nbResult, txt_displayGif_recherche;
private ImageView img_displayGif_gif;
private RecyclerView rclr_displayGif_relatedGif;
private SeekBar skbr_displayGif_nbResult;
private Switch swtch_displayGif_isNSFW;
private RadioButton rdbtn_displayGif_withSheet, rdbtn_displayGif_withGif;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -60,35 +66,40 @@ public class DisplayGIFActivity extends AppCompatActivity {
txt_displayGif_recherche = findViewById(R.id.txt_displayGif_recherche);
skbr_displayGif_nbResult = findViewById(R.id.skbr_displayGif_nbResult);
swtch_displayGif_isNSFW = findViewById(R.id.swtch_displayGif_isNSFW);
rdbtn_displayGif_withSheet = findViewById(R.id.rdbtn_displayGif_withSheet);
rdbtn_displayGif_withGif = findViewById(R.id.rdbtn_displayGif_withGif);
Intent v_intent = getIntent();
Bundle v_bundle = v_intent.getExtras();
m_sheet = (DnDSheet) v_bundle.getSerializable(DisplayResultActivity.SHEET);
setDataList(savedInstanceState, checkNbResult());
if(savedInstanceState != null) {
savedInstanceState.clear();
}
//Recycler View
m_adapter = new ListGifAdapter(m_listGif, this);
rclr_displayGif_relatedGif.setAdapter(m_adapter);
rclr_displayGif_relatedGif.setLayoutManager(new GridLayoutManager(this, 2));
lbl_displayGif_name.setText(m_sheet.gif.toString());
lbl_displayGif_name.setText(m_sheet.getGIF().toString());
String v_tags = "";
if(m_sheet.gif.tags.size() > 0) {
v_tags = m_sheet.gif.tags.get(0);
if(m_sheet.getGIF().tags.size() > 0) {
v_tags = m_sheet.getGIF().tags.get(0);
}
for (int compt = 1; compt < m_sheet.gif.tags.size(); compt++) {
v_tags += String.format(", %s", m_sheet.gif.tags.get(compt));
for (int compt = 1; compt < m_sheet.getGIF().tags.size(); compt++) {
v_tags += String.format(", %s", m_sheet.getGIF().tags.get(compt));
}
lbl_displayGif_tag.setText(v_tags);
if (v_tags.isEmpty()){
lbl_displayGif_tag.setText("No tags attached on this GIF");
}
String v_urlGif = Objects.requireNonNull(m_sheet.gif.media.get(GIFFormat.GIF)).url;
String v_urlGif = Objects.requireNonNull(m_sheet.getGIF().media.get(GIFFormat.GIF)).url;
Glide.with(this)
.load(v_urlGif)
.into(img_displayGif_gif);
// Listeners
txt_displayGif_nbResult.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
......@@ -102,17 +113,20 @@ public class DisplayGIFActivity extends AppCompatActivity {
@Override
public void afterTextChanged(Editable editable) {
if(m_listGif == null || !m_searchOnChange) {
if(m_listGif == null || !m_searchPostChange) {
return;
}
doSearch();
launchAsyncSearch();
}
});
txt_displayGif_recherche.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(m_enableResearchListener) {
rdbtn_displayGif_withGif.setChecked(false);
rdbtn_displayGif_withSheet.setChecked(false);
}
}
@Override
......@@ -122,7 +136,12 @@ public class DisplayGIFActivity extends AppCompatActivity {
@Override
public void afterTextChanged(Editable editable) {
doSearch();
if(m_enableResearchListener) {
launchAsyncSearch();
if (txt_displayGif_recherche.getText().toString().isEmpty()) {
rdbtn_displayGif_withSheet.setChecked(true);
}
}
}
});
......@@ -134,23 +153,42 @@ public class DisplayGIFActivity extends AppCompatActivity {
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
m_searchOnChange = false;
m_searchPostChange = false;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
m_searchOnChange = true;
doSearch();
m_searchPostChange = true;
launchAsyncSearch();
}
});
swtch_displayGif_isNSFW.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
doSearch();
}
swtch_displayGif_isNSFW.setOnCheckedChangeListener((compoundButton, b) -> {
launchAsyncSearch();
});
View.OnClickListener v_onClickRadioButtonListener = view -> {
m_enableResearchListener = false;
txt_displayGif_recherche.setText("");
launchAsyncSearch();
m_enableResearchListener = true;
};
rdbtn_displayGif_withSheet.setOnClickListener(v_onClickRadioButtonListener);
rdbtn_displayGif_withGif.setOnClickListener(v_onClickRadioButtonListener);
if(rdbtn_displayGif_withSheet.isChecked() || rdbtn_displayGif_withGif.isChecked()){
launchAsyncSearch();
}
}
private void launchAsyncSearch() {
if (m_asyncTaskGetGifList != null) {
m_asyncTaskGetGifList.cancel(true);
}
m_asyncTaskGetGifList = new AsyncTaskGetGifList();
m_asyncTaskGetGifList.execute((Nullable) null);
}
private int checkNbResult() {
int v_nbResult = 0;
try {
......@@ -171,13 +209,18 @@ public class DisplayGIFActivity extends AppCompatActivity {
m_listGif = (List<GIFObject>) savedInstanceState.getSerializable(GIF_LIST);
return;
}
m_listGif = GIFObject.getGIFObjects(this, m_sheet.gif.searchQuery, nbResult, m_sheet.gif);
m_listGif = GIFObject.getGIFObjects(this, m_sheet.getGIF().searchQuery, nbResult,
m_sheet.getGIF());
}
private void doSearch() {
int v_nbResult = checkNbResult();
String v_recherche = m_sheet.gif.searchQuery;
int v_nbResult = m_nbResult;
String v_recherche = m_sheet.searchGIF;
Log.d(TAG, v_recherche);
TenorArgs v_tenorArgs = TenorArgs.GIF_SAFE;
if(rdbtn_displayGif_withGif.isChecked()) {
v_recherche = m_sheet.getGIF().searchQuery;
}
if(!txt_displayGif_recherche.getText().toString().isEmpty()) {
v_recherche = txt_displayGif_recherche.getText().toString();
}
......@@ -186,10 +229,9 @@ public class DisplayGIFActivity extends AppCompatActivity {
}
if (v_nbResult > 0) {
List<GIFObject> v_newGifs = GIFObject.getGIFObjects(m_context,
v_recherche, v_tenorArgs.fork(v_nbResult, m_sheet.gif));
v_recherche, v_tenorArgs.fork(v_nbResult, m_sheet.getGIF()));
m_listGif.clear();
m_listGif.addAll(v_newGifs);
m_adapter.notifyDataSetChanged();
}
}
......@@ -198,4 +240,24 @@ public class DisplayGIFActivity extends AppCompatActivity {
outState.putSerializable(GIF_LIST, (Serializable) m_listGif);
super.onSaveInstanceState(outState);
}
private class AsyncTaskGetGifList extends AsyncTask<Nullable, String, Nullable> {
@Override
protected void onPreExecute() {
super.onPreExecute();
m_nbResult = checkNbResult();
}
@Override
protected Nullable doInBackground(Nullable... nullables) {
doSearch();
return null;
}
@Override
protected void onPostExecute(Nullable nullable) {
super.onPostExecute(nullable);
m_adapter.notifyDataSetChanged();
}
}
}
\ No newline at end of file
......@@ -97,14 +97,15 @@ public class DisplayResultActivity extends AppCompatActivity {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == requestCode) {
GIFObject v_gif = (GIFObject) Objects.requireNonNull(data).getExtras().getSerializable(ListGifAdapter.GIF_OBJECT);
GIFObject v_gif = (GIFObject) Objects.requireNonNull(data).getExtras()
.getSerializable(ListGifAdapter.GIF_OBJECT);
m_sheet.changeGIF(DisplayResultActivity.this, v_gif);
loadGif();
}
}
private void loadGif() {
String imgUrl = Objects.requireNonNull(m_sheet.gif.media.get(GIFFormat.GIF)).url;
String imgUrl = Objects.requireNonNull(m_sheet.getGIF().media.get(GIFFormat.GIF)).url;
Glide.with(this)
.load(imgUrl)
.into(img_displayResult_gif);
......
......@@ -2,22 +2,28 @@ package fr.iutnantes.miar.dndgenerator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import fr.iutnantes.miar.dndgenerator.adapter.ListResultsAdapter;
......@@ -36,7 +42,8 @@ public class HomeActivity extends AppCompatActivity {
Spinner spnr_home_system, spnr_home_class;
EditText txt_home_nbResult;
SeekBar skbr_home_nbResult;
Button btn_home_generate;
Button btn_home_generate, btn_home_delFav;
RadioButton rdbtn_home_bySystem, rdbtn_home_byClass;
RecyclerView rclr_home_favourites;
private ListResultsAdapter m_adapter;
......@@ -53,6 +60,9 @@ public class HomeActivity extends AppCompatActivity {
txt_home_nbResult = findViewById(R.id.txt_home_nbResult);
skbr_home_nbResult = findViewById(R.id.skbr_home_nbResult);
btn_home_generate = findViewById(R.id.btn_home_generate);
btn_home_delFav = findViewById(R.id.btn_home_delFav);
rdbtn_home_bySystem = findViewById(R.id.rdbtn_home_bySystem);
rdbtn_home_byClass = findViewById(R.id.rdbtn_home_byClass);
rclr_home_favourites = findViewById(R.id.rclr_home_favourites);
List<String> v_lstSystemName = new ArrayList<>();
......@@ -119,6 +129,15 @@ public class HomeActivity extends AppCompatActivity {
startActivity(v_intent);
});
btn_home_delFav.setOnClickListener(onClickDelFav());
View.OnClickListener v_rdbtnListener = view -> {
sortFavourites();
m_adapter.notifyDataSetChanged();
};
rdbtn_home_bySystem.setOnClickListener(v_rdbtnListener);
rdbtn_home_byClass.setOnClickListener(v_rdbtnListener);
m_favourites = DnDSheet.getFavs(this);
......@@ -130,8 +149,60 @@ public class HomeActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
AsyncTaskGetFavourites v_asyncTaskGetFavourites = new AsyncTaskGetFavourites();
v_asyncTaskGetFavourites.execute((Nullable) null);
}
private void getFav() {
m_favourites.clear();
m_favourites.addAll(DnDSheet.getFavs(this));
m_adapter.notifyDataSetChanged();
sortFavourites();
}
private void sortFavourites() {
if(rdbtn_home_bySystem.isChecked()) {
Collections.sort(m_favourites, DnDSheet.COMPARATOR_BY_SYSTEM);
}
else {
Collections.sort(m_favourites, DnDSheet.COMPARATOR_BY_CLASS);
}
}
private View.OnClickListener onClickDelFav() {
View.OnClickListener v_onClickListener = view -> {
AlertDialog.Builder v_builder = new AlertDialog.Builder(HomeActivity.this);
v_builder.setMessage("Do you realy what to delete all favourites ?");
v_builder.setPositiveButton("OK", (dialogInterface, i) -> {
DnDSheet.removeAllFavs(HomeActivity.this);
m_favourites.clear();
m_adapter.notifyDataSetChanged();
});
v_builder.setNegativeButton("CANCEL", (dialogInterface, i) -> {});
v_builder.create().show();
};