All Projects → hzw1199 → FloatingView

hzw1199 / FloatingView

Licence: other
FloatingView moved by finger supporting OverlaySystem, OverlayActivity, OverlayViewGroup modes

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to FloatingView

System Alert Window Example
Example project showing use of SYSTEM_ALERT_WINDOW permission on Android 23+, with back button interception.
Stars: ✭ 39 (-32.76%)
Mutual labels:  touch, android-development, android-ui
android-custom-view
No description or website provided.
Stars: ✭ 15 (-74.14%)
Mutual labels:  android-development, android-ui
Android-daily-read-tips
log for articles and info in android for every developer
Stars: ✭ 13 (-77.59%)
Mutual labels:  android-development, android-ui
SuperToolbar
Android native Toolbar on steroids 💪
Stars: ✭ 52 (-10.34%)
Mutual labels:  android-development, android-ui
Image-Support
Add badge with counter to ImageView Android.
Stars: ✭ 128 (+120.69%)
Mutual labels:  android-development, android-ui
media-picker
Easy customizable picker for all your needs in Android application
Stars: ✭ 167 (+187.93%)
Mutual labels:  android-development, android-ui
Xama.JTPorts.ShowcaseView
Xamarin.Android Native showcase view.
Stars: ✭ 17 (-70.69%)
Mutual labels:  android-development, android-ui
Biometric-Authentication-Android
A sample implementation of AndroidX biometrics API using Kotlin. Authenticate using biometrics or PIN/Password if biometrics isn't available on device. Fully implemented in Jetpack compose using Material 3 dynamic theming and also has a separate implementation in xml with MDC 3.
Stars: ✭ 29 (-50%)
Mutual labels:  android-development, android-ui
PlantShopUI-Android
Check out the new style for App Design aims for the Online Plant Shop Service using jetpack compose...😉😀😁😎
Stars: ✭ 29 (-50%)
Mutual labels:  android-development, android-ui
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+113.79%)
Mutual labels:  android-development, android-ui
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (-31.03%)
Mutual labels:  android-development, android-ui
PaymentCardView
Custom Credit/Debit card view
Stars: ✭ 62 (+6.9%)
Mutual labels:  android-development, android-ui
FancyBottomSheetDialog
This is android library implementing bottom sheet like fancy dialog
Stars: ✭ 21 (-63.79%)
Mutual labels:  android-development, android-ui
RxLoading
RxJava library for showing a loading (i.e. progress bar) state while waiting for async data with minimal effort and advanced options.
Stars: ✭ 49 (-15.52%)
Mutual labels:  android-development, android-ui
Einsen
🎯 Einsen is a prioritization app that uses Eisenhower matrix technique as workflow to prioritize a list of tasks & built to Demonstrate use of Jetpack Compose with Modern Android Architecture Components & MVVM Architecture.
Stars: ✭ 821 (+1315.52%)
Mutual labels:  android-development, android-ui
Login-SignupUI-FirebasePhoneauth
New Repo
Stars: ✭ 43 (-25.86%)
Mutual labels:  android-development, android-ui
Reside-Menu
By applying viewpager animation you can also make AMAZING Reside Menu's
Stars: ✭ 72 (+24.14%)
Mutual labels:  android-development, android-ui
Material-Backdrop-Android
Material Backdrop
Stars: ✭ 106 (+82.76%)
Mutual labels:  android-development, android-ui
floating-layout-android
Floating Layout library for Android
Stars: ✭ 55 (-5.17%)
Mutual labels:  android-development, android-ui
svg2vector
Online batch converter of SVG images to Android vector drawable XML resource files
Stars: ✭ 39 (-32.76%)
Mutual labels:  android-development, android-ui

FloatingView

Platform API License

中文看这里

Features

  • Support three modes: OverlaySystemOverlayActivity and OverlayViewGroup
  • OverlaySystem: Display FloatingView above other apps
  • OverlayActivity: Display FloatingView above certain Activity
  • OverlayViewGroup: Display FloatingView above certain ViewGroup
  • Move FloatingView with finger
  • Define 9 initial position for FloatingView
  • Define initial paddings for FloatingView

