This library lets you create joystick with some customization for android

Overview

AndroidJoyStickView

libimage

Platform API License

This library lets you create joystick with some customization for android

Gradle

Add the dependency

dependencies {
    ...
    implementation 'com.jackandphantom.android:joystickview:1.0.2'
}

Basic Usage

AndroidJoystickView XML

In order to use AndroidLikeButton copy following xml code in your xml file.

 <com.jackandphantom.joystickview.JoyStickView
     android:layout_width="150dp"
     android:layout_height="150dp"
     app:outerCircleBorderColor="#fff"
     app:innerCircleColor="#151414"
     app:outerCircleBorderWidth="5"
     app:shadowRadius="7"
     app:shadowColor="#000"
     app:outerCircleColor="#a6a9551e"
     app:innerCircleImage="@drawable/ic_directions_run_black_24dp"
     android:layout_alignParentBottom="true">

AndroidJoystickView Interface

JoyStickView joyStickView = findViewById(R.id.joy);
joyStickView.setOnMoveListener(new JoyStickView.OnMoveListener() {
            @Override
            public void onMove(double angle, float strength) {
                
            }
        });

Concept

There are two views in JoyStick

  1. InnerCircleView : This is small circle in joystick as you can see in image so attributes related to this view will using innerCircle in prefix in xml

  2. OuterCircleView : This is big circle in joystick so all attributes related to this will using outerCircle in prefix in xml

Attributes

There are several attribute to configure AndroidJoystick view, they are following

InnerCircleView Attributes

innerCircleColor , innerCircleImage

In order to change the inner Circle color and add the image into the small circle use the following code :-

<com.jackandphantom.joystickview.JoyStickView
     app:innerCircleColor="#151414"
     app:innerCircleImage="@drawable/ic_directions_run_black_24dp"
 />

In Java

  joyStickView.setInnerCircleImageResId(R.drawable.ic_directions_run_black_24dp);
  joyStickView.setInnerCircleColor(Color.BLACK);

innerCircleRadius

Before changing the size of small circle you need to understand small concep which is both inner and outer circle has ratio 0.1f and 0.4f respectively so you have to maintain 5.0f in total. so when you change innerCircleRadius value it substracted outercircle value from 5.0f.

 <com.jackandphantom.joystickview.JoyStickView
    app:innerCircleRadius="0.15"
  />

In Java

joyStickView.setInnerCircleRadius(0.1f);

OuterCircleView Attributes

outerCircleColor , outerCircleBorderWidth , outerCircleBorderColor

In order to change outerCircle attributes like it's color , bordercolor and borderWidth you can use following code :

 <com.jackandphantom.joystickview.JoyStickView
    app:outerCircleBorderColor="#fff"
     app:outerCircleBorderWidth="5"
     app:outerCircleColor="#a6a9551e"
  />

In Java

 joyStickView.setOuterCircleBorderColor(Color.RED);
 joyStickView.setOuterCircleBorderStrokeWidth(15);
 joyStickView.setOuterCircleColor(Color.WHITE);

lockCenter

The default property of joystickview is that when move it and you release it then it automatically came to the center and lockCenter is the property in which it lock the small circle when it stength is equal to 100 so if you want to lock it then

 <com.jackandphantom.joystickview.JoyStickView
    app:lockCenter="true"
  />

In Java

 joyStickView.setLockCenter(false);

Shadow

If you want to addt the shadow in joystick first you need to add outerCircleBorderWidth value and then you can change these properties

ShadowRadius , shadowColor , Dx, Dy

 <com.jackandphantom.joystickview.JoyStickView
     app:shadowColor="#000"
     app:shadowRadius="7"
     app:shadowDy="5"
     app:shadowDx="5"
  />

In Java

joyStickView.setShadowColor(Color.BLACK);
joyStickView.setShadowRadius(7f);
joyStickView.setShadowDxAndDy(5f, 5f);

LICENCE

Copyright 2018 Ankit kumar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Special Thanks to Manish and zerokol

You might also like...
A library support form with material design, construct same with Android UI Framework

SwingUI A slight Java Swing library support form with material design, construct same with Android UI Framework writen in Kotlin Supported: 1. Screen:

ToggleIconView is a collection library of animated two-stage toggle icons for Android.
ToggleIconView is a collection library of animated two-stage toggle icons for Android.

ToggleIconView ToggleIconView is a collection library of animated two-stage toggle icons for Android. Installation JitPack repository // Project level

Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.
Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Material Icon Library A library containing over 2000 material vector icons that can be easily used as Drawable, a standalone View or inside menu resou

