EzDevInfo.com

fab

a modular async web framework for node.js Fabjs.org | Finance Updates

How to add Floating Action button with appcompact

i recently updated by android sdk to new android 5.0
and was trying to add Floating action button (FAB) using appcompact..

i dont want to use any type of external libraries

How can i add FAB button to by project with appcompact


Source: (StackOverflow)

Javascript FAB framework on Node.js

I've seen a slide that presented Fab, a node.js framework.

Fab slide

Is this JavaScript?

Could someone explain what is going on in that code?

I'm all lost.


Source: (StackOverflow)

Advertisements

Android Design Support Library Fab menu

Now that the Android Design Support Library is out, does anyone knows how to implement expanded Fab menu with it, like the fab on Inbox App?

Should look like this:

enter image description here


Source: (StackOverflow)

Launch Fab File inside a python script

I have a fab script, it works fine. To start it, I execute:

fab -H 192.168.xx.xx deployFiles deployConfiguration:'master',7

deployFiles and deployConfiguration are both functions in my fabfile.py. 'master' and 7 are my parameters for deployConfiguration

I have another Python script and I want to launch, the previous fab command inside him.

How can I execute, my fabfile with these parameters from a Python script?


Source: (StackOverflow)

Android - Vertically center button at the bottom of a toolbar (like Google Calendar)

I'm trying to recreate something like the Google Calendar event screen with it's edit FAB (see the screenshot below), but I'm not sure how to approach it.

I'm using this library for my FAB


Source: (StackOverflow)

Javascript, function chaining and events?

Digging into NodeJS I've come across (fab) which really impressed me. After watching Jed's presentation I understand how function chaining works but I'm left with one question: In case of a situation where an event can (but doesn't have to) occur such as in case of an HTTP listener, how does function chaining work?

For example, if I had the following pattern:

(listen, 8080)
    (write)
        ('test1')
        ('test2')
    ()
()

How would I write the listen function that it in case of an HTTP request the strings 'test1' and 'test2' get written to the client?


Source: (StackOverflow)

Alpha background on FAB clicked

I'm using the library https://github.com/futuresimple/android-floating-action-button to create the fab buttons that works pretty well. I tried several libraries but none use the effect used in most application with a fab (or Google apps like keep, inbox) that when the fab is clicked the background of entire application becames semi-transparent white or black, it depends. I can't find any way to do it. Is it possible have an example or something like that to do this kind of effect? You can see what i mean in this image: enter image description here

The semi-black background

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/semi_white_bg"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white_semi_transparent"
        android:visibility="gone" >
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/listFrame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/content_frame"
        android:visibility="gone" >

        <TextView
            android:id="@+id/status"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/cabinet_color"
            android:fontFamily="sans-serif"
            android:gravity="center_vertical"
            android:paddingBottom="8dp"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:paddingTop="8dp"
            android:textColor="#fff"
            android:textSize="17sp"
            android:visibility="gone" />

        <android.support.v7.widget.RecyclerView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/status"
            android:clipToPadding="false"
            android:scrollbars="vertical" />

        <LinearLayout
            android:id="@android:id/empty"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:orientation="vertical" >

            <ImageView
                android:id="@+id/emptyImage"
                android:layout_width="96dp"
                android:layout_height="96dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="16dp"
                android:scaleType="fitXY"
                android:src="?empty_image" />

            <TextView
                android:id="@+id/emptyText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:fontFamily="sans-serif-light"
                android:gravity="center"
                android:lineSpacingMultiplier="1.4"
                android:paddingBottom="16dp"
                android:text="@string/no_files"
                android:textColor="?empty_text"
                android:textSize="22sp" />
        </LinearLayout>
    </RelativeLayout>

    <ProgressBar
        android:id="@android:id/progress"
        style="?android:progressBarStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:indeterminateOnly="true" />

</RelativeLayout>

this is my layout.xml but seems not working at all as i want.Seems that not overlap the entire view but just colors what it wants..


Source: (StackOverflow)

FAB on pre-lollipop devices with the new support lib

The support library doc states that the version 22.2 supports FloatingActionButton on Pre-Lollipop devices.

I have implemented a demo app to show a FAB on KitKat. The FAB is shown but I still can't set the elevation neither in the xml nor in the code. In the xml I get the warning and I need to use tools:ignore="NewApi". If I call setElevation programmatically I get an exception because the method does not exist.

I have added this to my layout

<android.support.design.widget.FloatingActionButton
    android:id="@+id/add_button"
    style="@style/FAB"
    android:src="@drawable/ic_add_white_24dp"
    android:contentDescription="@string/add_ringtone" />

where the style is defined like this:

<resources
    xmlns:tools="http://schemas.android.com/tools">
    <style name="FAB" tools:ignore="NewApi">
       <item name="android:layout_width">@dimen/fab_width</item>
       <item name="android:layout_height">@dimen/fab_height</item>
       <item name="android:background">@drawable/fab_background</item>
       <item name="android:layout_alignParentBottom">true</item>
       <item name="android:layout_alignParentRight">true</item>
       <item name="android:layout_marginBottom">@dimen/fab_margin</item>
       <item name="android:layout_marginRight">@dimen/fab_margin</item>
       <item name="android:elevation" >@dimen/fab_elevation</item>
       <item name="android:stateListAnimator">@anim/rise</item>

    </style>

</resources>

What should I do to set the elevation on KitKat with the new support library?


Source: (StackOverflow)

Outer Recyclerview not receiving scroll events of inner Recyclerview

I followed this tutorial to implement the behaviors for both hiding the toolbar and the FAB when scrolled: https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/

I have pasted a demo of what the behavior looks like below.

scrolling with fab

Now instead of those individual items within the recyclerview in the tabs holding just a textView, I have coded it so that they hold a picture (ImageView) and below it, a recyclerview showing a list of items.

Hence, there is an outer recyclerview that contains a list of inner recyclerviews.

The inner recyclerview does not scroll - I disabled it by following the answer in this thread by overriding the method canScrollVertically(): Disable Scrolling in child Recyclerview android. I also tried enabling the scrolling for the inner recyclerview, but I experienced the same problem.

The outer recyclerview does scroll and has the behavior that shows/hides the toolbar and the FAB.

When I scroll by holding onto the picture (ImageView), the app behavior works perfectly fine, showing and hiding the toolbar and FAB. However, when I have my finger on the inner recyclerview to scroll, the outer recyclerview scrolls and the list moves up and down, but the behavior of show/hiding the toolbar and FAB is never activated.

I have a feeling that this is because the inner recyclerview had intercepted the scroll and the outer recyclerview did not get the scroll event to activate the behavior.

Does anyone know how to make sure the outer recyclerview also gets the scroll event so that the behavior works?


Source: (StackOverflow)

Floating Action Button Being a square

When I set a color to my fab, it being like the image below...

enter image description here

My layout xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_add"
    android:layout_marginRight="20dp"
    app:fabSize="normal"
    android:elevation="@dimen/fab_elevation"
    android:background="#000000"
    android:stateListAnimator="@animator/fab_anim"
    android:layout_gravity="center_horizontal"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true" />

Also the color doesn't change. Can anyone help me in understanding what I am doing wrong?

I also tried with a @color link but it crashed, with the background of a drawable (ex. android:background="@drawable/fab_background") nothing happens.

Here is the drawable fab_background.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item>
    <ripple android:color="@color/fab_color_1_muted">
        <item>
            <shape>
                <solid android:color="@color/fab_color_1" />
            </shape>
        </item>
    </ripple>
</item>


Source: (StackOverflow)

Android Floating Action Button Opens Small View

In the Android App of Inbox by Google, when you press the FAB (Floating Action Button), a smaller view with options pop up. How would i go about implementing this?

floating action button with sub-menu

[Picture taken on the web version for ease, but the effect and look is the same on the app.]


Source: (StackOverflow)

python fabric with dynamic hosts/servers

We have our deployment script with fabric, and it has a list of hosts:

 env.hosts = ['services', 'w1zA', 'w1zB']

but we have 2 more servers that are on and off when there is more pressure.

So I want my hosts variable to be:

 env.hosts = ['services', 'w1zA', 'w1zB', 'w2zA', 'w2zB']

but now when I run the script when the extra servers are off, the deployment fails because it can't connect to those servers.

How can I skip failures if server is off?


Source: (StackOverflow)

Menu and Autohide FloatingActionButton of Android Design Support Library

I'm using Android Design Support Library and I want a FloatingActionButton that have AutoHide by Scrolling,

my Layout is:

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/LargeText" />
    </ScrollView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_anchorGravity="bottom|right|end"
        app:layout_anchor="@id/scrollView"
        android:src="@drawable/abc_btn_rating_star_off_mtrl_alpha" />

</android.support.design.widget.CoordinatorLayout>

FloatingActionButton always showing when scrolling text, i want to autohide it when scrolling text.

And, I want to have a FloatingActionButton Menu by clicking on FloatingActionButton, like this:

enter image description here


Source: (StackOverflow)

Android: material design's Floating Action Button (FAB) and shifting views

I would like to implement two Material Design elements in Android:

  • the Floating Action Button (FAB)

  • "shifting views" (not sure if this is the proper term)

I cannot find any Android widget to implement FABs. Which is the best recommended solution? is it to use third party libraries?

With "shifting view", I mean a view that shifts up and down. For example if you have two views in a fragment: top view which is fixed, and the bottom view which is a list, by scrolling the list, you can actually make the list take some space of the top view. How do you implement that? is it part of the Android framework or you need to use some third party libraries again?


Source: (StackOverflow)

Why is my Python script writing Windows style carriage returns?

Good Day,

I am trying to write a script that creates a fabfile, saves it and then runs it. Here is my code so far:

#!/usr/bin/python

bakery_internalip = "10.10.15.203"

print "[....] Preparing commands to run within fabfile.py"

fabfile = open("sfab.py", "w")
fabfile.write("from fabric.api import run, sudo, task\n\n@task\ndef myinstall():\n\tsudo('yum install httpd')")
fabfile.close

print "Running Fab Commands"

import subprocess
subprocess.call(['fab', '-f', 'sfab.py', '-u ec2-user', '-i', 'id_rsa', '-H', bakery_internalip, 'myinstall'])

The contents of my fabfile are as follows:

[root@ip-10-10-20-82 bakery]# cat sfab.py
from fabric.api import run, sudo, task

@task
def myinstall():
        sudo('yum install httpd')

My script gives the following error when I run it:

Fatal error: Fabfile didn't contain any commands!

However, if I run dos2unix on the file and then run the following, it works fine:

 fab -f sfab.py -H localhost myinstall

Source: (StackOverflow)