Fresh Air - Android


Source link: https://github.com/Raizlabs/FreshAir-Android

Fresh Air - Android

Fresh Air is an application update library. It is designed to check a remote location for application updates and if updates are available, it prompts the user to upgrade the application. When the new version of the application is started, a dialog can be presented that showcases the new features to the user.

Basic Setup

Fresh Air can be set up with just a few simple steps. A working example can also be found in the sample module of this project.

Including In Your Project

Fresh Air is available on our Bintray Maven repository and can be included in your project with the following changes.

  1. Include our repository in your root project build.gradle:
allprojects {

repositories {

 jcenter()

 maven {
 url "https://dl.bintray.com/raizlabs/Libraries" 
}

}
 
}
  1. Include the dependency in your module's build.gradle:
dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'

...

compile 'com.raizlabs:FreshAir:0.1.0' 
}
  1. Initialize the library before use, typically in your Application class:
public class SampleApplication extends Application {

 @Override
public void onCreate() {

 super.onCreate();

  FreshAir.initialize(this);

 ...

}
 
}

Update Checks

Fresh Air can check for new versions of your application using a remotely hosted JSON file. Just call the following method from the onCreate() of your Application, your first Activity, or any other place you would like to check for updates. Note that this process is asynchronous.

public class SampleApplication extends Application {

@Override  public void onCreate() {

super.onCreate();

 FreshAir.initialize(this);

FreshAir.checkForUpdates("https://raw.githubusercontent.com/Raizlabs/FreshAir-Android/develop/Schema/release_notes.json");

...  
}
 
}

See Schema/release_notes.json in this repo for an example of the JSON schema

Release Notes

Fresh Air can present a dialog of release notes to showcase the features that you have added in new versions of your application. This dialog will include a scrollable view of features which each contain an image, title, and description. These will be shown once per version, but not again.

  1. Define the release information that you wish to display. This doesn't display the information, but lets Fresh Air know what you will want to display when the time comes. Typically, you want to put this information in your Application.onCreate() after initializing the library. The release notes follow a Builder pattern which takes a set of Features, which are also constructed through a Builder pattern:
public class SampleApplication extends Application {

 @Override
public void onCreate() {

 super.onCreate();

  FreshAir.initialize(this);

 FreshAir.setReleaseNotes(new ReleaseNotes.Builder()

.addFeature(

  new FeatureInfo.Builder()

 .setImageResource(R.mipmap.ic_launcher)

 .setTitleResource(R.string.Feature1_Title)

 .setDescriptionResource(R.string.Feature1_Description)

)

.addFeature(

  new FeatureInfo.Builder()

 .setImageResource(R.drawable.feature2)

 .setTitleResource(R.string.Feature2_Title)

 .setDescriptionResource(R.string.Feature2_Description)

)

.addFeature(

  new FeatureInfo.Builder()

 .setImageResource(R.drawable.feature3)

 .setTitleResource(R.string.Feature3_Title)

 .setDescriptionResource(R.string.Feature3_Description)

)

// Sometimes handy for minor updates: see docs

.setVersionCode(1));

}
 
}
  1. When you would like to display the release notes dialog, call the following method. This requires a FragmentActivity from the support library. Typically you want to do this from your main launcher Activity or any other entry point to your application:
public class MainActivity extends FragmentActivity {

 @Override
protected void onCreate(Bundle savedInstanceState) {

 super.onCreate(savedInstanceState);

  ...

  FreshAir.showReleaseNotes(this);

}
 
}

Extras

Additional flexibility is available. Consult the JavaDoc for more details, but some of the higher level functionality is listed below.

  • Update Prompts - You can change the text contents of the update prompt via FreshAir.setUpdatePrompt(UpdatePromptInfo). UpdatePromptInfo contains a Builder class for easy overriding.
  • Clear History - You can clear the previously shown updates, forced updates, and release notes via FreshAir.clearFUpdatePromptVersion(), FreshAir.clearForcedUpdateVersion(), and FreshAir.clearReleaseNotesVersion
  • App Disabling - You can manually block out the app via FreshAir.disableApp(). To unset this, you must call FreshAir.clearAppDisabled() and restart the app.
  • Logging - You can alter the level of logging via FreshAir.setLogLevel(int) to clear logging or add more logging for debugging. By default, only warnings and errors are displayed.

Resources

This library is an enhancement to the TextView component that allows you to style various spans of text inside the view.

Parrot is a gradle plugin that allows your app to speak multiple languages, without the hassle of working with multiple resources, using the translation editor or ordering an expensive translation from AS/IDEA

It leverages the Google Translate API in order to translate your string resources into all the languages specified in the configuration.

FAB to Toolbar Button library for Android Material Collapsing Toolbar.

ReDex is an Android bytecode (dex) optimizer originally developed at Facebook. It provides a framework for reading, writing, and analyzing .dex files, and a set of optimization passes that use this framework to improve the bytecode. An APK optimized by ReDex should be smaller and faster than its source.

FoldingCell is an expanding content cell inspired by folding paper material.

Translucent draw a transparent text into a Textview.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes