Android Open Source - Alfred4Android Match






From Project

Back to project page Alfred4Android.

License

The source code is released under:

Apache License

If you think the Android project Alfred4Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.toraleap.collimator.data;
//ww w .  j  a  va2  s . co  m
import android.graphics.Bitmap;
import android.text.Html;
import android.text.Spanned;

import com.toraleap.collimator.util.FileInfo;

/**
 * ?? Match ???????????????????
 * @author    uestc.Mobius <mobius@toraleap.com>
 * @version  2010.1104
 */
public final class Match {
  private final int mIndex;
  private boolean[] mHilite;
  
  /**
   * ???????????
   * @param entry    ???????????????
   */
  public Match(int index) {
    mIndex = index;
    mHilite = new boolean[Index.getName(index).length()];
  }
  
  /**
   * ????????????????????????????????????????????????????
   * @param start    ??????????
   * @param end    ??????????
   */
  public void setHilite(int start, int end) {
    for (int i = start; i < end; i++)
      mHilite[i] = true;
  }
  
  /**
   * ????????????????????
   * @return ????
   */
  public int index() { return mIndex; }
  /**
   * ??????????
   * @return  ?????
   */
  public String name() { return Index.getName(mIndex); }
  /**
   * ???????????????????????????????????????????????? null??
   * @return  ???????????????
   */
  public String nameAlpha() { return Index.getNameAlpha(mIndex); }
  /**
   * ???????????????
   * @return  ???????
   */
  public String path() { return Index.getPath(mIndex); }
  /**
   * ???????????????????????????????????????????????????? null??
   * @return  ?????????????????
   */
  public String pathAlpha() { return Index.getPathAlpha(mIndex); }
  /**
   * ????????????????????????????
   * @return  ???????
   */
  public long size() { return Index.getSize(mIndex); }
  /**
   * ???????????????????????????
   * @return  ????????????????
   */
  public String sizeString() { return FileInfo.sizeString(Index.getSize(mIndex)); }
  /**
   * ???????????????? 1970-01-01 ?????????
   * @return  ???????????????
   */
  public long time() { return Index.getTime(mIndex); }
  /**
   * ????????????????????????????????
   * @return  ??????????????
   */
  public String timeString() { return FileInfo.timeSpanString(System.currentTimeMillis() - Index.getTime(mIndex)); }
  /***
   * ?????????????????????????????????????????????? null????????????????????????????????????????????????????????? RELOAD_UPDATE_THUMBNAIL ?????????????????
   * @return ??????????
   */
  public Bitmap thumbnail() { return Index.getThumbnail(mIndex); }
  /***
   * ?????????????????????????????????????????????? null????????????????????????????????????????????????????????? RELOAD_UPDATE_DIGEST ?????????????????
   * @return ??????????
   */
  public Spanned digest() { return Index.getDigest(mIndex); }
  /***
   * ?????????????????????????
   * @return ?????????
   */
  public Spanned highlightedName() {
    String source = Index.getName(mIndex);
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < mHilite.length; i++) {
      if (mHilite[i]) {
        sb.append("<font color='#ffff00'>" + source.charAt(i) + "</font>");
      } else {
        sb.append(source.charAt(i));
      }
    }
    return Html.fromHtml(sb.toString());
  }
}




Java Source Code List

android.media.MediaMetadataRetriever.java
com.toraleap.collimator.AppSearchActivity.java
com.toraleap.collimator.GlobalContext.java
com.toraleap.collimator.HelpActivity.java
com.toraleap.collimator.PrefsActivity.java
com.toraleap.collimator.SearchActivity.java
com.toraleap.collimator.ShortcutActivity.java
com.toraleap.collimator.bll.FileScannerService.java
com.toraleap.collimator.bll.TagGenerator.java
com.toraleap.collimator.dal.DBColumns.java
com.toraleap.collimator.dal.DBHelper.java
com.toraleap.collimator.dal.DBOperation.java
com.toraleap.collimator.data.Expression.java
com.toraleap.collimator.data.IndexData.java
com.toraleap.collimator.data.IndexLoader.java
com.toraleap.collimator.data.Index.java
com.toraleap.collimator.data.Match.java
com.toraleap.collimator.data.Matcher.java
com.toraleap.collimator.data.Sorter.java
com.toraleap.collimator.ext.GlobalProvider.java
com.toraleap.collimator.ext.Playlist.java
com.toraleap.collimator.model.BaseTag.java
com.toraleap.collimator.ui.FloatingDialog.java
com.toraleap.collimator.ui.MatchAdapter.java
com.toraleap.collimator.util.DigestUtil.java
com.toraleap.collimator.util.FileInfo.java
com.toraleap.collimator.util.MimeTypeMap.java
com.toraleap.collimator.util.RecursiveFileObserver.java
com.toraleap.collimator.util.ShortcutHelper.java
com.toraleap.collimator.util.SoftCache.java
com.toraleap.collimator.util.ThumbnailUtil.java
com.toraleap.collimator.util.Unicode2Alpha.java