Open In App

How to Use FlycoSystemBar Library in Android App?

FlycoSystemBar can be used in the same way that any other Java library would. Please add the jar files to your classpath. You can also use any IDE to run and debug the FlycoSystemBar component, just like you would any other Java program. Use a build tool that supports dependency management, such as Maven or Gradle, as best practice. Please visit maven.apache.org for Maven installation instructions. Please visit gradle.org for Gradle installation instructions. Below is a quick overview of the FlycoSystemBar functionality and assist you in determining whether it meets your needs.

How to use it in an app

Just add it through the manifest file, and you are good to go:






<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" \
          android:versionCode="1" android:versionName="1.0"
          package="com.gfg.systembardemo" platformBuildVersionCode="23"
          platformBuildVersionName="6.0-2704002">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="23" />
    <application android:theme="resourceId:0x7f09008e" android:label="GfgSystemBar"
                 android:icon="res/mipmap-xxxhdpi-v4/ic_launcher.png"
                 android:debuggable="true" android:allowBackup="true"
                 android:supportsRtl="true">
        <activity android:theme="resourceId:0x7f090037" android:label="GfgSystemBar"
                  android:name="com.gfg.systembardemo.ui.GeeksHome.GeeksHomeActivity"
                  android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:theme="resourceId:0x7f090037" android:name="com.gfg.systembardemo.ui.SpandanSaxenatint.SpandanSaxenaBarTintActivity" android:screenOrientation="portrait" />
        <activity android:theme="resourceId:0x7f090037" android:name="com.gfg.systembardemo.ui.SpandanSaxenaimmersive.SpandanSaxenaBarImmersive1Activity" android:screenOrientation="portrait" />
        <activity android:theme="resourceId:0x7f090037" android:name="com.gfg.systembardemo.ui.SpandanSaxenaimmersive.SpandanSaxenaBarImmersive2Activity" android:screenOrientation="portrait" />
        <activity android:theme="resourceId:0x7f090037" android:name="com.gfg.systembardemo.ui.SpandanSaxenaimmersive.SpandanSaxenaBarImmersive3Activity" android:screenOrientation="portrait" />
        <activity android:theme="resourceId:0x7f090037" android:name="com.gfg.systembardemo.ui.SpandanSaxenadarkmode.SpandanSaxenaBarDarkModeActivity" android:screenOrientation="portrait" />
    </application>
</manifest>

Then add it to gradle using this:

dependencies{
    implementation 'com.android.support:support-v4:23.4.0'
    implementation "com.flyco.systembar:FlycoSystemBar_Lib:1.0.0@aar"
}

Let’s dive deep and build the app:



The Build.gradle file:

Starting with the gradle file here is the code for it:
    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
    compile "com.android.support:design:$rootProject.ext.supportLibraryVersion"
    compile "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
    compile "com.jakewharton:butterknife:$rootProject.ext.butterknife"
    compile "de.hdodenhof:circleimageview:$rootProject.ext.circleimageview"
    // compile project(':FlycoSystemBar_Lib')
    compile "com.flyco.systembar:FlycoSystemBar_Lib:1.0.1@aar"
}

After this, just sync the files. Then create the geeks_pager.java file in which we would provide the working of the flyco bar like:




public enum DemoPager implements Serializable {
    STATUSBAR_TINT("GeeksforGeeks", StatusBarTintActivity.class),
    STATUSBAR_IMMERSIVE_1("Android", StatusBarImmersive1Activity.class),
    STATUSBAR_IMMERSIVE_2("Article", StatusBarImmersive2Activity.class),
    STATUSBAR_IMMERSIVE_3("Spandan Saxena", StatusBarImmersive3Activity.class),
    STATUSBAR_DARKMODE("Switch the dark mode", StatusBarDarkModeActivity.class),;
 
    public String mItem;
    public Class<? extends AppCompatActivity> mClazz;
 
    DemoPager(String item, Class<? extends AppCompatActivity> clazz) {
        mItem = item;
        mClazz = clazz;
    }
}

Note: There are no changes to the manifest file, it remains like the default hence we are not mentioning it over her for ease to understand.

Output:

 

Find the Full Project Over Here.


Article Tags :