dann41/LuckyWheel_Android


A custom component that displays a lucky wheel. it ⁠ features easy customize of colors, addition of items and it's very trivial to integrate in your application.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.dann41:luckywheel_android:0.3.1'
	}
	dependencies {
		implementation("com.github.dann41:luckywheel_android:0.3.1")
	}
	<dependency>
	    <groupId>com.github.dann41</groupId>
	    <artifactId>luckywheel_android</artifactId>
	    <version>0.3.1</version>
	</dependency>

                            
    libraryDependencies += "com.github.dann41" % "luckywheel_android" % "0.3.1"
        
        

                            
    :dependencies [[com.github.dann41/luckywheel_android "0.3.1"]]
        
        

Readme


LuckyWheel Android

Android custom component that displays a lucky wheel. it features easy customize of colors , text and addition of items and it's very trivial to integrate in your application.

Sample

Lucky wheel.

Installing

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

dependencies {
		compile 'com.github.mmoamenn:LuckyWheel_Android:0.1.1'
	}

XML

<com.bluehomestudio.luckywheel.LuckyWheel
        android:id="@+id/lwv"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:layout_centerInParent="true"
        LuckyWheel:background_color="@color/colorPrimary" />

You must use the following properties in your XML

Choose the background color

LuckyWheel:background_color

Choose wheel image arrow

LuckyWheel:arrow_image

JAVA

Functions to use after reference the Lucky wheel

  • Create wheel sections
List<WheelItem> wheelItems = new ArrayList<>();
wheelItems.add(new WheelItem(Color.LTGRAY, BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_action_name) , "text 1"));
                
wheelItems.add(new WheelItem(Color.BLUE, BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_action_name) , "text 2"));
                
wheelItems.add(new WheelItem(Color.BLACK, BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_action_name) , "text 3"));
                
wheelItems.add(new WheelItem(Color.GRAY, BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_action_name) , "text 4"));`
  • Add sections to wheel
 addWheelItems(wheelItems);
  • Rotate by touch -- set target before user touch wheel
 setTarget(3);
  • Rotate to section -- not need if you will use touch
 rotateWheelTo(2);
  • On target reach listener
 setLuckyWheelReachTheTarget(new OnLuckyWheelReachTheTarget() {
            
            @Override
            public void onReachTarget() {
            
                // target reached do operation her    
            
            }
        });