Premier commit, création de l'application avec connection au terminal maître.

This commit is contained in:
Mysaa 2021-08-27 02:22:00 +02:00
commit 95da08f139
53 changed files with 1617 additions and 0 deletions

19
.gitignore vendored Normal file
View File

@ -0,0 +1,19 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
gradlew
gradlew.bat
gradle/

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

46
app/build.gradle Normal file
View File

@ -0,0 +1,46 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.bernard.murderator"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation files('/home/mysaa/Documents/ProjetsGit/mysaa/Murderator.git/build/libs/MurderatorAPI.jar')
implementation files('/home/mysaa/Documents/ProjetsGit/bernard/BernardLibs.git/build/libs/BernardLibs.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bernard.murderator">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:fullBackupOnly="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Murderator"
android:name=".MurderApplication">
<activity
android:name=".activities.JoueurActivity"
android:exported="true" />
<activity
android:name=".activities.ConnectionJoueurSelectionActivity"
android:exported="true"
android:label="@string/title_activity_connection_joueur_selection"
android:theme="@style/Theme.Murderator.NoActionBar" />
<activity
android:name=".activities.ConnectionSelectionActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,54 @@
package com.bernard.murderator;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.bernard.murderator.activities.ActionsJoueurFragment;
import com.bernard.murderator.activities.ChatJoueurFragment;
import com.bernard.murderator.activities.InventaireJoueurFragment;
import com.bernard.murderator.activities.JoueurActivity;
public class JoueurFragmentAdapter extends FragmentStateAdapter {
public static final String PERSO_NAME_VAR = "com.bernard.murderator.activities.JoueurFragmentAdapter.persoName";
String playerName;
InventaireJoueurFragment invFrag;
ActionsJoueurFragment actFrag;
ChatJoueurFragment chatFrag;
public JoueurFragmentAdapter(@NonNull JoueurActivity fragmentActivity, String playerName) {
super(fragmentActivity);
this.playerName = playerName;
}
@NonNull
@Override
public Fragment createFragment(int position) {
switch (position){
case 0:
if(invFrag==null)
invFrag = new InventaireJoueurFragment(playerName);
return invFrag;
case 1:
if(actFrag==null)
actFrag = new ActionsJoueurFragment(playerName);
return actFrag;
case 2:
if(chatFrag==null)
chatFrag = new ChatJoueurFragment();
return chatFrag;
}
throw new IllegalArgumentException("Cet adapteur ne fournis pas que 3 fragments, il n'y en a pas de "+position+"ème ...");
}
@Override
public int getItemCount() {
return 3;
}
}

View File

@ -0,0 +1,191 @@
package com.bernard.murderator;
import android.app.Activity;
import android.app.Application;
import android.util.Log;
import com.bernard.murder.model.Action;
import com.bernard.murder.model.Objet;
import com.bernard.murder.model.messages.Message;
import com.bernard.murder.model.messages.Thread;
import com.bernard.murderator.connection.PhoneServer;
import java.net.SocketAddress;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class MurderApplication extends Application {
private PhoneServer serveur;
public Activity mainActivity;
final Map<String, Set<Action>> playerActions = new HashMap<>(); // <persoName, actions>
final Map<String, Long> playerActionsLastUpdate = new HashMap<>();
final Map<String, Set<Runnable>> playerActionsUpdateListeners = new HashMap<>();
final Map<String, Set<Objet>> inventaireMap = new HashMap<>(); // <invName, inventaire>
final Map<String, Long> inventaireMapLastUpdate = new HashMap<>(); // <invName, null si watching, timestamp sinon>
final Map<String, Set<Runnable>> inventaireUpdateListeners = new HashMap<>();
final Map<String, List<Thread>> messages = new HashMap<>(); // <persoName, threads>
Set<String> joueurs = null; // <persoName>
private final Object joueursTriggerer = new Object();
public boolean initServeur(SocketAddress address){
if(serveur==null) {
PhoneServer serv = new PhoneServer(address, this);
boolean res = serv.checkMaster();
if (res)
serveur = serv;
else
serv.close();
return res;
}else
return serveur.checkMaster();
}
public PhoneServer getServeur(){
if(serveur!=null)
return serveur;
throw new IllegalStateException("Le serveur de l'application n'a pas été initialisé.");
}
public boolean initToken(boolean isOp, String name, String mdp){
serveur.queryToken(name, mdp, isOp);
while(!serveur.hasToken()){
try {
synchronized (serveur) {
serveur.wait(dataWaitTimeout);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return true;
}
private static final long dataWaitTimeout = 10_000;
public Set<String> getPersosNames() {
if(joueurs==null) {
serveur.queryPlayerList();
while(joueurs==null){
try {
synchronized (joueursTriggerer) {
joueursTriggerer.wait(dataWaitTimeout);
}
} catch (InterruptedException e) {
Log.e("MurderApplication","L'attente de la liste des joueurs a été interrompue.",e);
}
}
}
return joueurs;
}
public Set<Action> getActions(String playerName) {
long askTime = System.currentTimeMillis();
if(!(playerActionsLastUpdate.containsKey(playerName) && playerActionsLastUpdate.get(playerName)==null)) {
serveur.queryActions(playerName,false);
while(!playerActionsLastUpdate.containsKey(playerName) ||
(playerActionsLastUpdate.get(playerName)!=null &&
playerActionsLastUpdate.get(playerName)<askTime)){
try {
synchronized (playerActionsLastUpdate) {
playerActionsLastUpdate.wait(dataWaitTimeout);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return playerActions.get(playerName);
}
public Set<Objet> getInventaire(String invName) {
long askTime = System.currentTimeMillis();
if(!(inventaireMapLastUpdate.containsKey(invName) && inventaireMapLastUpdate.get(invName)==null)) {
serveur.queryInventory(invName,false);
while(inventaireMapLastUpdate.containsKey(invName) &&
!(inventaireMapLastUpdate.get(invName)!=null &&
inventaireMapLastUpdate.get(invName)<askTime)){
try {
synchronized (inventaireMapLastUpdate) {
inventaireMapLastUpdate.wait(dataWaitTimeout);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return inventaireMap.get(invName);
}
public void updatePlayerActions(String player, Set<Action> actions){
playerActions.put(player,actions);
if(!(playerActionsLastUpdate.containsKey(player) && playerActionsLastUpdate.get(player)==null))
playerActionsLastUpdate.put(player,System.currentTimeMillis());
synchronized (playerActionsLastUpdate) {
playerActionsLastUpdate.notifyAll();
}
if(playerActionsUpdateListeners.containsKey(player))
for(Runnable r: playerActionsUpdateListeners.get(player))
r.run();
}
public void updateInventaire(String invName, Set<Objet> inventaire){
inventaireMap.put(invName,inventaire);
if(!(inventaireMapLastUpdate.containsKey(invName) && inventaireMapLastUpdate.get(invName)==null))
inventaireMapLastUpdate.put(invName,System.currentTimeMillis());
synchronized (inventaireMapLastUpdate) {
inventaireMapLastUpdate.notifyAll();
}
if(inventaireUpdateListeners.containsKey(invName))
for(Runnable r: inventaireUpdateListeners.get(invName))
r.run();
}
public void updateJoueurs(Set<String> joueurs){
if(this.joueurs==null)
this.joueurs = new HashSet<>();
this.joueurs.clear();
this.joueurs.addAll(joueurs);
synchronized (joueursTriggerer) {
joueursTriggerer.notifyAll();
}
}
public void addPlayerActionsUpdateListener(String player,Runnable onUpdate){
if(!playerActionsLastUpdate.containsKey(player) || playerActionsLastUpdate.get(player)!=null)
playerActionsLastUpdate.put(player,null);
if(!playerActionsUpdateListeners.containsKey(player))
playerActionsUpdateListeners.put(player,new HashSet<>());
playerActionsUpdateListeners.get(player).add(onUpdate);
}
public void addInventoryUpdateListener(String invName,Runnable onUpdate){
if(!inventaireMapLastUpdate.containsKey(invName) || inventaireMapLastUpdate.get(invName)!=null)
inventaireMapLastUpdate.put(invName,null);
if(!inventaireUpdateListeners.containsKey(invName))
inventaireUpdateListeners.put(invName,new HashSet<>());
inventaireUpdateListeners.get(invName).add(onUpdate);
}
public void receivedMessage(Message message, long threadId, int threadPos){
}
public void openedThread(Thread tt){
}
public void closedThread(long closedUid, long closeTimestamp) {
}
}

View File

@ -0,0 +1,155 @@
package com.bernard.murderator.activities;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.bernard.murder.model.Action;
import com.bernard.murderator.JoueurFragmentAdapter;
import com.bernard.murderator.MurderApplication;
import com.bernard.murderator.R;
import com.bernard.util.ParseUtils;
import java.sql.Date;
import java.text.DateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
public class ActionsJoueurFragment extends Fragment {
ListView actionListView;
String persoName;
// Si android re-crée le fragment
public ActionsJoueurFragment(){}
public ActionsJoueurFragment(String persoName){
this.persoName = persoName;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View fragView = inflater.inflate(R.layout.fragment_actions_joueur,container,false);
actionListView = fragView.findViewById(R.id.actions_list);
if(getContext()!=null) {
MurderApplication theApp = ((MurderApplication) getContext().getApplicationContext());
ActionAdapter ladapter = new ActionAdapter(getContext(), persoName);
actionListView.setAdapter(ladapter);
}else {
Log.e("ActionsJoueurFragment", "L'application n'a pas été créée !");
}
return fragView;
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putString(JoueurFragmentAdapter.PERSO_NAME_VAR, persoName);
super.onSaveInstanceState(outState);
}
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if(persoName ==null){
// Alors on le récupères du bundle
persoName = savedInstanceState.getString(JoueurFragmentAdapter.PERSO_NAME_VAR);
}
}
public class ActionAdapter extends ArrayAdapter<Action>{
Timer updateTimer;
public ActionAdapter(@NonNull Context context, String persoName) {
super(context, 0);
Log.d("ActionAdapter","Création de l'adapteur");
MurderApplication theApp = ((MurderApplication) context.getApplicationContext());
Set<Action> actions = theApp.getActions(persoName);
updateElements(actions);
Log.d("ActionAdapter","Les éléments ont été mises à jour");
updateTimer = new Timer("Action-updater");
updateTimer.schedule(new TimerTask() {
@Override
public void run() {
if(getActivity()!=null)
getActivity().runOnUiThread(ActionAdapter.this::updateTexts);
}
}, 100, 1000);
Log.d("ActionAdapter","le timer est lancé");
}
public void updateElements(Set<Action> acts){
this.clear();
List<Action> actz = new ArrayList<>(acts);
Collections.sort(actz,(a,b) -> a.getName().compareTo(b.getName()));
this.addAll(actz);
this.notifyDataSetChanged();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Action act = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.action_list_item_layout, parent, false);
}
TextView actionNameText = convertView.findViewById(R.id.action_name_text);
TextView actionTimeText = convertView.findViewById(R.id.action_time_text);
toUpdate.put(position,actionTimeText);
actionNameText.setText(act.getName());
updateTexts();
return convertView;
}
Map<Integer,TextView> toUpdate = new HashMap<>();
public void updateTexts(){
for (int i : toUpdate.keySet()) {
Action act = getItem(i);
String newText;
if(act.canBeLaunched())
newText = getContext().getString(R.string.action_available_text);
else
newText = String.format(
getContext().getString(R.string.action_waiting_text),
ParseUtils.dumpTimeLength(act.timeToWaitLeft()),
DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(act.dateReset())));
toUpdate.get(i).setText(newText);
}
}
}
}

View File

@ -0,0 +1,23 @@
package com.bernard.murderator.activities;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.bernard.murderator.R;
public class ChatJoueurFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_chat_joueur,container,false);
}
}

View File

@ -0,0 +1,81 @@
package com.bernard.murderator.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.bernard.murder.model.Personnage;
import com.bernard.murderator.MurderApplication;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import com.bernard.murderator.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class ConnectionJoueurSelectionActivity extends AppCompatActivity {
Activity thisActivity;
MurderApplication thisApplication;
ListView liste;
EditText mdp;
EditText masterIP;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
thisActivity = this;
thisApplication = (MurderApplication) getApplicationContext();
setContentView(R.layout.activity_connection_joueur_selection);
liste = findViewById(R.id.player_select_list);
mdp = findViewById(R.id.player_mdp);
List<String> joueurs = new ArrayList<String>(thisApplication.getPersosNames());
Collections.sort(joueurs);
liste.setAdapter(
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,joueurs)
);
liste.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
liste.setOnItemClickListener((parent,view,position,id)->{
String playerName = (String) liste.getItemAtPosition(position);
if(playerName==null){
Toast.makeText(thisActivity,R.string.no_player_selected,Toast.LENGTH_SHORT).show();
return;
}
if(mdp.getText().toString().isEmpty()){
Toast.makeText(thisActivity,R.string.no_password_given,Toast.LENGTH_SHORT).show();
return;
}
if(thisApplication.initToken(false,playerName,mdp.getText().toString())){
Intent intent = new Intent(thisActivity,JoueurActivity.class);
intent.putExtra(JoueurActivity.JOUEUR_NAME_INTENT,playerName);
startActivity(intent);
}else{
Toast.makeText(thisActivity,R.string.connection_failed,Toast.LENGTH_SHORT).show();
}
});
}
}

View File

@ -0,0 +1,17 @@
package com.bernard.murderator.activities;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.bernard.murderator.R;
public class ConnectionOpActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState) ;
setContentView(R.layout.activity_main);
}
}

