Android uses Vitamio to build its own universal player (8)--Details Optimization _android

Source: Internet
Author: User

Objective

Successful products are often in the details of the ultimate, products and projects from the point of view of the use of the biggest difference I think is the details of the processing. The goal of the premiere video is the product, the front 7 article advance, added a lot of function, also should stop to rest, optimize, also welcome the Exchange feedback do not be thoughtful place. Because of open source, you can also follow their preferences to add changes to different features and details.

Series

1. Android uses Vitamio to build its own universal player (1)--ready

2, Android uses Vitamio to build its own universal player (2)--gesture control brightness, volume, zoom

3, Android use Vitamio to build their own universal player (3)--local playback (main interface, video list)

4, Android use Vitamio to build their own universal player (4)--Local playback (fast search, data storage)

5, Android use Vitamio to build their own universal player (5)--Play online (play cool video)

6. Android uses Vitamio to build its own universal player (6)--Play Online (playlist)

7, Android use Vitamio to build their own universal player (7)--Play Online (download video)

Body

First, update the log

1. Add: Show SDcard remaining space

If the SD card capacity is limited, and often use the download video, the rest of the space to pay more attention. As shown in figure:

Code on the Internet, there are also used in the project:

public static String showfilesize (long size) {
 string fileSize;
 if (Size < KB)
  fileSize = size + "B";
 else if (size < MB)
  fileSize = String.Format ("%.1f", size/kb) + "KB";
 else if (size < GB)
  fileSize = String.Format ("%.1f", SIZE/MB) + "MB";
 else
  fileSize = String.Format ("%.1f", SIZE/GB) + "GB";

 return fileSize;
 }

 /** shows the SD card remaining space
 /public static string Showfileavailable () {
 string result = "";
 if (Environment.MEDIA_MOUNTED.equals (Environment.getexternalstoragestate ())) {
  Statfs SF = new Statfs ( Environment.getexternalstoragedirectory (). GetPath ());
  Long blockSize = Sf.getblocksize ();
  Long Blockcount = Sf.getblockcount ();
  Long Availcount = Sf.getavailableblocks ();
  Return Showfilesize (Availcount * blockSize) + "/" + showfilesize (blockSize * blockcount);
 return result;

 } 

 

2. Improve: Load the page when the display is loading effect

does not change before each entry page will be blank, after loading is displayed, the experience is poor.

3. Improvement: Online video column in the switch between multiple sites back to chaos problem

Use the WebView default forward backward function before changing, and the situation of backward chaos will occur after the switch is found in use. Note ClearHistory cannot clear the current URL. Modify the reference posts here. Note that you need to determine whether the link is the same:

if (!mhistory.contains (URL))
  

4. Add: Display the URL that is being loaded

5. Add: Delete, rename video files

Basic functionality:

 /** Delete file */private void DeleteFile (final fileadapter adapter, final PFile F, final int position) {New Alertdialog.bu Ilder (Getactivity ()). SetIcon (Android. R.drawable.ic_dialog_alert). Settitle (R.string.file_delete). Setmessage (GetString (R.string.file_delete_confirm, F.title)). Setnegativebutton (Android.  R.string.yes, New Dialoginterface.onclicklistener () {@Override public void OnClick (Dialoginterface dialog, int which)
   {try {File file = new file (F.path);
   if (File.canread () && file.exists ()) File.delete ();
   Filebusiness.deletefile (Getactivity (), f);
  Adapter.delete (position); The catch (Exception e) {}}}). Setpositivebutton (Android.
 R.string.no, NULL). Show (); /** Rename file/private void RenameFile (final fileadapter adapter, final PFile F, final int position) {Final EditText
 ET = new EditText (getactivity ());
 Et.settext (F.title); New Alertdialog.builder (Getactivity ()). Settitle (R.string.file_rename). SetIcon (Android. r.drawable.ic_dialog_info). SETview (ET). Setnegativebutton (Android. R.string.yes, New Dialoginterface.onclicklistener () {@Override public void OnClick (Dialoginterface dialog, int which
  {String name = Et.gettext (). toString (). Trim (); if (name = = NULL | | Name.trim (). Equals ("") | |

  Name.trim (). Equals (F.title) return;
   try {file FromFile = new file (F.path);
   File NF = new file (Fromfile.getparent (), Name.trim ());
   if (nf.exists ()) {Toast.maketext (Getactivity (), r.string.file_rename_exists, Toast.length_long). Show ();
   else if (Fromfile.renameto (NF)) {f.title = name;
   F.path = Nf.getpath ();
   Filebusiness.renamefile (Getactivity (), f);
   Adapter.notifydatasetchanged (); } catch (SecurityException se) {toast.maketext (Getactivity (), r.string.file_rename_failed, Toast.length_long). Show
  (); and}}). Setpositivebutton (Android.
 R.string.no, NULL). Show ();  }

6. Fixed: Problems that cannot be closed when using WebView to play video

This problem may occur when you use a browser's flash plugin to play video.

7. Improvement: Download video display corresponding video title name

Download the video for a long serial number before changing it.

Third, download 

After this section, the code is no longer available for download, please move to Google Code:

Http://code.google.com/p/android-oplayer

Unable to access please try address: https://over140@android-oplayer.googlecode.com/hg/, reference here.

The above is the Android Vitamio Development Player Details Optimization section, the follow-up continues to add.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.