congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BasicUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
BasicUtils
in
com.marshalchen.ua.common.commonUtils.basicUtils

Best Java code snippets using com.marshalchen.ua.common.commonUtils.basicUtils.BasicUtils (Showing top 14 results out of 315)

origin: cymcsg/UltimateAndroid

/**
 * Judge if the ArrayList<String> contains the String variable
 *
 * @param s
 * @param arrayList
 * @return If only a String in ArrayList equals the variable return true
 */
public static boolean ifStringExactlyInList(String s, ArrayList<String> arrayList) {
  if (BasicUtils.judgeNotNull(s) && BasicUtils.judgeNotNull(arrayList)) {
    for (String str : arrayList) {
      if (str.equals(s))
        return true;
    }
  }
  return false;
}
origin: cymcsg/UltimateAndroid

public static void iterateListHashMap(List list) {
  //support concurrent
  try {
    for (Iterator it = list.iterator(); it.hasNext(); ) {
      iterateHashMapConcurrent((HashMap) it.next());
    }
  } catch (Exception e) {
    e.printStackTrace();
    Logs.e(e.getMessage());
  }
}
origin: cymcsg/UltimateAndroid

/**
 * Judge if the ArrayList<String> contains the String variable
 * This method judges  trim String.
 *
 * @param s
 * @param arrayList
 * @return If a String in ArrayList contains the variable return true
 */
public static boolean ifStringInList(String s, ArrayList<String> arrayList) {
  if (BasicUtils.judgeNotNull(s) && BasicUtils.judgeNotNull(arrayList)) {
    for (String str : arrayList) {
      if (str.trim().contains(s))
        return true;
    }
  }
  return false;
}
origin: cymcsg/UltimateAndroid

/**
 * Indicates if the file represents a directory exists.
 *
 * @param directoryPath
 * @return
 */
public static boolean isFolderExist(String directoryPath) {
  if (!BasicUtils.judgeNotNull(directoryPath)) {
    return false;
  }
  File dire = new File(directoryPath);
  return (dire.exists() && dire.isDirectory());
}
origin: cymcsg/UltimateAndroid

/**
 * Indicates if the file represents a file exists.
 *
 * @param filePath
 * @return
 */
public static boolean isFileExist(String filePath) {
  if (!BasicUtils.judgeNotNull(filePath)) {
    return false;
  }
  File file = new File(filePath);
  return (file.exists() && file.isFile());
}
origin: cymcsg/UltimateAndroid

/**
 * Initialize
 *
 * @param context
 * @param crashFilePath
 */
public void init(Context context, String crashFilePath, String showMessage) {
  mContext = context;
  mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
  Thread.setDefaultUncaughtExceptionHandler(this);
  // this.systemServiceObject = systemServiceObject;
  this.crashFilePath = crashFilePath;
  if (BasicUtils.judgeNotNull(showMessage)) {
    this.showMessage = showMessage;
  }
}
origin: cymcsg/UltimateAndroid

/**
 * Get size of the file
 *
 * @param path
 * @return Return the length of the file in bytes. Return -1 if the file does not exist.
 */
public static long getFileSize(String path) {
  if (!BasicUtils.judgeNotNull(path)) {
    return -1;
  }
  File file = new File(path);
  return (file.exists() && file.isFile() ? file.length() : -1);
}
origin: cymcsg/UltimateAndroid

/**
 * @param list
 * @param lists
 * @return
 * @see #judgeNotNull(java.util.List)
 */
public static boolean judgeNotNull(List list, List... lists) {
  boolean flag = true;
  if (list == null || list.size() == 0) return false;
  if (judgeNotNull(lists))
    for (List l : lists) {
      if (l == null || l.size() == 0) {
        flag = false;
        return false;
      }
    }
  return flag;
}
origin: cymcsg/UltimateAndroid

/**
 * Get extension of the file
 *
 * @param filePath
 * @return
 */
public static String getFileExtension(String filePath) {
  if (!BasicUtils.judgeNotNull(filePath)) {
    return "";
  }
  int extenPosi = filePath.lastIndexOf(".");
  int filePosi = filePath.lastIndexOf(File.separator);
  if (extenPosi == -1) {
    return "";
  }
  return (filePosi >= extenPosi) ? "" : filePath.substring(extenPosi + 1);
}
origin: cymcsg/UltimateAndroid

public void loadRepositoryInfo(Subscriber<RepositoryList> subscriber, String query, String language, String sort, String order) {
  githubApiServiceInterface.getRepositoryBySearch(BasicUtils.judgeNotNull(language) ? query + URLDecoder.decode("+") + "language:" + language : query, sort, order)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(subscriber);
}
origin: cymcsg/UltimateAndroid

/**
 * Get file which from assets
 *
 * @param context
 * @param fileName The name of the asset to open.
 * @return
 */
public static String getFileFromAssets(Context context, String fileName) {
  if (context == null || BasicUtils.judgeNotNull(fileName)) {
    return null;
  }
  StringBuilder s = new StringBuilder("");
  try {
    InputStreamReader in = new InputStreamReader(context.getResources().getAssets().open(fileName));
    BufferedReader br = new BufferedReader(in);
    String line;
    while ((line = br.readLine()) != null) {
      s.append(line);
    }
    return s.toString();
  } catch (IOException e) {
    e.printStackTrace();
    return null;
  }
}
origin: cymcsg/UltimateAndroid

/**
 * whether the app whost package's name is packageName is on the top of the stack
 * <ul>
 * Attentions:
 * <li>You should add android.permission.GET_TASKS in manifest</li>
 * </ul>
 *
 * @param context
 * @param packageName
 * @return if params error or task stack is null, return null, otherwise retun whether the app is on the top of
 * stack
 */
public static Boolean isTopActivity(Context context, String packageName) {
  if (context == null || !BasicUtils.judgeNotNull(packageName)) {
    return null;
  }
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
  List<RunningTaskInfo> tasksInfo = activityManager.getRunningTasks(1);
  if (!BasicUtils.judgeNotNull(tasksInfo)) {
    return null;
  }
  try {
    return packageName.equals(tasksInfo.get(0).topActivity.getPackageName());
  } catch (Exception e) {
    e.printStackTrace();
    return false;
  }
}
origin: cymcsg/UltimateAndroid

if (BasicUtils.judgeNotNull(content)) {
  return false;
origin: cymcsg/UltimateAndroid

        (BasicUtils.judgeNotNull(crashFilePath) ? crashFilePath : "/crash/");
Logs.d("path----" + path);
File dir = new File(path);
com.marshalchen.ua.common.commonUtils.basicUtilsBasicUtils

Javadoc

Some Useful Utils

#judgeNotNull(String,String...)

#judgeNotNull(Object)

#getVersionName(android.content.Context)

#getVersionCode(android.content.Context)

#iterateHashMap(java.util.HashMap)

#iterateListHashMap(java.util.List)

#sendIntent(android.content.Context,Class)

#sendIntent(android.content.Context,Class,String,android.os.Parcelable)

Most used methods

  • judgeNotNull
    Judge if a variable of byte[] is not null and the length of it is above 1
  • iterateHashMapConcurrent
    Print all items of HashMap,avoid ConcurrentModificationExceptions

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now