View File

@ -0,0 +1,64 @@
package com.bernard.murderator.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.bernard.murderator.MurderApplication;
import com.bernard.murderator.R;
import com.bernard.murderator.connection.PhoneServer;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
public class ConnectionSelectionActivity extends AppCompatActivity {
Activity thisActivity;
MurderApplication thisApplication;
Button joueurButton, operateurButton, qrCodeButton, micButton, enceinteButton;
EditText masterIP;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
thisActivity = this;
thisApplication = (MurderApplication) getApplicationContext();
setContentView(R.layout.activity_connection_selection);
joueurButton = findViewById(R.id.connect_as_player);
operateurButton = findViewById(R.id.connect_as_op);
micButton = findViewById(R.id.connect_as_mic);
enceinteButton = findViewById(R.id.connect_as_speaker);
qrCodeButton = findViewById(R.id.connect_with_qrcode);
masterIP = findViewById(R.id.editTextMasterIP);
joueurButton.setOnClickListener((v) -> {
//TODO fetch player list from remote
if(initServer(masterIP.getText().toString())) {
Intent intent = new Intent(thisActivity, ConnectionJoueurSelectionActivity.class);
startActivity(intent);
}
});
}
public boolean initServer(String address){
SocketAddress addr = new InetSocketAddress(address, PhoneServer.communicationPort);
boolean result = thisApplication.initServeur(addr);
if(!result)
Toast.makeText(this,R.string.master_not_found,Toast.LENGTH_SHORT).show();
return result;
}
//TODO Peut recevoir en intent une URL/qrcode correspondant à une URL contenant le type de connection, le mot de passe et le pseudo/nomDuJoueur
}