A Material Design ViewPager easy to use library
A Material Design ViewPager easy to use library

MaterialViewPager Material Design ViewPager easy to use library Sample And have a look on a sample Youtube Video : Youtube Link Download In your modul

😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.
😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.

Material Dialogs View Releases and Changelogs Modules The core module is the fundamental module that you need in order to use this library. The others

Floating Action Button for Android based on Material Design specification
Floating Action Button for Android based on Material Design specification

FloatingActionButton Yet another library for drawing Material Design promoted actions. Features Support for normal 56dp and mini 40dp buttons. Customi

Implementation of Ripple effect from Material Design for Android API 9+
Implementation of Ripple effect from Material Design for Android API 9+

RippleEffect ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a ma

Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

Animations for Android L drawer, back, dismiss and check icons
Animations for Android L drawer, back, dismiss and check icons

Material Menu Morphing Android menu, back, dismiss and check buttons Have full control of the animation: Including in your project compile 'com.balysv

Comments
  • Upstream fixes

    Upstream fixes

    Overview

    Behavioral fixes I made to make this work with SoftWing. Changes include:

    • Adding logic to center the joystick on release.
    • Adding logic for handling multiple touch pointers.

    Testing Done

    Most of the testing has been performed as a part of my app that uses this library https://github.com/lucasjodon/SoftWing

    opened by lucasjodon 1
  • Modernize

    Modernize

    The maven publish has issues, but you have to solve it by your own. Merge it and you will see the missing credentials

    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    
    bintray {
        user = properties.getProperty("bintray.user")
        key = properties.getProperty("bintray.apikey")
    

    I at least removed the maven publish aeea83b2da4f88a , 316356648 and I'm using now this maven https://jitpack.io/#hannesa2/AndroidJoyStickView

    opened by hannesa2 0
  • Documentation is unclear on how the strength is measured.

    Documentation is unclear on how the strength is measured.

    I had to check the source to find out that the strength is a percentage value, from 0 to 100. I never saw this anywhere in the README or any other documentation. It would be nice if you added this somewhere, just to make this a tiny bit easier to use!

    Great work, by the way!

    opened by maillouxc 1
Owner
Jack and phantom
I am a code lover person and Android Engineer @Decathlon
Jack and phantom
Material You interface with dynamic theme support for your Android projects

Material You Sample Material You interface with dynamic theme support for your Android projects Requirements Android Studio Chipmunk 2021.2.1 or highe

aospstudio 3 Jul 28, 2022
Material You Theme for Frames Dashboard

Material You Theme for Frames Dashboard Frames Dashboard Copy everything into your Frames project, edit colors, corner radius... Use compileSdk = 31 V

pashapuma 8 Dec 14, 2022
A straightforward, no-BS compass app with support for Material You themes 🧭

Compass A simple & straightforward, no-BS compass app that works with your Material You colors! Motivation I do security work as a fourth job and havi

Synapse Technologies, LLC 16 Nov 23, 2022
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.

Material Dialogs for Android ?? ?? Android Library to implement animated, ?? beautiful, ?? stylish Material Dialog in android apps easily. 1. Material

Shreyas Patil 875 Dec 28, 2022
Material Shadows for android : A library for supporting convex material shadows

MaterialShadows A library for seamlessly integrating Material shadows. The library takes existing material shadows to next level by adding the followi

Harjot Singh Oberai 2.2k Dec 19, 2022
A library to bring fully animated Material Design components to pre-Lolipop Android.

Material MaterialLibrary is an Open Source Android library that back-port Material Design components to pre-Lolipop Android. MaterialLibrary's origina

Rey Pham 6k Dec 21, 2022
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

MaterialDrawer ... the flexible, easy to use, all in one drawer library for your Android project. What's included ?? • Setup ??️ • Migration Guide ??

Mike Penz 11.6k Dec 27, 2022
An Android library aimed to get the beautiful CardViews that Google shows at its official design specifications

MaterialList Discontinued This library will not receive any updates, as I do not have the time or knowledge to improve it. If anyone forks it and want

null 1.6k Nov 29, 2022
[] Android Library that implements Snackbars from Google's Material Design documentation.

DEPRECATED This lib is deprecated in favor of Google's Design Support Library which includes a Snackbar and is no longer being developed. Thanks for a

null 1.5k Dec 16, 2022
Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library.

Material Design Dimens Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library. Dimens Pattern: R.di

Dmitry Malkovich 1.4k Jan 3, 2023