├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── jcmore2.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── FreeView.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── freeview │ │ └── jcmore2 │ │ └── com │ │ └── freeview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jcmore2 │ │ └── freeview │ │ └── sample │ │ └── MainActivity.java │ └── res │ ├── drawable │ ├── bg_rounded.xml │ └── butterfly.jpg │ ├── layout │ ├── activity_main.xml │ └── content.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── freeview ├── .gitignore ├── build.gradle ├── freeview.iml ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jcmore2 │ │ └── freeview │ │ ├── BackgroundManager.java │ │ ├── FreeView.java │ │ └── FreeViewService.java │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── raw ├── sample.png ├── sample1.gif └── sample2.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | FreeView -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/jcmore2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 67 | 68 | 69 | 70 | 71 | 72 | Android API 3 Platform 73 | 74 | 79 | 80 | 81 | 82 | 83 | 84 | 1.7 85 | 86 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /FreeView.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FreeView 2 | ============= 3 | 4 | FreeView create a floating view that you can use and move inside your app and also when your app is in background. 5 | 6 | 7 | 8 | Usage 9 | ----- 10 | 11 | Add library to your build.gradle: 12 | 13 | ```java 14 | 15 | compile 'com.jcmore2.freeview:freeview:1.1.2' 16 | 17 | ``` 18 | 19 | Add Window permission in your manifest: 20 | 21 | ```xml 22 | 23 | 24 | 25 | ``` 26 | 27 | Init FreeView with your content: 28 | 29 | ```java 30 | 31 | FreeView.init(MainActivity.this).withView(R.layout.content).showFreeView(); 32 | 33 | ``` 34 | 35 | 36 | 37 | 38 | You can also use a callback: 39 | 40 | ```java 41 | 42 | FreeView.init(MainActivity.this).withView(R.layout.content).showFreeView(new FreeView.FreeViewListener() { 43 | @Override 44 | public void onShow() { 45 | Toast.makeText(MainActivity.this, "onShow", Toast.LENGTH_SHORT).show(); 46 | } 47 | 48 | @Override 49 | public void onDismiss() { 50 | Toast.makeText(MainActivity.this, "onDismiss", Toast.LENGTH_SHORT).show(); 51 | } 52 | 53 | @Override 54 | public void onClick() { 55 | Toast.makeText(MainActivity.this, "onClick", Toast.LENGTH_SHORT).show(); 56 | } 57 | }); 58 | 59 | ``` 60 | 61 | Dismiss FreeView using: 62 | 63 | ```java 64 | 65 | FreeView.get().dismissFreeView(); 66 | 67 | 68 | ``` 69 | 70 | If you want FreeView will show when your app goes to background use ``dismissOnBackground(false)``: 71 | 72 | ```java 73 | 74 | FreeView.init(MainActivity.this).withView(R.layout.content).dismissOnBackground(false).showFreeView(new FreeView.FreeViewListener() { 75 | @Override 76 | public void onShow() { 77 | Toast.makeText(MainActivity.this, "onShow", Toast.LENGTH_SHORT).show(); 78 | } 79 | 80 | @Override 81 | public void onDismiss() { 82 | Toast.makeText(MainActivity.this, "onDismiss", Toast.LENGTH_SHORT).show(); 83 | } 84 | }); 85 | 86 | ``` 87 | 88 | 89 | 90 | 91 | You can check the sample App! 92 | 93 | Credits & Contact 94 | ----------------- 95 | 96 | FreeView was created by jcmore2@gmail.com 97 | 98 | 99 | License 100 | ------- 101 | 102 | FreeView is available under the Apache License, Version 2.0. 103 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.jcmore2.freeview.sample" 9 | minSdkVersion 14 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.2.1' 25 | //compile 'com.jcmore2.freeview:freeview:1.0.0' 26 | compile project (':freeview') 27 | } 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Applications/adt-bundle-mac-x86_64-20130522/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/freeview/jcmore2/com/freeview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package freeview.jcmore2.com.freeview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/jcmore2/freeview/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jcmore2.freeview.sample; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | import android.view.View; 8 | import android.widget.Toast; 9 | 10 | import com.jcmore2.freeview.FreeView; 11 | 12 | 13 | public class MainActivity extends AppCompatActivity { 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | 20 | 21 | findViewById(R.id.dismiss).setOnClickListener(new View.OnClickListener() { 22 | @Override 23 | public void onClick(View v) { 24 | FreeView.get().dismissFreeView(); 25 | } 26 | }); 27 | 28 | findViewById(R.id.show).setOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View v) { 31 | FreeView.init(MainActivity.this).withView(R.layout.content).showFreeView(new FreeView.FreeViewListener() { 32 | @Override 33 | public void onShow() { 34 | Toast.makeText(MainActivity.this, "onShow", Toast.LENGTH_SHORT).show(); 35 | } 36 | 37 | @Override 38 | public void onDismiss() { 39 | Toast.makeText(MainActivity.this, "onDismiss", Toast.LENGTH_SHORT).show(); 40 | } 41 | 42 | @Override 43 | public void onClick() { 44 | Toast.makeText(MainActivity.this, "onClick", Toast.LENGTH_SHORT).show(); 45 | } 46 | }); 47 | } 48 | }); 49 | 50 | findViewById(R.id.showBG).setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View v) { 53 | FreeView.init(MainActivity.this).withView(R.layout.content).dismissOnBackground(false).showFreeView(new FreeView.FreeViewListener() { 54 | @Override 55 | public void onShow() { 56 | Toast.makeText(MainActivity.this, "onShow", Toast.LENGTH_SHORT).show(); 57 | } 58 | 59 | @Override 60 | public void onDismiss() { 61 | Toast.makeText(MainActivity.this, "onDismiss", Toast.LENGTH_SHORT).show(); 62 | } 63 | 64 | @Override 65 | public void onClick() { 66 | Toast.makeText(MainActivity.this, "onClick", Toast.LENGTH_SHORT).show(); 67 | } 68 | }); 69 | } 70 | }); 71 | 72 | } 73 | 74 | @Override 75 | public boolean onCreateOptionsMenu(Menu menu) { 76 | // Inflate the menu; this adds items to the action bar if it is present. 77 | getMenuInflater().inflate(R.menu.menu_main, menu); 78 | return true; 79 | } 80 | 81 | @Override 82 | public boolean onOptionsItemSelected(MenuItem item) { 83 | // Handle action bar item clicks here. The action bar will 84 | // automatically handle clicks on the Home/Up button, so long 85 | // as you specify a parent activity in AndroidManifest.xml. 86 | int id = item.getItemId(); 87 | 88 | //noinspection SimplifiableIfStatement 89 | if (id == R.id.action_settings) { 90 | return true; 91 | } 92 | 93 | return super.onOptionsItemSelected(item); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_rounded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/butterfly.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcmore2/FreeView/314ff33f3d14bcd725f207b9f410c7b6cb90239a/app/src/main/res/drawable/butterfly.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 |