Material-Design-Toolbox
Material-Design-Toolbox copied to clipboard
Providing whatever Google left out for Material Design for Android
Material Design Toolbox
This library is still a work in progress.
The main purpose of this library is to provide components and helper methods in implementing Material Design concepts with little to no effort. This library in particular focuses on components that are not yet included in Google's support libraries, with most widgets adhering very closely to the guidelines Google has set. Links to already-existing components will be provided.
This library supports Android 4.1 (API 16) and up, however, not all components/methods will be supported pre-API 21.
To use, add Jitpack as a repository in your top-level build.gradle file:
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
Then add one (or all) of the following dependencies, depending on what you want specifically:
dependencies {
// For general utility methods/classes
compile 'com.github.nasahapps.Material-Design-Toolbox:base:{latest_version}'
// For helper methods pertaining to BottomSheets
compile 'com.github.nasahapps.Material-Design-Toolbox:bottomsheets:{latest_version}'
}
Note that all modules include the com.github.nasahapps.Material-Design-Toolbox:base module by default.
- Components
- Steppers
- Tabs
- Text Fields
- Toolbars
- Tooltips
Components
Steppers
This library provides two stepper layouts:
StepperProgressLayout: Displays step progress using plain text (e.g. Step 4 of 6), dots, or with a tinted ProgressBar. The StepperProgressLayout provides "Back" and "Next" buttons for going forwards/backwards between steps, with the "Next" button turning into a "Finish" button on the last step. Also, it is a ViewGroup, so any views you add to it will automatically be placed accordingly. (TODO: add pictures)
Custom attributes:
- stepperMaxProgress
- the max number of steps
- default value: 1
- stepperProgress
- the current step
- default value: 1
- stepperBackButtonText
- default value: "Back"
- stepperNextButtonText
- default value: "Next"
- stepperFinishButtonText
- the text to be displayed on the "Next" button when on the last step
- default value: "Finish"
- stepperProgressType
- the type of progress to be shown, one of TYPE_TEXT, TYPE_DOTS, or TYPE_BAR
- default value: TYPE_TEXT
- stepperProgressAccent
- the accent color to use for the dots/bar progress
- default value: R.attr.colorPrimary
HorizontalStepperLayout: Displays steps using Stepper views in either a horizontal or vertical fashion. Steppers have one of four states: COMPLETED, ACTIVE, INACTIVE, or ERROR.
Custom attributes:
- stepperLayoutMargin
- the margin between each Stepper
- default value: 56dp
Also provided is the Stepper widget that should be the only child view used in a HorizontalStepperLayout.
Custom attributes:
- stepperTitle
- stepperSubtitle
- stepperAccent
- the accent color to be used as the step number background
- default value: R.attr.colorPrimary
- stepperState
- the initial state of the stepper (
ACTIVE,INACTIVE,COMPLETED, orERROR) - default value:
ACTIVE
Tabs
The TabLayout widget is part of the design support library.
Text Fields
The TextInputLayout widget is part of the design support library. It is suggested to use a TextInputEditText instead of a regular EditText in this layout.
Toolbars
The Toolbar widget is part of the appcompat-v7 support library.
Tooltips
Tooltips (extends TextView) are similar to Toasts, both in appearance and in function. Creating a Tooltip is very similar to creating a Toast or Snackbar:
Tooltip.makeTooltip(context, "Tooltip text", Tooltip.LENGTH_SHORT, anchorView).show();
The arguments passed in are a Context, string text (or a string resource), a duration of how long you want the Tooltip to appear (LENGTH_SHORT or LENGTH_LONG), and a View to anchor the Tooltip on. By default, the Tooltip will appear below the anchor, unless the anchor is low enough on the screen, then the Tooltip will instead appear above the anchor.
License
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.