Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.
/ UsefulViews Public archive

Some useful widgets for Android such as a floating label Spinner (LabelledSpinner) and a flippable card (FlippableView).

License

Notifications You must be signed in to change notification settings

farbodsz/UsefulViews

Repository files navigation

UsefulViews

Build Status

Some useful widgets to use in Android development.

This project initially started from LabelledSpinner (a Spinner component with a floating label for Android). For reference you can see this question on Stack Overflow, and another similar question.

Gradle (Android Studio)

You can add this Android library to your Gradle dependencies.

To do so, add the following to your app module's build.gradle file:

dependencies {
    ...
    compile 'com.satsuware.lib:usefulviews:2.3.6'
}

Usage

LabelledSpinner

Below is a basic example of how LabelledSpinner can be used. There is also a sample app you can view on this repository, showcasing LabelledSpinner's features in more detail.

XML layout file:

xmlns:ls="http://schemas.android.com/apk/res-auto"

...

<com.satsuware.usefulviews.LabelledSpinner
        android:id="@+id/your_labelled_spinner"
        ls:labelText="@string/your_spinner_label"
        ls:widgetColor="#F44336"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

And then in Java code...

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.example_usage);
    ...
    LabelledSpinner yourSpinner = (LabelledSpinner) findViewById(R.id.your_labelled_spinner);
    yourSpinner.setItemsArray(R.array.your_array);
    yourSpinner.setOnItemChosenListener(this);
}

@Override
public void onItemChosen(View labelledSpinner, AdapterView<?> adapterView, View itemView, int position, long id) {
    switch (labelledSpinner.getId()) {
        case R.id.your_labelled_spinner:
            // Do something here
            break;
        // If you have multiple LabelledSpinners, you can add more cases here
    }
}

@Override
public void onNothingChosen(View labelledSpinner, AdapterView<?> adapterView) {
    // Do something here
}

Documentation

Javadocs are available, but documentation on a website will be added soon.

Changelog

A changelog of this repository can be found here, but see this page for a list of releases and tags (also with a changelog).

Copyright

Copyright 2015-2016 Farbod Salamat-Zadeh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Some useful widgets for Android such as a floating label Spinner (LabelledSpinner) and a flippable card (FlippableView).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages