Android Open Source - MP3QuranForAndriod Utilities






From Project

Back to project page MP3QuranForAndriod.

License

The source code is released under:

You Can use all this project files for free only if you plan to create any islamic application ... This project is for any Islamic purpose....

If you think the Android project MP3QuranForAndriod 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.mos7af.mp3quran;
/*  w w w. j  a  v  a 2  s.  c om*/

public class Utilities {
  
  /**
   * Function to convert milliseconds time to
   * Timer Format
   * Hours:Minutes:Seconds
   * */
  public String milliSecondsToTimer(long milliseconds){
    String finalTimerString = "";
    String secondsString = "";
    
    // Convert total duration into time
       int hours = (int)( milliseconds / (1000*60*60));
       int minutes = (int)(milliseconds % (1000*60*60)) / (1000*60);
       int seconds = (int) ((milliseconds % (1000*60*60)) % (1000*60) / 1000);
       // Add hours if there
       if(hours > 0){
         finalTimerString = hours + ":";
       }
       
       // Prepending 0 to seconds if it is one digit
       if(seconds < 10){ 
         secondsString = "0" + seconds;
       }else{
         secondsString = "" + seconds;}
       
       finalTimerString = finalTimerString + minutes + ":" + secondsString;
    
    // return timer string
    return finalTimerString;
  }
  
  /**
   * Function to get Progress percentage
   * @param currentDuration
   * @param totalDuration
   * */
  public int getProgressPercentage(long currentDuration, long totalDuration){
    Double percentage = (double) 0;
    
    long currentSeconds = (int) (currentDuration / 1000);
    long totalSeconds = (int) (totalDuration / 1000);
    
    // calculating percentage
    percentage =(((double)currentSeconds)/totalSeconds)*100;
    
    // return percentage
    return percentage.intValue();
  }

  /**
   * Function to change progress to timer
   * @param progress - 
   * @param totalDuration
   * returns current duration in milliseconds
   * */
  public int progressToTimer(int progress, int totalDuration) {
    int currentDuration = 0;
    totalDuration = (int) (totalDuration / 1000);
    currentDuration = (int) ((((double)progress) / 100) * totalDuration);
    
    // return current duration in milliseconds
    return currentDuration * 1000;
  }
}




Java Source Code List

com.mos7af.mp3quran.DatabaseHandler.java
com.mos7af.mp3quran.FileCache.java
com.mos7af.mp3quran.IconContextMenu.java
com.mos7af.mp3quran.ImageLoader.java
com.mos7af.mp3quran.MP3Quran.java
com.mos7af.mp3quran.MemoryCache.java
com.mos7af.mp3quran.PlayListSurasActivity.java
com.mos7af.mp3quran.PlayerActivity.java
com.mos7af.mp3quran.PlayerPlayListActivity.java
com.mos7af.mp3quran.PlayerPlaylistItemAdapter.java
com.mos7af.mp3quran.PlaylistActivity.java
com.mos7af.mp3quran.PlaylistItemAdapter.java
com.mos7af.mp3quran.ReciterItemAdapter.java
com.mos7af.mp3quran.RecitersActivity.java
com.mos7af.mp3quran.SuraItemAdapter.java
com.mos7af.mp3quran.SurasActivity.java
com.mos7af.mp3quran.SuraslistManager.java
com.mos7af.mp3quran.Utilities.java
com.mos7af.mp3quran.Utils.java
com.mos7af.mp3quran.XMLParser.java