├── .gitignore ├── README.md ├── build.gradle ├── floatingMenu ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── fr │ │ └── anthonyfernandez │ │ └── floatingmenu │ │ ├── Activities │ │ ├── Configurations.java │ │ └── MainActivity.java │ │ ├── Adapter │ │ ├── CustomAdapter.java │ │ └── InitPagerAdapter.java │ │ ├── Manager │ │ ├── PInfo.java │ │ └── RetrievePackages.java │ │ ├── Service │ │ └── ServiceFloating.java │ │ └── Slide │ │ ├── SlideLaunch.java │ │ ├── SpanOne.java │ │ ├── SpanThree.java │ │ └── SpanTwo.java │ └── res │ ├── drawable-hdpi │ ├── span_1.png │ ├── span_2.png │ └── span_3.png │ ├── drawable-ldpi │ ├── span_1.png │ ├── span_2.png │ └── span_3.png │ ├── drawable-mdpi │ ├── span_1.png │ ├── span_2.png │ └── span_3.png │ ├── drawable-xhdpi │ ├── floating2.png │ ├── floating3.png │ ├── floating4.png │ ├── floating5.png │ ├── span_1.png │ ├── span_2.png │ └── span_3.png │ ├── drawable-xxhdpi │ └── github_logo.png │ ├── layout │ ├── activity_configurations.xml │ ├── activity_launch.xml │ ├── activity_main.xml │ ├── list_item.xml │ ├── list_item_config.xml │ ├── popup.xml │ ├── row.xml │ ├── row_config.xml │ ├── span_one.xml │ ├── span_three.xml │ └── span_two.xml │ ├── menu │ ├── configurations.xml │ └── main.xml │ ├── values-sw600dp │ └── dimens.xml │ ├── values-sw720dp-land │ └── dimens.xml │ ├── values-v11 │ └── styles.xml │ ├── values-v14 │ └── styles.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | #gradle/wrapper 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Android Studio 27 | .idea 28 | *.iml 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FloatingView [(Application Demo on Play Store)](https://play.google.com/store/apps/details?id=fr.anthonyfernandez.floatingmenu) 2 | -------------------- 3 | 4 | DEPRECATED SEE [FloatingView](https://github.com/recruit-lifestyle/FloatingView) 5 | 6 | -------------------- 7 | 8 | Floating View for Android app - Facebook ChatHeads Notification system 9 | This is a demo of how works Facebook ChatHeads. 10 | 11 | ## Details 12 | 13 | Basiclay all you need to do is to create a service (background running) with image View like this : 14 | 15 | ```Android 16 | windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); 17 | 18 | chatHead = new ImageView(this); 19 | chatHead.setImageResource(R.drawable.floating2); 20 | 21 | final WindowManager.LayoutParams params = new WindowManager.LayoutParams( 22 | WindowManager.LayoutParams.WRAP_CONTENT, 23 | WindowManager.LayoutParams.WRAP_CONTENT, 24 | WindowManager.LayoutParams.TYPE_PHONE, 25 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, 26 | PixelFormat.TRANSLUCENT); 27 | 28 | params.gravity = Gravity.TOP | Gravity.LEFT; 29 | params.x = 0; 30 | params.y = 100; 31 | ``` 32 | 33 | Then start your service : 34 | ```Android 35 | startService(new Intent(MainActivity.this, ServiceFloating.class)); 36 | ``` 37 | 38 | If you wanna have a floating window, you can use PopupWindow : 39 | ```Android 40 | LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE); 41 | View popupView = layoutInflater.inflate(R.layout.popup, null); 42 | pwindo = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 43 | if(_enable == true) { 44 | pwindo.showAsDropDown(chatHead, 50, -30); 45 | ``` 46 | 47 | ## Screenshots 48 | 49 | ![Floating1](http://185.14.185.122/github/float3.png) 50 | ![Floating2](http://185.14.185.122/github/float2.png) 51 | 52 | 53 | ## License 54 | 55 | This work is under the MIT License (MIT) 56 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:2.2.3' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /floatingMenu/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | apply plugin: 'com.android.application' 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "25.0.2" 7 | 8 | defaultConfig { 9 | minSdkVersion 11 10 | targetSdkVersion 23 11 | } 12 | 13 | buildTypes { 14 | release { 15 | //runProguard false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.larswerkman:HoloColorPicker:1.4' 23 | compile 'com.android.support:support-v4:+' 24 | } 25 | -------------------------------------------------------------------------------- /floatingMenu/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Activities/Configurations.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Activities; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.content.SharedPreferences.Editor; 7 | import android.graphics.PorterDuff.Mode; 8 | import android.graphics.PorterDuffColorFilter; 9 | import android.graphics.drawable.Drawable; 10 | import android.os.Bundle; 11 | import android.preference.PreferenceManager; 12 | import android.view.Menu; 13 | import android.view.View; 14 | import android.view.View.OnClickListener; 15 | import android.widget.Button; 16 | import android.widget.ImageButton; 17 | import android.widget.ImageView; 18 | 19 | import com.larswerkman.holocolorpicker.ColorPicker; 20 | import com.larswerkman.holocolorpicker.ColorPicker.OnColorChangedListener; 21 | import com.larswerkman.holocolorpicker.OpacityBar; 22 | 23 | import fr.anthonyfernandez.floatingmenu.R; 24 | 25 | public class Configurations extends Activity { 26 | 27 | private ImageView icon; 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_configurations); 33 | 34 | icon = (ImageView)findViewById(R.id.imageView1); 35 | 36 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Configurations.this); 37 | if(prefs.getString("ICON", "floating2").equals("floating3")){ 38 | icon.setImageResource(R.drawable.floating3); 39 | } else if(prefs.getString("ICON", "floating2").equals("floating4")){ 40 | icon.setImageResource(R.drawable.floating4); 41 | } else if(prefs.getString("ICON", "floating2").equals("floating5")){ 42 | icon.setImageResource(R.drawable.floating5); 43 | } 44 | 45 | /* 46 | * 47 | * FOR THE COLOR DRAWABLE CHANGING 48 | */ 49 | final ColorPicker picker = (ColorPicker) findViewById(R.id.picker); 50 | OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar); 51 | picker.addOpacityBar(opacityBar); 52 | 53 | //To get the color 54 | picker.getColor(); 55 | 56 | //To set the old selected color u can do it like this 57 | picker.setOldCenterColor(picker.getColor()); 58 | // adds listener to the colorpicker which is implemented 59 | //in the activity 60 | picker.setOnColorChangedListener(new OnColorChangedListener() { 61 | @Override 62 | public void onColorChanged(int color) { 63 | Drawable mDrawable = icon.getDrawable(); 64 | mDrawable.setColorFilter(new 65 | PorterDuffColorFilter(picker.getColor(),Mode.MULTIPLY)); 66 | icon.setImageDrawable(mDrawable); 67 | } 68 | }); 69 | 70 | /* 71 | * 72 | * FOR THE ICON CHANGING 73 | */ 74 | 75 | ImageButton image1 = (ImageButton)findViewById(R.id.imageButton1); 76 | image1.setOnClickListener(new OnClickListener() { 77 | @Override 78 | public void onClick(View v) { 79 | 80 | setPreferences("floating3"); 81 | icon.setImageResource(R.drawable.floating3); 82 | } 83 | }); 84 | ImageButton image2 = (ImageButton)findViewById(R.id.imageButton2); 85 | image2.setOnClickListener(new OnClickListener() { 86 | @Override 87 | public void onClick(View v) { 88 | setPreferences("floating4"); 89 | icon.setImageResource(R.drawable.floating4); 90 | } 91 | }); 92 | ImageButton image3 = (ImageButton)findViewById(R.id.imageButton3); 93 | image3.setOnClickListener(new OnClickListener() { 94 | @Override 95 | public void onClick(View v) { 96 | setPreferences("floating5"); 97 | icon.setImageResource(R.drawable.floating5); 98 | } 99 | }); 100 | 101 | Button restore = (Button)findViewById(R.id.restore); 102 | restore.setOnClickListener(new OnClickListener() { 103 | @Override 104 | public void onClick(View v) { 105 | setPreferences("floating2"); 106 | icon.setImageResource(R.drawable.floating2); 107 | } 108 | }); 109 | 110 | Button backHome = (Button)findViewById(R.id.back_main); 111 | backHome.setOnClickListener(new OnClickListener() { 112 | @Override 113 | public void onClick(View v) { 114 | Intent intentMain = new Intent(Configurations.this, MainActivity.class); 115 | startActivity(intentMain); 116 | } 117 | }); 118 | } 119 | 120 | @Override 121 | public boolean onCreateOptionsMenu(Menu menu) { 122 | // Inflate the menu; this adds items to the action bar if it is present. 123 | getMenuInflater().inflate(R.menu.configurations, menu); 124 | return true; 125 | } 126 | 127 | private void setPreferences(String myIconPref) 128 | { 129 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Configurations.this); 130 | Editor editor = prefs.edit(); 131 | editor.putString("ICON", myIconPref); 132 | editor.commit(); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Activities/MainActivity.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Activities; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | import android.os.Build; 7 | import android.os.Bundle; 8 | import android.provider.Settings; 9 | import android.view.View; 10 | import android.view.View.OnClickListener; 11 | import android.widget.Button; 12 | import android.widget.ImageView; 13 | 14 | import fr.anthonyfernandez.floatingmenu.R; 15 | import fr.anthonyfernandez.floatingmenu.Service.ServiceFloating; 16 | 17 | public class MainActivity extends Activity { 18 | 19 | public static int OVERLAY_PERMISSION_REQ_CODE = 1234; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_main); 25 | 26 | Bundle bundle = getIntent().getExtras(); 27 | 28 | if(bundle != null && bundle.getString("LAUNCH").equals("YES")) { 29 | startService(new Intent(MainActivity.this, ServiceFloating.class)); 30 | } 31 | 32 | Button launch = (Button)findViewById(R.id.button1); 33 | launch.setOnClickListener(new OnClickListener() { 34 | 35 | @Override 36 | public void onClick(View v) { 37 | startService(new Intent(MainActivity.this, ServiceFloating.class)); 38 | } 39 | }); 40 | 41 | Button stop = (Button)findViewById(R.id.button2); 42 | stop.setOnClickListener(new OnClickListener() { 43 | 44 | @Override 45 | public void onClick(View v) { 46 | stopService(new Intent(MainActivity.this, ServiceFloating.class)); 47 | } 48 | }); 49 | 50 | ImageView github = (ImageView)findViewById(R.id.imageView1); 51 | github.setOnClickListener(new OnClickListener() { 52 | 53 | @Override 54 | public void onClick(View v) { 55 | String url = "https://github.com/marshallino16/FloatingNotification"; 56 | Intent i = new Intent(Intent.ACTION_VIEW); 57 | i.setData(Uri.parse(url)); 58 | startActivity(i); 59 | } 60 | }); 61 | 62 | Button config = (Button)findViewById(R.id.button_config); 63 | config.setOnClickListener(new OnClickListener() { 64 | 65 | @Override 66 | public void onClick(View arg0) { 67 | Intent intent = new Intent(MainActivity.this, Configurations.class); 68 | startActivity(intent); 69 | stopService(new Intent(MainActivity.this, ServiceFloating.class)); 70 | } 71 | }); 72 | checkPermission(); 73 | 74 | } 75 | 76 | 77 | public void checkPermission() { 78 | if(Build.VERSION.SDK_INT >= 23) { 79 | if (!Settings.canDrawOverlays(MainActivity.this)) { 80 | Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, 81 | Uri.parse("package:" + getPackageName())); 82 | startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE); 83 | } 84 | } 85 | } 86 | 87 | 88 | @Override 89 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 90 | if (requestCode == OVERLAY_PERMISSION_REQ_CODE) { 91 | if (!Settings.canDrawOverlays(this)) { 92 | // SYSTEM_ALERT_WINDOW permission not granted... 93 | } 94 | } 95 | } 96 | 97 | @Override 98 | protected void onResume() { 99 | Bundle bundle = getIntent().getExtras(); 100 | 101 | if(bundle != null && bundle.getString("LAUNCH").equals("YES")) { 102 | startService(new Intent(MainActivity.this, ServiceFloating.class)); 103 | } 104 | super.onResume(); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Adapter/CustomAdapter.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Adapter; 2 | 3 | import java.util.List; 4 | 5 | import fr.anthonyfernandez.floatingmenu.R; 6 | import fr.anthonyfernandez.floatingmenu.Manager.PInfo; 7 | import android.content.Context; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ArrayAdapter; 12 | import android.widget.ImageView; 13 | import android.widget.LinearLayout; 14 | import android.widget.TextView; 15 | 16 | public class CustomAdapter extends ArrayAdapter{ 17 | 18 | private int resource; 19 | private LayoutInflater inflater; 20 | private Context context; 21 | 22 | public CustomAdapter ( Context ctx, int resourceId, List apps) { 23 | 24 | super( ctx, resourceId, apps ); 25 | resource = resourceId; 26 | inflater = LayoutInflater.from( ctx ); 27 | context=ctx; 28 | } 29 | 30 | @Override 31 | public View getView ( int position, View convertView, ViewGroup parent ) { 32 | 33 | convertView = (LinearLayout) inflater.inflate( resource, null ); 34 | 35 | PInfo app = (PInfo) getItem(position); 36 | 37 | TextView txtName = (TextView) convertView.findViewById(R.id.textView1); 38 | txtName.setText(app.appname); 39 | 40 | ImageView imageCity = (ImageView) convertView.findViewById(R.id.imageView1); 41 | imageCity.setImageDrawable(app.icon); 42 | return convertView; 43 | } 44 | } -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Adapter/InitPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Adapter; 2 | 3 | 4 | import java.util.List; 5 | 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentPagerAdapter; 9 | 10 | public class InitPagerAdapter extends FragmentPagerAdapter { 11 | 12 | private final List fragments; 13 | 14 | //On fournit l'adapter la liste des fragments afficher 15 | public InitPagerAdapter(FragmentManager fm, List fragments) { 16 | super(fm); 17 | this.fragments = fragments; 18 | } 19 | 20 | @Override 21 | public Fragment getItem(int position) { 22 | return (Fragment) this.fragments.get(position); 23 | } 24 | 25 | @Override 26 | public int getCount() { 27 | return this.fragments.size(); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Manager/PInfo.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Manager; 2 | 3 | import android.graphics.drawable.Drawable; 4 | import android.util.Log; 5 | 6 | public class PInfo { 7 | public String appname = ""; 8 | public String pname = ""; 9 | public String versionName = ""; 10 | public int versionCode = 0; 11 | public Drawable icon; 12 | public void prettyPrint() { 13 | Log.v("tag", appname + "\t" + pname + "\t" + versionName + "\t" + versionCode); 14 | } 15 | } -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Manager/RetrievePackages.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Manager; 2 | 3 | import android.content.Context; 4 | import android.content.pm.ApplicationInfo; 5 | import android.content.pm.PackageInfo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class RetrievePackages { 11 | 12 | private Context _ctx; 13 | 14 | public RetrievePackages(Context ctx) { 15 | _ctx = ctx; 16 | } 17 | 18 | public ArrayList getPackages() { 19 | ArrayList apps = getInstalledApps(false); /* false = no system packages */ 20 | final int max = apps.size(); 21 | for (int i=0; i getInstalledApps(boolean getSysPackages) { 28 | ArrayList res = new ArrayList(); 29 | List packs = _ctx.getPackageManager().getInstalledPackages(0); 30 | for(int i=0;i myArray; 46 | ArrayList apps; 47 | List listCity; 48 | 49 | @Override 50 | public IBinder onBind(Intent intent) { 51 | // TODO Auto-generated method stub 52 | return null; 53 | } 54 | 55 | @Override 56 | public void onCreate() { 57 | super.onCreate(); 58 | 59 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); 60 | 61 | RetrievePackages getInstalledPackages = new RetrievePackages(getApplicationContext()); 62 | apps = getInstalledPackages.getInstalledApps(false); 63 | myArray = new ArrayList(); 64 | 65 | for(int i=0 ; i arrayAdapter = 171 | //new ArrayAdapter(this,R.layout.list_item, myArray); 172 | popup.setAdapter(new CustomAdapter(getApplicationContext(), R.layout.row, listCity)); 173 | popup.setOnItemClickListener(new OnItemClickListener() { 174 | 175 | @Override 176 | public void onItemClick(AdapterView arg0, View view, int position, long id3) { 177 | //Log.w("tag", "package : "+apps.get(position).pname.toString()); 178 | Intent i; 179 | PackageManager manager = getPackageManager(); 180 | try { 181 | i = manager.getLaunchIntentForPackage(apps.get(position).pname.toString()); 182 | if (i == null) 183 | throw new PackageManager.NameNotFoundException(); 184 | i.addCategory(Intent.CATEGORY_LAUNCHER); 185 | startActivity(i); 186 | } catch (PackageManager.NameNotFoundException e) { 187 | 188 | } 189 | } 190 | }); 191 | popup.show(); 192 | 193 | } catch (Exception e) { 194 | e.printStackTrace(); 195 | } 196 | } 197 | 198 | public void createNotification(){ 199 | Intent notificationIntent = new Intent(getApplicationContext(), ServiceFloating.class); 200 | PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, notificationIntent, 0); 201 | 202 | 203 | NotificationCompat.Builder builder = new NotificationCompat.Builder(this) 204 | .setContentIntent(pendingIntent) 205 | .setSmallIcon(R.drawable.floating2).setTicker("Click to start launcher").setWhen(System.currentTimeMillis()) 206 | .setContentTitle("Start launcher") 207 | .setContentText("Click to start launcher"); 208 | 209 | NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); 210 | notificationManager.notify(ID_NOTIFICATION, builder.build()); 211 | } 212 | 213 | @Override 214 | public void onDestroy() { 215 | super.onDestroy(); 216 | if (chatHead != null) windowManager.removeView(chatHead); 217 | } 218 | 219 | } -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Slide/SlideLaunch.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Slide; 2 | 3 | import java.util.List; 4 | import java.util.Vector; 5 | 6 | import fr.anthonyfernandez.floatingmenu.R; 7 | 8 | import fr.anthonyfernandez.floatingmenu.Activities.MainActivity; 9 | import fr.anthonyfernandez.floatingmenu.Adapter.InitPagerAdapter; 10 | import android.content.Intent; 11 | import android.content.SharedPreferences; 12 | import android.os.Bundle; 13 | import android.os.Handler; 14 | import android.os.Message; 15 | import android.preference.PreferenceManager; 16 | import android.support.v4.app.Fragment; 17 | import android.support.v4.app.FragmentActivity; 18 | import android.support.v4.view.PagerAdapter; 19 | import android.support.v4.view.ViewPager; 20 | 21 | public class SlideLaunch extends FragmentActivity { 22 | 23 | private PagerAdapter mPagerAdapter; 24 | private Handler handler = new Handler() 25 | { 26 | public void handleMessage(Message msg) 27 | { 28 | Intent i = new Intent(SlideLaunch.this, MainActivity.class); 29 | SlideLaunch.this.startActivity(i); 30 | finish(); 31 | } 32 | }; 33 | 34 | @Override 35 | protected void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | 38 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 39 | if(!prefs.getBoolean("first_time", false)) 40 | { 41 | SharedPreferences.Editor editor = prefs.edit(); 42 | editor.putBoolean("first_time", true); 43 | editor.commit(); 44 | setContentView(R.layout.activity_launch); 45 | 46 | // Creation de la liste de Fragments que fera defiler le PagerAdapter 47 | List fragments = new Vector(); 48 | 49 | // Ajout des Fragments dans la liste 50 | fragments.add(Fragment.instantiate(this,SpanOne.class.getName())); 51 | fragments.add(Fragment.instantiate(this,SpanTwo.class.getName())); 52 | fragments.add(Fragment.instantiate(this,SpanThree.class.getName())); 53 | 54 | // Creation de l'adapter qui s'occupera de l'affichage de la liste de 55 | // Fragments 56 | this.mPagerAdapter = new InitPagerAdapter(super.getSupportFragmentManager(), fragments); 57 | 58 | ViewPager pager = (ViewPager) super.findViewById(R.id.viewpager); 59 | // Affectation de l'adapter au ViewPager 60 | pager.setAdapter(this.mPagerAdapter); 61 | 62 | } 63 | else 64 | { 65 | handler.sendEmptyMessage(0); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Slide/SpanOne.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Slide; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentActivity; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import fr.anthonyfernandez.floatingmenu.R; 11 | 12 | public class SpanOne extends Fragment{ 13 | 14 | private FragmentActivity fa; 15 | 16 | @Override 17 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 18 | Bundle savedInstanceState) { 19 | fa = super.getActivity(); 20 | View one = inflater.inflate(R.layout.span_one, container, false); 21 | 22 | 23 | return one; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Slide/SpanThree.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Slide; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v4.app.FragmentActivity; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.view.View.OnClickListener; 11 | import android.widget.Button; 12 | import fr.anthonyfernandez.floatingmenu.R; 13 | import fr.anthonyfernandez.floatingmenu.Activities.Configurations; 14 | 15 | public class SpanThree extends Fragment{ 16 | 17 | private FragmentActivity fa; 18 | 19 | @Override 20 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 21 | Bundle savedInstanceState) { 22 | fa = super.getActivity(); 23 | View three = inflater.inflate(R.layout.span_three, container, false); 24 | 25 | Button validerInscription = (Button)three.findViewById(R.id.valider); 26 | validerInscription.setOnClickListener(new OnClickListener() { 27 | 28 | @Override 29 | public void onClick(View v) { 30 | Intent intent = new Intent(fa, Configurations.class); 31 | startActivity(intent); 32 | } 33 | }); 34 | 35 | return three; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /floatingMenu/src/main/java/fr/anthonyfernandez/floatingmenu/Slide/SpanTwo.java: -------------------------------------------------------------------------------- 1 | package fr.anthonyfernandez.floatingmenu.Slide; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentActivity; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import fr.anthonyfernandez.floatingmenu.R; 10 | 11 | public class SpanTwo extends Fragment{ 12 | 13 | private FragmentActivity fa; 14 | 15 | @Override 16 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 17 | Bundle savedInstanceState) { 18 | fa = super.getActivity(); 19 | View two = inflater.inflate(R.layout.span_two, container, false); 20 | 21 | 22 | return two; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-hdpi/span_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-hdpi/span_1.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-hdpi/span_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-hdpi/span_2.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-hdpi/span_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-hdpi/span_3.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-ldpi/span_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-ldpi/span_1.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-ldpi/span_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-ldpi/span_2.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-ldpi/span_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-ldpi/span_3.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-mdpi/span_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-mdpi/span_1.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-mdpi/span_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-mdpi/span_2.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-mdpi/span_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-mdpi/span_3.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/floating2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/floating2.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/floating3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/floating3.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/floating4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/floating4.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/floating5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/floating5.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/span_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/span_1.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/span_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/span_2.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xhdpi/span_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xhdpi/span_3.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/drawable-xxhdpi/github_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marshallino16/Demo-FloatingView/870f06675916952120667b71cb95f08127199020/floatingMenu/src/main/res/drawable-xxhdpi/github_logo.png -------------------------------------------------------------------------------- /floatingMenu/src/main/res/layout/activity_configurations.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 19 | 20 | 24 | 25 | 30 | 31 | 40 | 41 |