com.androidquery.util.AQUtility Java Examples

The following examples show how to use com.androidquery.util.AQUtility. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateUtils.java    From freemp with Apache License 2.0 6 votes vote down vote up
@Override
protected String doInBackground(Void... params) {
    Activity activity = activityContainer.get();
    if (null == activity) {
        return "";
    }
    try {
        versionCode = activity.getPackageManager()
                .getPackageInfo(activity.getPackageName(), 0).versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    locale = activity.getResources().getConfiguration().locale.toString();//Locale.getDefault().toString();
    AQUtility.debug("locale", locale);
    String response = "";

    AjaxCallback<String> cb = new AjaxCallback<String>();
    cb.url(MESSAGEURL).type(String.class).timeout(1);

    aq.sync(cb);

    response = cb.getResult();
    return response;
}
 
Example #2
Source File: MakePlaylistFS.java    From IdealMedia with Apache License 2.0 5 votes vote down vote up
public void add2list(String artist,String yearS,String trackS,String title,String album,String composer,
                     String path,String folder, long lastModified,String filename,int duration,int albumId){
    int year = 0;
    int track = 0;

    try {
        if (!yearS.equals("")) {
            if (yearS.length()>3) {
                yearS = yearS.substring(0,4);
            }
            year  = Integer.parseInt(yearS.replaceAll("[^\\d.]", ""));
        }

        if (!trackS.equals(""))
            track = Integer.parseInt(trackS.replaceAll("[^\\d.]", ""));
    } catch (Exception e) {AQUtility.debug(e.toString());}

    allTracks.add(new Track(
            artist.equals("") ?"unknown": StringUtils.capitalizeFully(artist),
            title.equals("") ?filename:StringUtils.capitalizeFully(title),
            album,
            composer,
            year,
            track,
            duration,
            path,
            folder,
            lastModified,
            albumId));
}
 
Example #3
Source File: ApolloUtils.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
/**
 * Sets the ListView paddingLeft for the header
 * 
 * @param fragment
 * @param mListView
 */
public static void setListPadding(Fragment fragment, ListView mListView, int left, int top,
        int right, int bottom) {
    if (fragment.getArguments() != null) {
        String mimetype = fragment.getArguments().getString(MIME_TYPE);
        if (Audio.Albums.CONTENT_TYPE.equals(mimetype)) {
            mListView.setPadding(AQUtility.dip2pixel(fragment.getActivity(), left), top,
                    AQUtility.dip2pixel(fragment.getActivity(), right), bottom);
        } else if (Audio.Artists.CONTENT_TYPE.equals(mimetype)) {
            mListView.setPadding(AQUtility.dip2pixel(fragment.getActivity(), left), top,
                    AQUtility.dip2pixel(fragment.getActivity(), right), bottom);
        }
    }
}
 
Example #4
Source File: MakePlaylistFS.java    From freemp with Apache License 2.0 5 votes vote down vote up
@Override
public void getAllTracks(Context context, boolean refresh) {
    this.refresh = refresh;
    t = System.currentTimeMillis();
    String scanDir = PreferenceManager.getDefaultSharedPreferences(context).getString("scanDir", Environment.getExternalStorageDirectory().getAbsolutePath().toString());
    File currentDir = new File(scanDir);

    tempAllTracks = (ArrayList<ClsTrack>) FileUtils.readObject("alltracksfs", context);
    tempAllTracksMediaStore = (ArrayList<ClsTrack>) FileUtils.readObject("alltracksms", context);

    if (refresh || tempAllTracksMediaStore == null || tempAllTracksMediaStore.size() == 0) {
        fillMediaStoreTracks = new FillMediaStoreTracks(context);
        tempAllTracksMediaStore = fillMediaStoreTracks.getTracks();
    }

    if (!refresh && tempAllTracks != null && tempAllTracks.size() > 0) {
        allTracks = new ArrayList<ClsTrack>(tempAllTracks);
    } else {
        if (BASS.BASS_Init(-1, 44100, 0)) {
            String nativePath = context.getApplicationInfo().nativeLibraryDir;
            String[] listPlugins = new File(nativePath).list();
            for (String s : listPlugins) {
                int plug = BASS.BASS_PluginLoad(nativePath + "/" + s, 0);
            }
        }
        detector = new UniversalDetector(null);

        walk(context, currentDir);

        FileUtils.writeObject("alltracksfs", context, allTracks);

        AQUtility.debug("time", "(ms):" + (System.currentTimeMillis() - t)); //5000 //81000  //7000
    }
}
 
Example #5
Source File: MakePlaylistFS.java    From freemp with Apache License 2.0 5 votes vote down vote up
public void add2list(String artist, String yearS, String trackS, String title, String album, String composer,
                     String path, String folder, long lastModified, String filename, int duration, int albumId) {
    int year = 0;
    int track = 0;

    try {
        if (!yearS.equals("")) {
            if (yearS.length() > 3) {
                yearS = yearS.substring(0, 4);
            }
            year = Integer.parseInt(yearS.replaceAll("[^\\d.]", ""));
        }

        if (!trackS.equals(""))
            track = Integer.parseInt(trackS.replaceAll("[^\\d.]", ""));
    } catch (Exception e) {
        AQUtility.debug(e.toString());
    }

    allTracks.add(new ClsTrack(
            artist.equals("") ? "unknown" : StringUtils.capitalizeFully(artist),
            title.equals("") ? filename : StringUtils.capitalizeFully(title),
            album,
            composer,
            year,
            track,
            duration,
            path,
            folder,
            lastModified,
            albumId));
}
 
Example #6
Source File: ArtistsFragment.java    From IdealMedia with Apache License 2.0 4 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    AQUtility.debug("onResume", "Albums");

}
 
Example #7
Source File: FragmentArtists.java    From freemp with Apache License 2.0 4 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    AQUtility.debug("onResume", "Albums");

}
 
Example #8
Source File: FragmentFolders.java    From freemp with Apache License 2.0 4 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    AQUtility.debug("onResume", "Folders");

}
 
Example #9
Source File: FragmentAlbums.java    From freemp with Apache License 2.0 4 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    AQUtility.debug("onResume", "Albums");

}