SupportFragment


Source link: https://github.com/JustKiddingBaby/SupportFragment

SupportFragment

??

????Fragment??????Fragment??????????????????Fragment?Activity???????Fragment???????????????? ???????Activity+?Fragment???Activity+?Fragment???

????

  • ??????Fragment????
  • ?Fragment????????
  • ?Fragment??OnBackPressed()????
  • ??Fragment?Activity???????????????????
  • ???“????”????????????

Demo??

Demo???????App?????????Activity+?Fragment???MVP+MVVM?????ARouter?????????????EventBus??????????? ??????demo???wiki?

????

?? supportfragment
????

??

Maven??

<dependency>
<groupId>com.justkiddingbaby</groupId>
<artifactId>supportfragment</artifactId>
<version>????</version>
<type>pom</type> </dependency>

JCenter??

??? ???build.gradle???

repositories {

  jcenter() 
}

??? ?module?build.gradle???

compile 'com.justkiddingbaby:supportfragment:????'

??

?Activity????

Activity???? SupportActivity???int getFragmentContentId()??? ?????startFragment(SupportFragment)???????????????Activity???????

TestAvtivity.java
public class TestActivity extends SupportActivity {

@Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

  
}

@Override
  public int getFragmentContentId() {

return R.id.main_content;
  
}
 
}
main_content.xml
<?xml version="1.0" encoding="utf-8"?> <FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/mainFrameContent"
  android:layout_width="match_parent"
  android:layout_height="match_parent"/>

?Fragment????

Fragment???? SupportFragment????????????Fragment???????

TestFragment.java
public class TestFragment extends SupportFragment {
  
}

Fragment?????????Fragment????????????SupportFragment

????

??? ?? ?? ??
int getFragmentContentId() ??Fragment????id??startFragment()??????? Activity
void startFragment(SupportFragment) ??getFragmentContentId()????????????Fragment Activity/Fragment
void startFragmentForResult(SupportFragment,int) ?startFragment?????????? Activity/Fragment
void startFragmentForResult(SupportFragment,int,Bundle) ?startFragment?????????? Activity/Fragment
void setFragmentResult(int,Bundle) ??Fragment???? Activity/Fragment
void onFragmentResult(int,int,Bundle) Fragment??????? Activity/Fragment
void showFragment(SupportFragment,int) ?int????Fragment?????contentId????Fragment???Fragment???? Activity/Fragment
void hideFragment(SupportFragment,int) ??Fragment??????Fragment???? Activity/Fragment
void replaceFragment(SupportFragment,int) ??int???Fragment??????Fragment???Fragment???? Activity/Fragment
void showPopFragment() ?????Fragment Activity/Fragment
void closeCurrentAndShowPopFragment() ????Fragment?????Fragment Activity/Fragment
void clearFragment() ??????Fragment Activity/Fragment
void close() ????Fragment??Activity Activity/Fragment
void closeFragment(SupportFragment) ????Fragment Activity/Fragment
String getFragmentTAG() ??Fragment?TAG????????????????????????TAG???????? Fragment
boolean isContainChildFragment() ????Activity/Fragment????Fragment Activity/Fragment
SupportFragment getPopSupportFragment() ?????SupportFragment,????null Activity/Fragment
boolean isHideLashFragmentBeforeFinish() Activity?finish??????????Fragment,???false Activity

?????????Activity??????Fragment????????????????????????????????? ?????Fragment?????????Fragment????????

????

v1.1.15(2017/8/5)

1???Fragment??onBackPressed()???,???Fragment? isHideLashFragmentBeforeFinish()???false??????

v1.1.13(2017/8/16)

1??? isContainChildFragment()???
2??? SupportFragment?onKeyDown?????
3??? getPopSupportFragment()???
4??? isHideLashFragmentBeforeFinish()???

v1.1.7(2017/8/15)

1??SupportActivity/SupportFragment?? isSupportResumed()????,????Activity????Resume???

v1.1.6(2017/8/10)

1??Fragment?? onKeyDown(int keyCode, KeyEvent event)??????

v1.1.5(2017/6/29)

1?????supportFragment???allowBackup?????

v1.1.4(2017/5/19)

1?????????SDK???12

v1.1.3(2017/5/19)

1??????????????????
2?????v7??????SDK???

v1.1.2(2017/5/17)

1???Fragment???????Bundle??????

v1.1.1(2017/5/15)

1?????startFragmentForResult??????onFragmentResult?requestCode???????

v1.1.0(2017/5/15)

1???hideFragment(SupportFragment)???
2???startFragmentForResult?????????startActivityForResult?

v1.0.2(2017/5/8)

1???Support???????????????SupportTransaction????????

v1.0.1(2017/5/4)

1???Support????showFragment?????added??Fragment??showFragment??????

v1.0(2017/5/3)

1?SupportFragment?????????Fragment???
2?????????Demo????App?

Resources

A woooow splash which like clouds disappear in the sky.

PermissionAcceptor allows to handle runtime permission in Marshmallow (Android 6.0).

Simple builder in plain Java to create requests to the Amazon Product Advertising API.

Amazon challenges all developers that want to use their Advertising API. Especially the creation of the request URL is pretty complex. Therefor I've created this URL Builder, which allows you to create the request URL without having to read the Product Advertisement API documentation or study the used hashing algorithms.

AuthManager is a library which eliminates the boilerplate of Google SignIn and SmartLock integration.

This is a simple customisation of the TextInputLayout found in the Design Support Library.

A square animated loader.

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