-
public class TDUtilsTA utils.
-
-
Method Summary
Modifier and Type Method Description static voidaddViewPathProperties(Activity activity, View view, JSONObject properties)addViewPathProperties static StringtraverseView(StringBuilder stringBuilder, ViewGroup root)traverseView static voidgetFragmentNameFromView(View view, JSONObject properties)getFragmentNameFromView static StringgetTitleFromFragment(Object fragment, String token)get fragmentTitle static ActivitygetActivityFromContext(Context context)static StringgetViewId(View view)static StringgetViewId(View view, String token)getViewId static StringgetActivityTitle(Activity activity)getActivityTitle static synchronized voidsetTag(String token, View view, int tagId, Object value)setTag static synchronized ObjectgetTag(String token, View view, int tagId)getTag static voidgetScreenNameAndTitleFromActivity(JSONObject properties, Activity activity)getScreenNameAndTitleFromActivity static StringgetToolbarTitle(Activity activity)getToolbarTitle static voidmergeJSONObject(JSONObject source, JSONObject dest, TimeZone timeZone)mergeJSONObject static voidmergeNestedJSONObject(JSONObject source, JSONObject dest, TimeZone timeZone)Used to merge two nested json objects[example] JSONObject{key:JSONObject{key:value}}. static JSONArrayformatJSONArray(JSONArray jsonArr, TimeZone timeZone)formatJSONArray with TimeZone static JSONObjectformatJSONObject(JSONObject jsonObject, TimeZone timeZone)formatJSONObject with TimeZone static doublegetTimezoneOffset(long time, TimeZone timeZone)static StringgetSuffix(String source, int length)getSuffix static StringgetCurrentProcessName(Context context)Gets the current process name static doubleformatNumber(double num)keep one decimal place. static floatformatNumberWithSpace(float num, int space)static booleanisForeground(Context context)Determine if the current application is in the foreground. static intconvertToNetworkType(String networkType)Network type conversion static booleanisLogControlFileExist()Check whether the local log switch file exists. static StringformatTime(Date mDate, TimeZone mTimeZone)time format static Pair<Long, Boolean>getInstallInfo(Context context)-
-
Method Detail
-
addViewPathProperties
static void addViewPathProperties(Activity activity, View view, JSONObject properties)
addViewPathProperties
- Parameters:
activity- Activityview- Viewproperties- properties
-
traverseView
static String traverseView(StringBuilder stringBuilder, ViewGroup root)
traverseView
- Parameters:
stringBuilder- StringBuilderroot- ViewGroup
-
getFragmentNameFromView
static void getFragmentNameFromView(View view, JSONObject properties)
getFragmentNameFromView
- Parameters:
view- Viewproperties- JSONObject
-
getTitleFromFragment
static String getTitleFromFragment(Object fragment, String token)
get fragmentTitle
- Parameters:
fragment- Fragmenttoken- token
-
getActivityFromContext
static Activity getActivityFromContext(Context context)
- Parameters:
context- Context
-
getViewId
static String getViewId(View view, String token)
getViewId
- Parameters:
view- Viewtoken- App ID
-
getActivityTitle
static String getActivityTitle(Activity activity)
getActivityTitle
- Parameters:
activity- Activity
-
setTag
static synchronized void setTag(String token, View view, int tagId, Object value)
setTag
- Parameters:
token- App IDview- ViewtagId- IDvalue- Value
-
getTag
static synchronized Object getTag(String token, View view, int tagId)
getTag
- Parameters:
token- App IDview- ViewtagId- ID
-
getScreenNameAndTitleFromActivity
static void getScreenNameAndTitleFromActivity(JSONObject properties, Activity activity)
getScreenNameAndTitleFromActivity
- Parameters:
properties- JSONObjectactivity- Activity
-
getToolbarTitle
static String getToolbarTitle(Activity activity)
getToolbarTitle
- Parameters:
activity- Activity
-
mergeJSONObject
static void mergeJSONObject(JSONObject source, JSONObject dest, TimeZone timeZone)
mergeJSONObject
- Parameters:
source- sourceJSONObjectdest- destJSONObjecttimeZone- TimeZone
-
mergeNestedJSONObject
static void mergeNestedJSONObject(JSONObject source, JSONObject dest, TimeZone timeZone)
Used to merge two nested json objects[example] JSONObject{key:JSONObject{key:value}}.
- Parameters:
source- source jsondest- dest jsontimeZone- time zone
-
formatJSONArray
static JSONArray formatJSONArray(JSONArray jsonArr, TimeZone timeZone)
formatJSONArray with TimeZone
- Parameters:
jsonArr- JSONArraytimeZone- TimeZone
-
formatJSONObject
static JSONObject formatJSONObject(JSONObject jsonObject, TimeZone timeZone)
formatJSONObject with TimeZone
- Parameters:
jsonObject- JSONObjecttimeZone- TimeZone
-
getTimezoneOffset
static double getTimezoneOffset(long time, TimeZone timeZone)
-
getSuffix
static String getSuffix(String source, int length)
getSuffix
- Parameters:
source- Stringlength- Len
-
getCurrentProcessName
static String getCurrentProcessName(Context context)
Gets the current process name
- Parameters:
context- context
-
formatNumber
static double formatNumber(double num)
keep one decimal place.
- Parameters:
num- double
-
formatNumberWithSpace
static float formatNumberWithSpace(float num, int space)
-
isForeground
static boolean isForeground(Context context)
Determine if the current application is in the foreground.
- Parameters:
context- context
-
convertToNetworkType
static int convertToNetworkType(String networkType)
Network type conversion
- Parameters:
networkType- network type
-
isLogControlFileExist
static boolean isLogControlFileExist()
Check whether the local log switch file exists.
-
formatTime
static String formatTime(Date mDate, TimeZone mTimeZone)
time format
- Parameters:
mDate- datemTimeZone- time zone
-
getInstallInfo
static Pair<Long, Boolean> getInstallInfo(Context context)
-
-
-
-