Giter Site home page Giter Site logo

floatingwindowdemo's Introduction

FloatingWindowDemo

Alt text Alt text

XDA Guide: http://forum.xda-developers.com/showthread.php?p=46569392#post46569392

Play Store Demo: https://play.google.com/store/apps/details?id=com.klinker.android.floating_window&hl=en

This is just a demo of how to create a floating window activity such as Paranoid Android's Halo is able to do.

It is actually a very simple process. The way me and Jacob Klinker do it for our apps is by extending the MainActivity in some kind of popup activity, setting the theme to one of androids .Dialog themes, then using the built in window manager to set the size of the window.

If you want everything in the window to work the same as in the MainActivity, then you are done after making the setUpWindow function, otherwise, if you just do all of your work in seperate functions from the onCreate method, it is very easy to override them and change their behavior in the floating window form.

This is just a very simple demo, with a button to change between states and an edit text to see how the window is able to resize. That is it, no bells or whistles, but, in theory, this pop up can do EVERYTHING and ANYTHING that your MainActivity can do. You will just have to override the correct functionality and make sure you initialize and monitor everything correctly.

This doens't just have to be for a stand alone pop up though, say you wanted to be different and have your settings menu come up in windowed form instead of as a new activity. You could just not finish() the current activity and call the settings menu with a new intent. That may be a silly example, but you see the idea, windows stacking on top of each other can be very useful and faster since there doesn't have to be any transitions or new brand new activities.

Obviously this is very basic, as I said. It is the framework for building awesome stuff though. For me and Jacob's Sliding Messaging Pro app, we use it as the quick replay and make it availible from a "SlideOver" bubble, a lot like halo does. As long as you can find a clever way to call this activity though, it is like the entire app is availible anywhere in the system, that is what made PA's implementation to new and great!

Hope you enjoy this, a lot of very powerful stuff can come from a floating window implementation like this!

Credit goes to Paranoid Android for the idea, then Jacob Klinker and I for the implementation and method

-- Luke Klinker

floatingwindowdemo's People

Contributors

klinker24 avatar

Watchers

James Cloos avatar Lerist avatar  avatar

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.