View File

@ -0,0 +1,30 @@
package com.bernard.murderator.activities;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.bernard.murderator.R;
public class InventaireJoueurFragment extends Fragment {
String invName;
public InventaireJoueurFragment(){}
public InventaireJoueurFragment(String invName){
this.invName = invName;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_inventaire_joueur,container,false);
}
}

View File

@ -0,0 +1,42 @@
package com.bernard.murderator.activities;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.widget.ViewPager2;
import com.bernard.murderator.JoueurFragmentAdapter;
import com.bernard.murderator.MurderApplication;
import com.bernard.murderator.R;
public class JoueurActivity extends FragmentActivity {
public static final String JOUEUR_NAME_INTENT = "com.bernard.murderator.JoueurActivity.joueurName";
String playerName;
ViewPager2 pager;
JoueurFragmentAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_joueur);
Intent intent = getIntent();
playerName = intent.getStringExtra(JOUEUR_NAME_INTENT);
((MurderApplication)getApplication()).mainActivity = this;
pager = findViewById(R.id.view_pager);
adapter = new JoueurFragmentAdapter(this, playerName);
pager.setAdapter(adapter);
}
public String getPlayerName() {
return playerName;
}
}

View File

@ -0,0 +1,265 @@
package com.bernard.murderator.connection;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.bernard.murder.audio.Codes;
import com.bernard.murder.audio.Serveur;
import com.bernard.murder.model.Action;
import com.bernard.murder.model.Objet;
import com.bernard.murder.model.messages.Message;
import com.bernard.murder.model.messages.Thread;
import com.bernard.murderator.MurderApplication;
import com.bernard.murderator.R;
import com.bernard.util.BytesUtils;
import java.io.IOException;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class PhoneServer {
public static int communicationPort = 35295;
Serveur serv;
String token;
SocketAddress masterAddress;
MurderApplication app;
Set<UUID> answeredUUIDs = new HashSet<>();
public PhoneServer(SocketAddress address, MurderApplication app){
this.masterAddress = address;
this.app = app;
try {
initServer();
} catch (SocketException | UnknownHostException e) {
Log.e("PhoneServer","Impossible d'initialiser le serveur",e);
}
}
public void initServer() throws SocketException, UnknownHostException {
if(serv==null) {
serv = new Serveur(this::receiveCommand, PhoneServer.communicationPort);
serv.setNetworkOnSeparatedThread(true);
}
}
public void receiveCommand(ByteBuffer data, SocketAddress senderAddress) {
byte commande = data.get();
Log.d("PhoneServer","Commande reçue : " + commande + " de " + senderAddress + " de taille " + (data.limit() + 1));
switch (commande){
case Codes.ACCES_PARTIE:
receivePartieCommand(data, senderAddress);
break;
case Codes.PONG:
synchronized (masterCheckMonitored) {
masterResponce = true;
masterCheckMonitored.notifyAll();
}
break;
default:
Log.w("PhoneServer","Je ne sais pas recevoir les commandes "+commande);
}
}
public void receivePartieCommand(ByteBuffer data, SocketAddress senderAddress) {
byte commandePartie = data.get();
Log.d("PhoneServer","Partie-commande recue: "+commandePartie);
switch(commandePartie){
case Codes.Partie.ACTIONS_STATUS:
Log.d("PhoneServer", Arrays.toString(data.array()));
String persoName = BytesUtils.readString(data);
int actCount = data.getInt();
Set<Action> actions = new HashSet<>();
Log.d("PhoneServer","J'ai reçu "+actCount+" actions");
for (int i = 0; i < actCount; i++) {
Log.d("PhoneServer","Le numéro "+i+" ...");
String actName = BytesUtils.readString(data);
long basetime = data.getLong();
long triggertime = data.getLong();
Action act = new Action(actName,basetime,triggertime);
actions.add(act);
}
app.updatePlayerActions(persoName,actions);
break;
case Codes.Partie.INVENTORY_CONTENT:
String invName = BytesUtils.readString(data);
int invCount = data.getInt();
Set<Objet> objets = new HashSet<>();
for (int i = 0; i < invCount; i++) {
String objName = BytesUtils.readString(data);
Objet obj = new Objet(objName);
objets.add(obj);
}
app.updateInventaire(invName,objets);
break;
case Codes.Partie.GIVE_PLAYER_LIST:
int nbrJoueurs = data.getInt();
Set<String> joueurs = new HashSet<>();
for (int i = 0; i < nbrJoueurs; i++) {
String joueur = BytesUtils.readString(data);
joueurs.add(joueur);
}
app.updateJoueurs(joueurs);
break;
case Codes.Partie.GIVING_TOKEN:
String newToken = BytesUtils.readString(data);
Log.d("PhoneServer","On a reçu un token ! "+newToken);
if(!newToken.isEmpty())
this.token = newToken;
else
authError(token);
synchronized (this) {
this.notifyAll();
}
break;
case Codes.Partie.AUTH_ERROR:
String erroredToken = BytesUtils.readString(data);
authError(erroredToken);
break;
case Codes.Partie.CREATED_NEW_THREAD:
UUID requestId = new UUID(data.getLong(),data.getLong());
String persoNameT = BytesUtils.readString(data);
long threadUid = data.getLong();
long startTimestamp = data.getLong();
Thread tt = new Thread(persoNameT,startTimestamp,threadUid);
app.openedThread(tt);
answeredUUIDs.add(requestId);
break;
case Codes.Partie.CLOSED_THREAD:
long closedUid = data.getLong();
long closeTimestamp = data.getLong();
app.closedThread(closedUid,closeTimestamp);
break;
case Codes.Partie.NEW_MESSAGE:
long sentTimestamp = data.getLong();
long threadId = data.getLong();
int threadPosition = data.getInt();
String emmeteur = BytesUtils.readString(data);
String msgText = BytesUtils.readString(data);
Message msg = new Message(emmeteur,msgText,sentTimestamp);
app.receivedMessage(msg,threadId,threadPosition);
break;
default:
Log.w("PhoneServer","Je ne sais pas recevoir les sous-commandes "+commandePartie);
}
}
public void sendMessage(String text, String emmeteur, long threadUid){
}
public void queryPlayerList(){
ByteBuffer bb = ByteBuffer.allocate(Codes.packetMaxSize);
bb.put(Codes.ACCES_PARTIE);
bb.put(Codes.Partie.ASK_PLAYER_LIST);
try {
serv.sendData(bb,masterAddress);
} catch (IOException e) {
e.printStackTrace();
}
}
public void queryInventory(String invName, boolean watch){
ByteBuffer bb = ByteBuffer.allocate(Codes.packetMaxSize);
bb.put(Codes.ACCES_PARTIE);
bb.put(watch?Codes.Partie.ASK_INVENTORY_WATCH:Codes.Partie.ASK_INVENTORY);
BytesUtils.writeString(bb,token);
BytesUtils.writeString(bb,invName);
try {
serv.sendData(bb,masterAddress);
} catch (IOException e) {
e.printStackTrace();
}
}
public void queryActions(String persoName, boolean watch){
ByteBuffer bb = ByteBuffer.allocate(Codes.packetMaxSize);
bb.put(Codes.ACCES_PARTIE);
bb.put(watch?Codes.Partie.ASK_ACTIONS_WATCH:Codes.Partie.ASK_ACTIONS);
BytesUtils.writeString(bb,token);
BytesUtils.writeString(bb,persoName);
try {
serv.sendData(bb,masterAddress);
} catch (IOException e) {
e.printStackTrace();
}
}
public void queryToken(String playerName, String mdp, boolean isOp){
ByteBuffer bb = ByteBuffer.allocate(Codes.packetMaxSize);
bb.put(Codes.ACCES_PARTIE);
bb.put(isOp?Codes.Partie.ASK_OP_TOKEN:Codes.Partie.ASK_JOUEUR_TOKEN);
BytesUtils.writeString(bb,playerName);
BytesUtils.writeString(bb,mdp);
try {
serv.sendData(bb,masterAddress);
} catch (IOException e) {
e.printStackTrace();
}
}
private void authError(String token){
new java.lang.Thread(() -> {
Looper.prepare();
if(app.mainActivity!=null && (app.mainActivity.isFinishing() || app.mainActivity.isDestroyed()))
app.mainActivity.finish();
Toast.makeText(app, app.getResources().getString(R.string.auth_error,token),Toast.LENGTH_SHORT).show();
}).start();
}
public static final long masterCheckTimeout = 10_000;
private final Lock masterCheckLock = new ReentrantLock();
public final Object masterCheckMonitored = new Object();
private boolean masterResponce = false;
public synchronized boolean checkMaster(){
synchronized (masterCheckMonitored) {
masterResponce = false;
try {
serv.sendData(new byte[]{Codes.PING}, masterAddress);
masterCheckMonitored.wait(masterCheckTimeout);
} catch (InterruptedException | IOException ignored) {}
}
return masterResponce;
}
public boolean hasToken(){
return token==null;
}
public void close() {
serv.close();
}
}

