This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
Releases: mddanishansari/Phlex
Releases · mddanishansari/Phlex
Phlex v0.0.2
New methods in v0.0.2
isPreLollipop()
- Returns
true
if device is pre-lollipop - Tip: Useful for backward compatibility
isLollipopPlus()
- Returns
true
if device is lollipop or lollipop plus - Tip: Useful for backward compatibility
dp2px(int dp)
- Returns
px
value of the provideddp
- You can also use
float
px2dp(int px)
- Returns
dp
value of the providedpx
- You can also use
float
isAppInstalled(Context context, String appPackageName)
- Returns
true
orfalse
Phlex v0.0.1
Methods available in v0.0.1
isFirstRun(SharedPreferences sharedPreferences)
- Returns
true
orfalse
isFirstRun(Context context)
- Returns
true
orfalse
- Uses apps default SharedPreferences file
isDataAvailable(Context context)
- Returns
true
orfalse
isEmailIdValid(String emailId)
- Returns
true
orfalse
isAppVersionUpdated(Context context)
- Returns
true
ifversionCode
of build.gradle is incremented - By default returns true on first run.
isAppVersionUpdated(Context context, SharedPreferences sharedPreferences)
- Same as above method it just uses SharedPreferences file provided by user
getScreenWidth()
orgetScreenWidth()
- Returns integer value
getXPercentOfY(int X, int Y)
- You can also use float, long or double
- Returns value depending on datatype used
getThisFromAssets(Context context, String fileName)
- Returns contents of files as a
String
- Provide file name with extension like
sample.json
- Tip: Use with text files like *.txt, *.json etc
switchfragment(AppCompatActivity activity, View container, Fragment fragment)
- Switches
fragment
in thecontainer
view switchfragment(AppCompatActivity activity, View container, Fragment fragment, String toolbarTitle)
- Switches
fragment
in thecontainer
view - Also changes the toolbar's title if available
setToolbarElevation(Toolbar toolbar, View toolbarShadow, int elevation)
- Sets toolbar elevation to
elevation
if device is LOLLIPOP+ and hidestoolbarShadow
view - Else unhides
toolbarShadow
view - Tip: Very useful for backward compatibility