Last active
November 9, 2016 13:47
-
-
Save viktor1190/ff31932205c9c35fd34c8b7fd5ede7d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyAndroidFragment { | |
// ============================================================================================= | |
// CONSTANTS | |
// ============================================================================================= | |
public final String LOG_TAG = getClass().getSimpleName(); | |
private static final int WINDOW_TITLE = R.string.windows_label_mi_clase; | |
private static final String BUNDLE_KEY_SOME_INT = "bk_some_int"; | |
// ============================================================================================= | |
// ATTRIBUTES | |
// ============================================================================================= | |
// ============================================================================================= | |
// CONSTRUCTOR | |
// ============================================================================================= | |
/** | |
* Puts the fragment arguments into a bundle | |
*/ | |
public static void createArguments(Bundle bundle, int someInt) { | |
bundle.putInt(BUNDLE_KEY_SOME_INT, someInt); | |
} | |
/** | |
* Create new fragment instance with all the required arguments | |
*/ | |
public static MyAndroidFragment newInstance(int someInt) { | |
MyAndroidFragment myFragment = new MyAndroidFragment(); | |
Bundle args = createArguments(someInt); | |
myFragment.setArguments(args); | |
return myFragment; | |
} | |
/** | |
* Launch a new activity | |
*/ | |
public static void launch(int id) { | |
Intent intent = new Intent(context, MyActivity.class); | |
intent.putExtra(ARG_ID, id); | |
context.startActivity(intent); | |
} | |
/** | |
* initialization routine | |
*/ | |
public void init() { | |
} | |
// ============================================================================================= | |
// GETTERS & SETTERS | |
// ============================================================================================= | |
// ============================================================================================= | |
// COMPONENT LIFE CYCLE | |
// ============================================================================================= | |
// ============================================================================================= | |
// INHERITANCE @OVERRIDE | |
// ============================================================================================= | |
// ============================================================================================= | |
// EVENTS (EVENT BUS) | |
// ============================================================================================= | |
// ============================================================================================= | |
// METHODS | |
// ============================================================================================= | |
// ============================================================================================= | |
// PRIVATE METHODS | |
// ============================================================================================= | |
// ============================================================================================= | |
// INNER CLASS | |
// ============================================================================================= | |
// public class MyInnerClass { | |
//---------------------------------------------------------- | |
// INNER CONSTANTS | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER ATTRIBUTES | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER CONSTRUCTOR | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER GETTERS & SETTERS | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER CLASS INHERITANCE @OVERRIDE | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER METHODS | |
//---------------------------------------------------------- | |
//---------------------------------------------------------- | |
// INNER PRIVATE METHODS | |
//---------------------------------------------------------- | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment