net.hockeyapp.android
Class UpdateFragment

java.lang.Object
  extended by DialogFragment
      extended by net.hockeyapp.android.UpdateFragment
All Implemented Interfaces:
UpdateInfoListener

public class UpdateFragment
extends DialogFragment
implements UpdateInfoListener

Description

Fragment to show update information and start the download process if the user taps the corresponding button.

License

 Copyright (c) 2012 Codenauts UG
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
 files (the "Software"), to deal in the Software without
 restriction, including without limitation the rights to use,
 copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following
 conditions:
 
 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 

Author:
Thomas Dohmke

Constructor Summary
UpdateFragment()
           
 
Method Summary
 java.lang.String getAppName()
          Returns the app's name.
 int getCurrentVersionCode()
          Returns the current version of the app.
 View getLayoutView()
          Creates and returns a new instance of UpdateView.
static UpdateFragment newInstance(JSONArray versionInfo, java.lang.String urlString)
          Creates a new instance of the fragment.
 void onClick(View view)
          Called when the download button is tapped.
 void onCreate(Bundle savedInstanceState)
          Called when the fragment is starting.
 View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
          Creates the root view of the fragement, set title, the version number and the listener for the download button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateFragment

public UpdateFragment()
Method Detail

newInstance

public static UpdateFragment newInstance(JSONArray versionInfo,
                                         java.lang.String urlString)
Creates a new instance of the fragment.

Parameters:
versionInfo - JSON array with a JSON object for each version.
urlString - HockeyApp URL as a string.
Returns:
Instance of Fragment

onCreate

public void onCreate(Bundle savedInstanceState)
Called when the fragment is starting. Sets the instance arguments and the style of the fragment.

Parameters:
savedInstanceState - Data it most recently supplied in onSaveInstanceState(Bundle)

onCreateView

public View onCreateView(LayoutInflater inflater,
                         ViewGroup container,
                         Bundle savedInstanceState)
Creates the root view of the fragement, set title, the version number and the listener for the download button.

Returns:
The fragment's root view.

onClick

public void onClick(View view)
Called when the download button is tapped. Starts the download task and disables the button to avoid multiple taps.


getCurrentVersionCode

public int getCurrentVersionCode()
Returns the current version of the app.

Specified by:
getCurrentVersionCode in interface UpdateInfoListener
Returns:
The version code as integer.

getAppName

public java.lang.String getAppName()
Returns the app's name.

Returns:
The app's name as a String.

getLayoutView

public View getLayoutView()
Creates and returns a new instance of UpdateView.

Returns:
Instance of UpdateView