Android Open Source - YourWiFi Essid Comparators






From Project

Back to project page YourWiFi.

License

The source code is released under:

MIT License

If you think the Android project YourWiFi 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.akisute.yourwifi.app.model;
/*from  w  w w.j a v  a 2 s . c om*/
import com.google.common.collect.Ordering;

import java.util.Comparator;

public class EssidComparators {

    public static final Comparator<Essid> UPDATED_AT_ASC = new UpdatedAtComparator();
    public static final Comparator<Essid> UPDATED_AT_DESC = Ordering.from(new UpdatedAtComparator()).reverse();

    public static final Comparator<Essid> LEVEL_ASC = new LevelComparator();
    public static final Comparator<Essid> LEVEL_DESC = Ordering.from(new LevelComparator()).reverse();

    public static final Comparator<Essid> CRYPTOTYPE_WEAKEST_TO_STRONGEST = new CryptoTypeStrengthComparator();
    public static final Comparator<Essid> CRYPTOTYPE_STRONGEST_TO_WEAKEST = Ordering.from(new CryptoTypeStrengthComparator()).reverse();

    public static final Comparator<Essid> DEFAULT = Ordering.from(LEVEL_DESC).compound(CRYPTOTYPE_WEAKEST_TO_STRONGEST).compound(new SsidComparator());


    public static class UpdatedAtComparator implements Comparator<Essid> {
        @Override
        public int compare(Essid essid, Essid essid2) {
            return essid.getUpdatedAt().compareTo(essid2.getUpdatedAt());
        }
    }

    public static class SsidComparator implements Comparator<Essid> {
        @Override
        public int compare(Essid essid, Essid essid2) {
            String ssid1 = essid.getSsid();
            String ssid2 = essid2.getSsid();
            ssid1 = (ssid1 == null) ? "" : ssid1;
            ssid2 = (ssid2 == null) ? "" : ssid2;
            return ssid1.compareTo(ssid2);
        }
    }


    public static class LevelComparator implements Comparator<Essid> {
        @Override
        public int compare(Essid essid, Essid essid2) {
            int level1 = essid.getLevel();
            int level2 = essid2.getLevel();
            return Integer.compare(level1, level2);
        }
    }

    public static class CryptoTypeStrengthComparator implements Comparator<Essid> {
        @Override
        public int compare(Essid essid, Essid essid2) {
            int type1 = essid.getCryptoType();
            int type2 = essid2.getCryptoType();
            return Integer.compare(type1, type2);
        }
    }
}




Java Source Code List

com.akisute.yourwifi.app.Application.java
com.akisute.yourwifi.app.CloudLoginDialogFragment.java
com.akisute.yourwifi.app.EssidDetailActivity.java
com.akisute.yourwifi.app.EssidDetailFragment.java
com.akisute.yourwifi.app.EssidListFragment.java
com.akisute.yourwifi.app.MainActivity.java
com.akisute.yourwifi.app.NetworkMapFragment.java
com.akisute.yourwifi.app.NetworkRecordingService.java
com.akisute.yourwifi.app.RawNetworkListFragment.java
com.akisute.yourwifi.app.SettingsActivity.java
com.akisute.yourwifi.app.SettingsFragment.java
com.akisute.yourwifi.app.cloud.CloudManager.java
com.akisute.yourwifi.app.dagger.AndroidSystemModule.java
com.akisute.yourwifi.app.dagger.ApplicationModule.java
com.akisute.yourwifi.app.intent.Intents.java
com.akisute.yourwifi.app.model.BssidListAdapter.java
com.akisute.yourwifi.app.model.EssidComparators.java
com.akisute.yourwifi.app.model.EssidListAdapter.java
com.akisute.yourwifi.app.model.Essid.java
com.akisute.yourwifi.app.model.LocationScanManager.java
com.akisute.yourwifi.app.model.NetworkCache.java
com.akisute.yourwifi.app.model.NetworkComparators.java
com.akisute.yourwifi.app.model.NetworkScanManager.java
com.akisute.yourwifi.app.model.Network.java
com.akisute.yourwifi.app.model.RawNetworkListAdapter.java
com.akisute.yourwifi.app.util.GlobalEventBus.java
com.akisute.yourwifi.app.util.GlobalResources.java
com.akisute.yourwifi.app.util.GlobalSharedPreferences.java