Skip to content
Snippets Groups Projects
Commit 55daedac authored by MAUGEZ Emeline's avatar MAUGEZ Emeline
Browse files

Ajout de Wheel Activity

parent ed41372e
No related branches found
No related tags found
No related merge requests found
......@@ -104,5 +104,6 @@
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation-experimental:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:2.1.3@aar" level="project" />
<orderEntry type="library" name="Gradle: com.github.mmoamenn:LuckyWheel_Android:0.3.0@aar" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -45,6 +45,7 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.github.mmoamenn:LuckyWheel_Android:0.3.0'
testImplementation 'junit:junit:4.13.2'
......
......@@ -100,6 +100,17 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".control.WheelActivity"
android:configChanges="orientation"
android:theme="@style/Theme.Robotise"
android:exported="true"
tools:ignore="IntentFilterExportedReceiver">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
......@@ -20,6 +20,7 @@ public class LoginActivity extends Activity {
// Deux radio button permettant de choisir le mode utilisateur ou administrateur
RadioButton mUtilisateur;
RadioButton mAdministrateur;
RadioButton mRandomWheel;
// Permet d'éditer le mdp
EditText mMdp;
//Permet de valider le mode et le mdp
......@@ -47,6 +48,10 @@ public class LoginActivity extends Activity {
Intent i = new Intent(getApplicationContext(), ListCocktailsActivity.class);
startActivity(i);
}
else if(mRandomWheel.isChecked()){
Intent i = new Intent(getApplicationContext(), WheelActivity.class);
startActivity(i);
}
else if (enable){
Intent i = new Intent(getApplicationContext(), AdminActivity.class);
startActivity(i);
......@@ -71,6 +76,14 @@ public class LoginActivity extends Activity {
}
});
mRandomWheel = findViewById(R.id.random_cocktail);
mRandomWheel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mMdp.setVisibility(View.GONE);
}
});
}
......
package com.example.robotise.control;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.bluehomestudio.luckywheel.LuckyWheel;
import com.bluehomestudio.luckywheel.OnLuckyWheelReachTheTarget;
import com.bluehomestudio.luckywheel.WheelItem;
import com.example.robotise.R;
import java.util.ArrayList;
public class WheelActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.roue_activity);
LuckyWheel lw = (LuckyWheel) findViewById(R.id.lucky_wheel);
ArrayList<WheelItem> wheelItems = new ArrayList<>();
wheelItems.add(new WheelItem(Color.LTGRAY,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name), "text 1"));
wheelItems.add(new WheelItem(Color.BLUE,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name),
"text 2"));
wheelItems.add(new WheelItem(Color.BLACK,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name),
"text 3"));
wheelItems.add(new WheelItem(Color.GRAY,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name)
, "text 4"));
wheelItems.add(new WheelItem(Color.RED,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name),
"text 5"));
wheelItems.add(new WheelItem(Color.BLACK,
BitmapFactory.decodeResource(getResources(), com.bluehomestudio.luckywheel.R.drawable.ic_action_name),
"text 6"));
lw.addWheelItems(wheelItems);
lw.setTarget(3);
lw.setLuckyWheelReachTheTarget(new OnLuckyWheelReachTheTarget() {
@Override
public void onReachTarget() {
lw.setTarget((int)(Math.random()*(5)+1));
}
});
}
}
......@@ -77,6 +77,13 @@
android:text="Administrateur"
android:textSize="20dp"/>
<RadioButton
android:id="@+id/random_cocktail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Random"
android:textSize="20dp"/>
</RadioGroup>
<EditText
......
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:LuckyWheel="http://schemas.android.com/tools">
<com.bluehomestudio.luckywheel.LuckyWheel
android:id="@+id/lucky_wheel"
android:layout_width="290dp"
android:layout_height="290dp"
android:layout_centerInParent="true"
LuckyWheel:background_color="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -10,6 +10,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "Robotise"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment