Android Open Source - BluetoothGlass File Extension Filter






From Project

Back to project page BluetoothGlass.

License

The source code is released under:

GNU General Public License

If you think the Android project BluetoothGlass 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.vicmns.bluetoothglass.client.tools;
//from w ww.  ja va 2 s  .  c om
public class FileExtensionFilter {
  
  private static String[] imageExtensions = {".png", ".jpeg", ".gif", ".jpg"};
  private static String[] videoExtensions = {".mp4", ".avi", ".mpeg", ".3GP"};
  
  public static enum MediaTypes {
     IMAGE, VIDEO
  }
  
  public static boolean isFileImage(String fileName) {
    for(int i = 0; i < imageExtensions.length ; i++) {
      if(fileName.toLowerCase().endsWith(imageExtensions[i]))
        return true;
    }
    return false;
  }
  
  public static boolean isFileVideo(String fileName) {
    for(int i = 0; i < videoExtensions.length ; i++) {
      if(fileName.toLowerCase().endsWith(videoExtensions[i]))
        return true;
    }
    return false;
  }
  
  public static boolean filerFilesByType(String fileName, MediaTypes mediaType) {
    switch(mediaType) {
      case IMAGE:
        return isFileImage(fileName);
      case VIDEO:
        return isFileVideo(fileName);
      default:
        return false;
    }
  }
}




Java Source Code List

com.vicmns.bluetoothglass.client.MainApplication.java
com.vicmns.bluetoothglass.client.activities.BluetoothClient.java
com.vicmns.bluetoothglass.client.activities.MainActivity.java
com.vicmns.bluetoothglass.client.adapters.BluetoothDevicesAdapter.java
com.vicmns.bluetoothglass.client.bluetooth.SendFileToDeviceTask.java
com.vicmns.bluetoothglass.client.callbacks.CardScrollCallBacks.java
com.vicmns.bluetoothglass.client.data.BluetoothParametersHolder.java
com.vicmns.bluetoothglass.client.models.BluetoothDeviceModel.java
com.vicmns.bluetoothglass.client.services.GoogleVoiceTriggerService.java
com.vicmns.bluetoothglass.client.services.SendPictureToDevice.java
com.vicmns.bluetoothglass.client.tools.FileExtensionFilter.java
com.vicmns.bluetoothglass.client.views.CameraView.java
com.vicmns.bluetoothglass.client.views.OverlayView.java
com.vicmns.bluetoothglass.server.MainActivity.java
com.vicmns.bluetoothglass.server.MainApplication.java
com.vicmns.bluetoothglass.server.data.BluetoothParametersHolder.java
com.vicmns.bluetoothglass.server.handlers.BluetoothConnectionHandler.java
com.vicmns.bluetoothglass.server.handlers.BluetoothReadFromSocketHandler.java
com.vicmns.bluetoothglass.server.receivers.DeviceBootReceiver.java
com.vicmns.bluetoothglass.server.service.BluetoothService.java