Android Open Source - FileShare F S Application






From Project

Back to project page FileShare.

License

The source code is released under:

MIT License

If you think the Android project FileShare 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.csyangchsh.fileshare;
//from w w  w. ja  va2s .  c o  m
import android.app.Application;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.text.format.Formatter;

import com.csyangchsh.fileshare.util.TempFileFactory;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

/**
 * @author csyangchsh
 * 2014-08-28
 */
public class FSApplication extends Application{

    public static TempFileFactory fileFactory;
    private static ConnectivityManager connManager;
    private static WifiManager wifiManager;

    @Override
    public void onCreate() {
        super.onCreate();
        fileFactory = new TempFileFactory();
        connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        fileFactory.destroy();
    }

    public static boolean isWifi() {
        NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        return wifi.isConnected();
    }

    public static String getIPAddress() {
        int ipAddress = wifiManager.getConnectionInfo().getIpAddress();
        String ip = Formatter.formatIpAddress(ipAddress);
        return ip;
    }

}




Java Source Code List

com.csyangchsh.fileshare.ApplicationTest.java
com.csyangchsh.fileshare.FSApplication.java
com.csyangchsh.fileshare.FileActivity.java
com.csyangchsh.fileshare.FileListAdapter.java
com.csyangchsh.fileshare.FileService.java
com.csyangchsh.fileshare.SplashActivity.java
com.csyangchsh.fileshare.util.DefaultFileFilter.java
com.csyangchsh.fileshare.util.FileHandler.java
com.csyangchsh.fileshare.util.MiniFileServer.java
com.csyangchsh.fileshare.util.TempFileFactory.java
com.csyangchsh.fileshare.util.Util.java