View File

@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="49.59793"
android:startX="42.9492"
android:endY="92.4963"
android:endX="85.84757"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeWidth="1"
android:strokeColor="#00000000"/>
</vector>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/action_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<TextView
android:id="@+id/action_time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_below="@id/action_name_text"
android:gravity="end"
android:textAlignment="textEnd"/>
</RelativeLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mdp_text"
android:labelFor="@id/player_mdp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"/>
<EditText
android:id="@+id/player_mdp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@id/player_mdp"
android:layout_alignParentTop="true"
android:inputType="textPassword"
android:autofillHints="password"/>
<ListView
android:id="@+id/player_select_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/player_mdp"
/>
</RelativeLayout>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/op_name_label"
android:id="@+id/op_name_label"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<EditText
android:id="@+id/op_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/op_name_label"
android:layout_alignParentEnd="true"
android:autofillHints="textPersonName"
android:hint="@string/op_name_hint"
android:inputType="textPersonName"
android:labelFor="@id/op_name_label" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20sp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/op_pass_label"
android:id="@+id/op_password_label"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<EditText
android:id="@+id/op_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/op_password_label"
android:layout_alignParentEnd="true"
android:layout_marginTop="-19dp"
android:importantForAutofill="no"
android:hint="@string/op_pass_hint"
android:inputType="textPassword"
android:labelFor="@id/op_password_label" />
</RelativeLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/op_connect_button"
android:text="@string/op_connect"
android:paddingTop="20sp"/>
</LinearLayout>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/editTextMasterIP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="@string/master_server_ip"
android:importantForAutofill="no"
android:inputType="text"
android:text="@string/default_ip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:id="@+id/connect_as_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_as_player" />
<Button
android:id="@+id/connect_as_op"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_as_op" />
<Button
android:id="@+id/connect_as_mic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_as_mic" />
<Button
android:id="@+id/connect_as_speaker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_as_speaker" />
<Button
android:id="@+id/connect_with_qrcode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_with_qrcode"
android:enabled="false"/>
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.JoueurActivity">
<androidx.viewpager2.widget.ViewPager2
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/view_pager"
android:orientation="horizontal"/>
</FrameLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.ConnectionSelectionActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/player_select_list">
</ListView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pass_label"
android:id="@+id/password_label"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/password_label"
android:layout_alignParentEnd="true"
android:layout_marginTop="-19dp"
android:importantForAutofill="no"
android:hint="@string/pass_hint"
android:inputType="textPassword"
android:labelFor="@id/password_label" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@android:string/ok"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/password" />
</RelativeLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/actions_list"
android:background="@color/purple_700"/>
</LinearLayout>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/items_list"
android:background="@android:color/holo_orange_light"
android:text="Le temps des tempêtes"/>
</RelativeLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/player_name"
android:layout_alignParentStart="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:string/ok"
android:id="@+id/player_select"
android:layout_alignParentEnd="true"
android:layout_alignStart="@id/player_name"/>
</RelativeLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Murderator" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="purple_700">#7B1FA2</color>
<color name="purple_500">#9C27B0</color>
<color name="purple_200">#CE93D8</color>
<color name="teal_200">#80CBC4</color>
<color name="teal_700">#00796B</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

