Skip to content

Commit fc181e7

Browse files
author
Josh Deffibaugh
committed
Cleans up and adds javadoc.
1 parent 2d68617 commit fc181e7

File tree

25 files changed

+404
-36
lines changed

25 files changed

+404
-36
lines changed

android-sdk/src/main/java/com/optimizely/ab/android/sdk/BackgroundWatchersCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.support.annotation.NonNull;
@@ -30,7 +31,7 @@
3031
import java.util.Iterator;
3132
import java.util.List;
3233

33-
/**
34+
/*
3435
* Caches a json dict that saves state about which project IDs have background watching enabled.
3536
*/
3637
class BackgroundWatchersCache {

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.support.annotation.NonNull;
@@ -27,7 +28,7 @@
2728
import java.io.FileNotFoundException;
2829
import java.io.IOException;
2930

30-
/**
31+
/*
3132
* Abstracts the actual data "file" {@link java.io.File}
3233
*/
3334
class DataFileCache {

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.support.annotation.NonNull;
@@ -25,7 +26,7 @@
2526
import java.net.HttpURLConnection;
2627
import java.net.URL;
2728

28-
/**
29+
/*
2930
* Makes requests to the Optly CDN to get the data file
3031
*/
3132
class DataFileClient {

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileLoadedListener.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

19+
/**
20+
* Listens for new Optimizely datafiles
21+
*
22+
* @hide
23+
*/
1824
interface DataFileLoadedListener {
1925

26+
/**
27+
* Called with new datafile
28+
*
29+
* @param dataFile the datafile json
30+
* @hide
31+
*/
2032
void onDataFileLoaded(String dataFile);
2133
}

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.os.AsyncTask;
@@ -30,7 +31,7 @@
3031
import java.util.concurrent.Executor;
3132
import java.util.concurrent.Executors;
3233

33-
/**
34+
/*
3435
* Handles intents and bindings in {@link DataFileService}
3536
*/
3637
class DataFileLoader {

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileRescheduler.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.content.BroadcastReceiver;
@@ -27,6 +28,12 @@
2728

2829
import java.util.List;
2930

31+
/**
32+
* Broadcast Receiver that handles app upgrade and phone restart broadcasts in order
33+
* to reschedule {@link DataFileService}
34+
*
35+
* @hide
36+
*/
3037
public class DataFileRescheduler extends BroadcastReceiver {
3138
Logger logger = LoggerFactory.getLogger(DataFileRescheduler.class);
3239

@@ -49,7 +56,7 @@ public void onReceive(Context context, Intent intent) {
4956
}
5057
}
5158

52-
/**
59+
/*
5360
* Handles building sending Intents to {@link DataFileService}
5461
*
5562
* This abstraction mostly makes unit testing easier

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileService.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package com.optimizely.ab.android.sdk;
1718

1819
import android.app.Service;
@@ -26,12 +27,21 @@
2627
import org.slf4j.Logger;
2728
import org.slf4j.LoggerFactory;
2829

30+
/**
31+
* Service that handles loading the datafile from cache or downloads it from the CDN
32+
*
33+
* @hide
34+
*/
2935
public class DataFileService extends Service {
30-
public static final String EXTRA_PROJECT_ID = "com.optimizely.ab.android.EXTRA_PROJECT_ID";
36+
static final String EXTRA_PROJECT_ID = "com.optimizely.ab.android.EXTRA_PROJECT_ID";
3137
@NonNull private final IBinder binder = new LocalBinder();
3238
Logger logger = LoggerFactory.getLogger(getClass());
3339
private boolean isBound;
3440

41+
/**
42+
* @hide
43+
* @see Service#onStartCommand(Intent, int, int)
44+
*/
3545
@Override
3646
public int onStartCommand(Intent intent, int flags, int startId) {
3747
if (intent != null) {
@@ -54,12 +64,20 @@ public int onStartCommand(Intent intent, int flags, int startId) {
5464
return super.onStartCommand(intent, flags, startId);
5565
}
5666

67+
/**
68+
* @hide
69+
* @see Service#onBind(Intent)
70+
*/
5771
@Override
5872
public IBinder onBind(Intent intent) {
5973
isBound = true;
6074
return binder;
6175
}
6276

77+
/**
78+
* @hide
79+
* @see Service#onUnbind(Intent)
80+
*/
6381
@Override
6482
public boolean onUnbind(Intent intent) {
6583
isBound = false;
@@ -80,7 +98,7 @@ void getDataFile(String projectId, DataFileLoader dataFileLoader, DataFileLoaded
8098
}
8199

82100
class LocalBinder extends Binder {
83-
public DataFileService getService() {
101+
DataFileService getService() {
84102
// Return this instance of LocalService so clients can call public methods
85103
return DataFileService.this;
86104
}

0 commit comments

Comments
 (0)