Coder Social home page Coder Social logo

augmify / floatingview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from recruit-lifestyle/floatingview

0.0 1.0 0.0 1.59 MB

Home Page: http://engineer.recruit-lifestyle.co.jp/techblog/2015-07-29-floatingview/

License: Apache License 2.0

Java 100.00%

floatingview's Introduction

FloatingView

The Android project is View to display information such as chat in front.
To API Level 14 or later are supported

##Screenshots

Watch YouTube video
SimpleFloating
FloatingAd

Requirements

Target Sdk Version : 22
Min Sdk Version : 14

##How to use

  1. Add this to your build.gradle.
repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
  compile 'com.github.recruit-lifestyle:FloatingView:1.0'
}
  1. Implement Service for displaying FloatingView
public class ChatHeadService extends Service {
  ・・・
}
  1. You will do the setting of the View to be displayed in the FloatingView(Sample have a set in onStartCommand)
  final LayoutInflater inflater = LayoutInflater.from(this);
  final ImageView iconView = (ImageView) inflater.inflate(R.layout.widget_chathead, null, false);
  iconView.setOnClickListener(・・・);
  1. Use the FloatingViewManager, make the setting of FloatingView
  mFloatingViewManager = new FloatingViewManager(this, this);
  mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_trash_fixed);
  mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_trash_action);
  mFloatingViewManager.addViewToWindow(iconView, FloatingViewManager.SHAPE_CIRCLE, (int) (16 * metrics.density));

The second argument of FloatingViewManager is FloatingViewListener

Describe the process (onFinishFloatingView) that is called when you exit the FloatingView

    @Override
    public void onFinishFloatingView() {
        stopSelf();
    }
  1. Add the permission to AndroidManifest
 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
 <uses-permission android:name="android.permission.VIBRATE"/>
  1. Define the Service to AndroidManifest example)
    <application ・・・>
        ・・・
        <!-- Demo -->
        <service
            android:name="jp.co.recruit_lifestyle.sample.service.ChatHeadService"
            android:exported="false"/>
        ・・・
    </application>
  1. Describe the process to start the Service (example of Fragment)
    final Activity activity = getActivity();
    activity.startService(new Intent(activity, ChatHeadService.class));

Info. If you want to use the FloatingAdService,replace the ad_unit_id(string.xml) with your ad unit id (Interstitial Ad).

 <string name="ad_unit_id">ADD_YOUR_UNIT_ID</string>

Reference:Give your app an Ad Unit ID

Credits

FloatingView is owned and maintained by RECRUIT LIFESTYLE CO., LTD.

FloatingView was originally created by Yoshihide Sogawa

##License

Copyright 2015 RECRUIT LIFESTYLE CO., LTD.

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.

floatingview's People

Contributors

amyu avatar yoshihidesogawa avatar

Watchers

 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.