View File

@ -0,0 +1,36 @@
<resources>
<string name="app_name">Murderator</string>
<string name="default_ip" translatable="false">192.168.1.1</string>
<string name="connect_as_player">Joueur</string>
<string name="connect_as_op">Opérateur</string>
<string name="connect_with_qrcode">Via QRCode</string>
<string name="master_server_ip">IP du serveur maître</string>
<string name="op_name_label">Opérateur :</string>
<string name="op_name_hint">Nom d\'opérateur</string>
<string name="op_pass_label">Mot de passe :</string>
<string name="op_pass_hint">Mot de passe</string>
<string name="op_connect">Se connecter en opérateur</string>
<string name="pass_hint">Mot de passe</string>
<string name="pass_label">Mot de passe :</string>
<string name="connect_as_mic">Microphone</string>
<string name="connect_as_speaker">Enceinte</string>
<string name="master_not_found">Le terminal maître n\'a pas été trouvé.</string>
<string name="title_activity_connection_joueur_selection">ConnectionJoueurSelectionActivity
</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="seconnecter">Se connecter</string>
<string name="mdp_text">Mdp:</string>
<string name="no_player_selected">Aucun personnage sélectioné</string>
<string name="connection_failed">Impossible de se connecter</string>
<string name="auth_error">Impossible de se connecter avec le token %s</string>
<string name="action_available_text">Disponible</string>
<string name="action_waiting_text">Reste %s, reset à %s</string>
<string name="no_password_given">Veuillez indiquer un mot de passe</string>
</resources>

View File

@ -0,0 +1,10 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -0,0 +1,25 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Murderator" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.Murderator.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Murderator.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Murderator.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

17
build.gradle Normal file
View File

@ -0,0 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

19
gradle.properties Normal file
View File

@ -0,0 +1,19 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

10
settings.gradle Normal file
View File

@ -0,0 +1,10 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "Murderator"
include ':app'