Giter Site home page Giter Site logo

hamedtaherpour / floating-layout-android Goto Github PK

View Code? Open in Web Editor NEW
58.0 6.0 14.0 5.78 MB

Floating Layout library for Android

Java 100.00%
material-design android android-ui android-development android-library floating floating-window floating-layout floating-view layouts

floating-layout-android's Introduction

floating-layout-android

Floating Layout for android platform

Download

Demo

Build

Step 1. Add the JitPack repository to your build file
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
Step 2. Add the dependency
dependencies {
    implementation 'com.github.HamedTaherpour:floating-layout-android:1.1.5'
}

Usage

Manifest

Step 1. Add permission and service to your manifest file
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<application>
    <service android:name="io.hamed.floatinglayout.service.FloatingService"/>
</application>

Layout.xml

Step 2. Create layout and don't forget add id (root_container) like this
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/root_container"
        android:layout_width="250dp"
        android:layout_height="200dp">

        ....

    </FrameLayout>

</FrameLayout>

Java

Step 3. Create FloatingLayout
private FloatingListener floatingListener = new FloatingListener() {
    @Override
    public void onCreateListener(View view) {

    }

    @Override
    public void onCloseListener() {

    }
};

floatingLayout = new FloatingLayout(this, R.layout.sample_layout);
floatingLayout.setFloatingListener(floatingListener);
floatingLayout.create();

floating-layout-android's People

Contributors

hamedtaherpour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

floating-layout-android's Issues

EditText not focused

Hi,

On Android 10,I am using this for taking a quick text note. But the problem is, EditText not get focused and keyboard doesn't appear and so I can't type in (Outside is usable)

Regards..

My Qustion is.

How i disable your floating bar was out side window touch please tell me . and your floating was not disable smoothly it was take some minor time.

floating position top

When I run it, it pops up in the middle of the screen. How do I make it float to the top?

Android 10 Permission Crashing

In Android 10 the app crashes when using library with the following error:

2020-05-24 22:47:55.759 14083-14083/com.powerpoint45.dtube E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.powerpoint45.dtube, PID: 14083
    java.lang.RuntimeException: Unable to start service io.hamed.floatinglayout.FloatingLayoutService@762835b with Intent { cmp=com.powerpoint45.dtube/io.hamed.floatinglayout.FloatingLayoutService (has extras) }: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@bad026a -- permission denied for window type 2038
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4105)
        at android.app.ActivityThread.access$1800(ActivityThread.java:219)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@bad026a -- permission denied for window type 2038
        at android.view.ViewRootImpl.setView(ViewRootImpl.java:955)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:387)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
        at io.hamed.floatinglayout.FloatingLayoutService.createView(FloatingLayoutService.kt:98)
        at io.hamed.floatinglayout.FloatingLayoutService.onStart(FloatingLayoutService.kt:61)
        at android.app.Service.onStartCommand(Service.java:503)
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4087)

This might help solve the issue: https://stackoverflow.com/questions/46208897/android-permission-denied-for-window-type-2038-using-type-application-overlay

Can we add more listener ?

Hi @HamedTaherpour

You have done wonderful job by doing this library.

I have some question, can i add more listener in your library, i have to call listener when i drag start and stop, basically i want to develop feature like translation application, when drag image over application and get text from system application,

One more can i update icon when drag start and stop,
Thanks

FloatingLayout.CallBack() not found

//not found FloatingLayout.CallBack() in kt file

FloatingLayout floatingLayout = new FloatingLayout(this, R.layout.floating_layout, new FloatingLayout.CallBack() {
@OverRide
public void onClickListener(int resourceId) {

}

@Override
public void onCreateListener(View view) {
}

@Override
public void onCloseListener() {

}

});

EditText non usable

Hey, i'm trying to use the floating layout to use a form, I've not been able to use the edittext to enter any data, on the emulator keyboard events are sent to google search bar widet and on my actual device keyboard popup doesn not work, is there something i'm missing out on ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.