Usage

Step 1

Add it in your build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Add the dependency in the form:

dependencies {
    compile 'com.github.hzw1199:FloatingView:1.0.0'
}

Step 2

Configure and display

  • OverlaySystem mode

onCreate:

FloatingViewConfig config = new FloatingViewConfig.Builder()
        .setPaddingLeft(paddingLeft)
        .setPaddingTop(paddingTop)
        .setPaddingRight(paddingRight)
        .setPaddingBottom(paddingBottom)
        .setGravity(gravity)
        .build();
floatingView = new FloatingView(OverlaySystemActivity.this, R.layout.view_floating, config);
floatingView.showOverlaySystem();

onDestroy:

if (floatingView != null) {
    floatingView.hide();
}
  • OverlayActivity mode

onAttachedToWindow:

FloatingViewConfig config = new FloatingViewConfig.Builder()
        .setPaddingLeft(paddingLeft)
        .setPaddingTop(paddingTop)
        .setPaddingRight(paddingRight)
        .setPaddingBottom(paddingBottom)
        .setGravity(gravity)
        .build();
floatingView = new FloatingView(OverlaySystemActivity.this, R.layout.view_floating, config);
floatingView.showOverlayActivity();

onDetachedFromWindow:

if (floatingView != null) {
    floatingView.hide();
}
  • OverlayViewGroup mode

onCreate:

lyViewGroup.post(new Runnable() {
    @Override
    public void run() {
		FloatingViewConfig config = new FloatingViewConfig.Builder()
		        .setPaddingLeft(paddingLeft)
		        .setPaddingTop(paddingTop)
		        .setPaddingRight(paddingRight)
		        .setPaddingBottom(paddingBottom)
		        .setGravity(gravity)
		        .setDisplayWidth(lyViewGroup.getWidth())
		        .setDisplayHeight(lyViewGroup.getHeight())
		        .build();
		floatingView = new FloatingView(OverlaySystemActivity.this, R.layout.view_floating, config);
		floatingView.showOverlayViewGroup(lyViewGroup);
    }
});

onDestroy:

if (floatingView != null) {
    floatingView.hide();
}

lyViewGroup is the ViewGroup to display FloatingView above

Step 3

Click event

floatingView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        
    }
});

Hold the Floating View object, to change the content logically

demo

LayoutInflater mInflater = LayoutInflater.from(AdvancedControlActivity.this);
View floatingView = mInflater.inflate(R.layout.view_advanced_control, null, false);
floatingView = new FloatingView(AdvancedControlActivity.this, floatingView, config);

Set OnClickListener for subviews of Floating View

demo

LayoutInflater mInflater = LayoutInflater.from(AdvancedControlActivity.this);
View floatingView = mInflater.inflate(R.layout.view_advanced_control, null, false);
floatingView = new FloatingView(AdvancedControlActivity.this, floatingView, config);

final View vTop = floatingView.findViewById(R.id.v_top);
final View vMiddle = floatingView.findViewById(R.id.v_middle);
final View vBottom = floatingView.findViewById(R.id.v_bottom);
final TextView tvTime = floatingView.findViewById(R.id.tv_time);


View.OnClickListener onClickListener = new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (v == vTop) {
            Toast.makeText(AdvancedControlActivity.this, "Top clicked", Toast.LENGTH_SHORT).show();
        } else if (v == vMiddle) {
            Toast.makeText(AdvancedControlActivity.this, "Middle clicked", Toast.LENGTH_SHORT).show();
        } else if (v == vBottom) {
            Toast.makeText(AdvancedControlActivity.this, "Bottom clicked", Toast.LENGTH_SHORT).show();
        }
        tvTime.setText(String.valueOf(System.currentTimeMillis()));
    }
};

vTop.setOnClickListener(onClickListener);
vMiddle.setOnClickListener(onClickListener);
vBottom.setOnClickListener(onClickListener);

Proguard

No need to add more proguard rules, consumerProguardFiles has already handled library proguard rules.

Tip

  • Please check the demo before use.
  • If this project helps you, please star me.

About Me

License

The MIT License (MIT)

Copyright (c) 2019 FloatingView

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].