Skip to content

Commit

Permalink
2.1.x overhaul
Browse files Browse the repository at this point in the history
Close #85
Close #88
Close #89
Close #90
Close #91
Close #92
Close #93
Close #95
Close #97
Close #98
Close #101
  • Loading branch information
isuPatches committed Aug 12, 2018
1 parent 97f4456 commit f3ad03d
Show file tree
Hide file tree
Showing 243 changed files with 28,871 additions and 21,309 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.* isuPatches@yahoo.com
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jdk:

env:
global:
- TARGET_SDK=26
- BUILD_TOOLS_VERSION=26.0.0
- TARGET_SDK=27
- BUILD_TOOLS_VERSION=27.0.2
matrix:
- EMULATOR_SDK=android-19 ABI=armeabi-v7a
- EMULATOR_SDK=android-22 ABI=armeabi-v7a
Expand All @@ -32,7 +32,7 @@ before_script:
- adb shell input keyevent 82 &

script:
- travis_wait 60 ./gradlew jacocoDebugTestReport
- travis_wait 60 ./gradlew makeGoodChoices

after_success:
- bash <(curl -s https://codecov.io/bash)
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,31 @@ Wifi configuration and util library built for Android.

> <br/>*Developed by Patches 04/24/2016 - present* <br/>
>
> <br/>Supports Android SDK levels 16-26<br/><br/>
> <br/>Supports Android SDK levels 16-27<br/><br/>
[![Build Status](https://travis-ci.org/isuPatches/WiseFy.svg?branch=master)](https://travis-ci.org/isuPatches/WiseFy) [ ![Download](https://api.bintray.com/packages/isupatches/Maven/wisefy/images/download.svg) ](https://bintray.com/isupatches/Maven/wisefy/_latestVersion) <a href="http://www.methodscount.com/?lib=com.isupatches%3Awisefy%3A2.%2B"><img src="https://img.shields.io/badge/Methods and size-298 | 51 KB-e91e63.svg"/></a> [![codecov](https://codecov.io/gh/isuPatches/WiseFy/branch/2.x/graph/badge.svg)](https://codecov.io/gh/isuPatches/WiseFy)

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-WiseFy-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6011) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23230-blue.svg)](http://androidweekly.net/issues/issue-230)

## What's New in 2.x
## What's New in 2.1.x

- Ability to get the IP of the device
- Additional details in callback for adding a network:
- The new id of the network
- The WifiConfiguration of the network that was added
- isNetworkInConfigurationList renamed isNetworkSaved
- Nullability annotations
- Definitions for NetworkTypes and WiseFyCodes (please see NetworkTypeDefs and WiseFyCodeDefs)
- Immutability throughout the library
- Improved architecture
- Updated dependencies
- Updated to Gradle 4.3.x and AGP 3.x
- Target now is set to API 27
- Less duplicate code
- Improved testing
- Other improvements and adjustments!

## What's New in 2.0.x

- Asynchronous API
- Certain methods have callbacks and are run on a WiseFy specific background thread
Expand Down Expand Up @@ -62,7 +80,7 @@ For Maven:
<dependency>
<groupId>com.isupatches</groupId>
<artifactId>wisefy</artifactId>
<version><LATEST_VERSION></version>
<version>LATEST_VERSION</version>
<type>pom</type>
</dependency>
```
Expand All @@ -76,13 +94,13 @@ WiseFy is constructed with the builder pattern that allows you access to the syn
To grab a default instance:

```java
WiseFy mWiseFy = new WiseFy.brains(getActivity()).getSmarts();
WiseFy wiseFy = new WiseFy.brains(getActivity()).getSmarts();
```

To grab an instance with logging enabled:

```java
WiseFy mWiseFy = new WiseFy.brains(getActivity()).logging(true).getSmarts();
WiseFy wiseFy = new WiseFy.brains(getActivity()).logging(true).getSmarts();
```

## Cleanup
Expand All @@ -92,7 +110,7 @@ Since the Async API of WiseFy is run on a background thread, it is necessary to
To stop the WiseFy thread and nullify it along with it's handler please call:

```java
mWiseFy.dump();
wiseFy.dump();
```

## Permissions
Expand Down
33 changes: 22 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
buildscript {
project.ext {
bintrayVersion = '1.7.3'
cpdVersion = '1.0'
dexcountVersion = '0.8.1'
gradlePluginVersion = '3.0.0'
jacocoVersion = '0.7.9'
mavenPlugin = '2.0'
}

repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
google()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath "com.android.tools.build:gradle:2.3.3"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.1"
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
classpath "org.jacoco:org.jacoco.core:0.7.9"
classpath "org.jacoco:org.jacoco.agent:0.7.9"
classpath "org.jacoco:org.jacoco.report:0.7.9"
classpath "com.android.tools.build:gradle:${gradlePluginVersion}"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:${dexcountVersion}"
classpath "com.github.dcendents:android-maven-gradle-plugin:${mavenPlugin}"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${bintrayVersion}"
classpath "de.aaschmid:gradle-cpd-plugin:${cpdVersion}"
classpath "org.jacoco:org.jacoco.core:${jacocoVersion}"
classpath "org.jacoco:org.jacoco.agent:${jacocoVersion}"
classpath "org.jacoco:org.jacoco.report:${jacocoVersion}"
}
}

allprojects {
repositories {
jcenter()
google()
}
}

Expand Down Expand Up @@ -50,7 +61,7 @@ ext {
preDexEnabled = "true" == System.getProperty("pre-dex", "true")

GROUP = "com.isupatches"
VERSION_NAME = "2.0.1"
VERSION_NAME = "2.1.0"

BINTRAY_REPO = "Maven"
BINTRAY_NAME = "wisefy"
Expand Down
31 changes: 31 additions & 0 deletions config/checkstyle/import-control.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.2//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
<import-control pkg="com.isupatches.wisefy">

<allow pkg="com.isupatches.wisefy"/>

<!-- Android -->
<allow pkg="android.annotation"/>
<allow pkg="android.content"/>
<allow pkg="android.net"/>
<allow pkg="android.os"/>
<allow pkg="android.support"/>
<allow pkg="android.util"/>

<!-- Google -->
<allow pkg="com.google.android.gms"/>

<!-- Java -->
<allow pkg="java.lang.annotation"/>
<allow pkg="java.math"/>
<allow pkg="java.net"/>
<allow pkg="java.util"/>

<!-- Junit -->
<allow pkg="org.junit"/>

<!-- Mockito -->
<allow pkg="org.mockito"/>
</import-control>
80 changes: 40 additions & 40 deletions documentation/adding_and_removing_networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,114 +3,114 @@
To add an open network:

```java
int addedSuccessfully = mWiseFy.addOpenNetwork("Open Network");
int newNetworkId = wisefy.addOpenNetwork("Open Network");
```

To add a WEP network:

```java
int addedSuccessfully = mWiseFy.addWEPNetwork("WEP Network", "123456");
int newNetworkId = wisefy.addWEPNetwork("WEP Network", "123456");
```

To add a WPA2 network:

```java
int addedSuccessfully = mWiseFy.addWPA2Network("WPA2 Network", "12345678");
int newNetworkId = wisefy.addWPA2Network("WPA2 Network", "12345678");
```

To remove a configured network:

```java
boolean removedSuccessfully = mWiseFy.removeNetwork("SSID to remove");
boolean removedSuccessfully = wisefy.removeNetwork("SSID to remove");
```

#### Via The Asynchronous API

To add an open network:

```java
mWiseFy.addOpenNetwork("Open Network", new AddOpenNetworkCallbacks() {
wisefy.addOpenNetwork("Open Network", new AddOpenNetworkCallbacks() {
@Override
public void addOpenNetworkWiseFyFailure(Integer wisefyReturnCode) {

public void addOpenNetworkWiseFyFailure(int wisefyReturnCode) {
}

@Override
public void failureAddingOpenNetwork(Integer wifiManagerReturnCode) {

public void failureAddingOpenNetwork(int wifiManagerReturn) {
}

@Override
public void openNetworkAdded(WifiConfiguration openNetwork) {

public void openNetworkAdded(int newNetworkId, WifiConfiguration openNetworkConfig) {
}
});
```

To add a WEP network:

```java
mWiseFy.addWEPNetwork("WEP Network", "123456", new AddWEPNetworkCallbacks() {
wisefy.addWEPNetwork("WEP Network", "123456", new AddWEPNetworkCallbacks() {
@Override
public void addWEPNetworkWiseFyFailure(Integer wisefyReturnCode) {

public void addWEPNetworkWiseFyFailure(int wisefyReturnCode) {
}

@Override
public void failureAddingWEPNetwork(Integer wifiManagerReturnCode) {

public void failureAddingWEPNetwork(int wifiManagerReturn) {
}

@Override
public void wepNetworkAdded(WifiConfiguration wepNetwork) {

public void wepNetworkAdded(int newNetworkId, WifiConfiguration wepNetworkConfig) {
}
});
```

To add a WPA2 network:

```java
mWiseFy.addWPA2Network("WPA2 Network", "12345678", new AddWPA2NetworkCallbacks() {
wisefy.addWPA2Network("WPA2 Network", "12345678", new AddWPA2NetworkCallbacks() {
@Override
public void addWPA2NetworkWiseFyFailure(Integer wisefyReturnCode) {

public void addWPA2NetworkWiseFyFailure(int wisefyReturnCode) {
}

@Override
public void failureAddingWPA2Network(Integer wifiManagerReturnCode) {

public void failureAddingWPA2Network(int wifiManagerReturn) {
}

@Override
public void wpa2NetworkAdded(WifiConfiguration wpa2Network) {

public void wpa2NetworkAdded(int newNetworkId, WifiConfiguration wpa2Network) {
}
});
```

To remove a configured network:

```java
mWiseFy.removeNetwork("SSID to remove", new RemoveNetworkCallbacks() {
wisefy.removeNetwork("SSID to remove", new RemoveNetworkCallbacks() {
@Override
public void failureRemovingNetwork() {

}

@Override
public void networkNotFoundToRemove() {

}

@Override
public void networkRemoved() {

}

@Override
public void removeNetworkWiseFyFailure(Integer wisefyReturnCode) {

public void removeNetworkWiseFyFailure(int wisefyReturnCode) {
}
});
```
Expand Down
12 changes: 6 additions & 6 deletions documentation/checking_device_connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
To check and see if the device is connected to a mobile network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToMobileNetwork();
boolean isConnected = wisefy.isDeviceConnectedToMobileNetwork();
```

To check and see if the device is connected to a mobile or wifi network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToMobileOrWifiNetwork();
boolean isConnected = wisefy.isDeviceConnectedToMobileOrWifiNetwork();
```

To check and see if the device is connected to a given SSID:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToSSID("SSID");
boolean isConnected = wisefy.isDeviceConnectedToSSID("SSID");
```

To check and see if the device is connected to a wifi network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToWifiNetwork();
boolean isConnected = wisefy.isDeviceConnectedToWifiNetwork();
```

To check and see if the device is roaming:

```java
boolean isDeviceRoaming = mWiseFy.isDeviceRoaming();
boolean isDeviceRoaming = wisefy.isDeviceRoaming();
```

To check and see if Wifi is enabled on a device:

```java
boolean wifiEnabled = mWiseFy.isWifiEnabled();
boolean wifiEnabled = wisefy.isWifiEnabled();
```
Loading

0 comments on commit f3ad03d

Please sign in to comment.