Skip to content

Commit

Permalink
Merge pull request #80 from victordiaz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
victordiaz authored Aug 29, 2020
2 parents 204a461 + 63b3584 commit 9474d9b
Show file tree
Hide file tree
Showing 41 changed files with 702 additions and 375 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ buildscript {
}

project.ext {
versionCode = 131
versionName = "1.2.9"
versionCode = 132
versionName = "1.3.0"
compileSdkVersion = 29
targetSdkVersion = 29
minSdkVersion = 16
}

task hello {
Expand Down
6 changes: 3 additions & 3 deletions phonk_app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ android {
// flavorDimensions "default"
flavorDimensions "version"

compileSdkVersion 29
compileSdkVersion project.compileSdkVersion

defaultConfig {
applicationId "io.phonk"
minSdkVersion 16
targetSdkVersion 29
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion

versionCode project.versionCode
versionName project.versionName
Expand Down
12 changes: 12 additions & 0 deletions phonk_app/src/main/assets/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
1.3.0
- WebEditor fixes when previewing a file
- added onPress and onLongPress callbacks in buttons
- wifiScan returns now a proper Javascript object
- Refactor IOIO's and Serial API
- Better color defaults when creating scripts
- Looper has a better behavior
- Knob & Slider have a onRelease callback
- Improved Websockets API
- new MQTT callbacks
- better webview example on how to interface with PHONK's api

1.2.9
- Toggle state order are fixed
- Camera methods changed to fix callbacks
Expand Down
2 changes: 2 additions & 0 deletions phonk_app/src/main/java/io/phonk/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ protected void onResume() {
Intent i = new Intent("io.phonk.intent.CLOSED");
sendBroadcast(i);
registerReceiver(connectivityChangeReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));

mHeader.setAlpha(1.0f);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion phonk_app/src/main/res/drawable/gray_box_bg_solid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<shape android:shape="rectangle">
<solid android:color="@color/phonk_backgroundColor" />
<corners android:radius="0dp" />
<stroke android:width="1dp" android:color="@color/phonk_colorSecondary_shade_1"/>
<stroke android:width="1dp" android:color="@color/phonk_colorPrimary_shade"/>
<size android:width="45dp"></size>
<size android:height="45dp"></size>
</shape>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:radius="0dp" />
<stroke android:width="1dp" android:color="@color/phonk_colorSecondary_shade_1"/>
<stroke android:width="1dp" android:color="@color/phonk_colorPrimary_shade"/>
</shape>
</item>

Expand Down
2 changes: 1 addition & 1 deletion phonk_app/src/main/res/drawable/project_list_item_icon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<item android:left="0dp" android:right="0dp">
<shape android:shape="rectangle">
<corners android:radius="0dp" />
<stroke android:width="1dp" android:color="@color/phonk_colorPrimary_shade_1"/>
<stroke android:width="1dp" android:color="@color/phonk_colorPrimary_shade"/>
<size android:width="45dp"></size>
<size android:height="45dp"></size>
</shape>
Expand Down
5 changes: 3 additions & 2 deletions phonk_app/src/main/res/layout/infoscript_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
android:id="@+id/properties_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:padding="15dp"></LinearLayout>
android:padding="15dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"></LinearLayout>
</ScrollView>

</RelativeLayout>
2 changes: 1 addition & 1 deletion phonk_app/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
android:layout_marginLeft="100dp"
android:layout_marginTop="10dp"
android:layout_marginRight="100dp"
android:background="@color/phonk_colorSecondary_shade_1" />
android:background="@color/phonk_colorPrimary_shade" />

</RelativeLayout>

Expand Down
16 changes: 10 additions & 6 deletions phonk_app/src/main/res/menu/project_actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
<item android:id="@+id/menu_project_list_edit"
android:icon="@drawable/phonk_icon"
android:title="@string/edit" />
<item android:id="@+id/menu_project_webeditor"
android:icon="@drawable/phonk_icon"
android:title="@string/webeditor" />
<item
android:id="@+id/menu_project_webeditor"
android:enabled="false"
android:icon="@drawable/phonk_icon"
android:title="@string/webeditor" />
<item android:id="@+id/menu_project_list_delete"
android:icon="@drawable/phonk_icon"
android:title="@string/delete" />
Expand All @@ -40,9 +42,11 @@
<item android:id="@+id/menu_project_list_share_with"
android:icon="@drawable/phonk_icon"
android:title="@string/share" />
<item android:id="@+id/menu_project_list_share_proto_file"
android:icon="@drawable/phonk_icon"
android:title="@string/share_phonk_file" />
<item
android:id="@+id/menu_project_list_share_proto_file"
android:enabled="false"
android:icon="@drawable/phonk_icon"
android:title="@string/share_phonk_file" />
<item android:id="@+id/menu_project_list_show_info"
android:icon="@drawable/phonk_icon"
android:title="@string/show_project_info" />
Expand Down
10 changes: 7 additions & 3 deletions phonk_apprunner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ apply plugin: 'com.android.library'
android {
flavorDimensions "default_apprunner"

compileSdkVersion 29
compileSdkVersion project.compileSdkVersion

defaultPublishConfig "normalrunnerDebug"
publishNonDefault true

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion

versionCode project.versionCode
versionName project.versionName
Expand Down Expand Up @@ -105,6 +105,10 @@ dependencies {

// hardware stuff
api group: 'com.github.ytai.ioio', name: 'IOIOLibAndroid', version: '5.07'
api group: 'com.github.ytai.ioio', name: 'IOIOLibCore', version: '5.07'
api group: 'com.github.ytai.ioio', name: 'IOIOLibAndroidBluetooth', version: '5.07'
api group: 'com.github.ytai.ioio', name: 'IOIOLibAndroidAccessory', version: '5.07'
api group: 'com.github.ytai.ioio', name: 'IOIOLibAndroidDevice', version: '5.07'
implementation 'com.github.felHR85:UsbSerial:6.1.0'
api 'jp.kshoji:midi-driver:0.1.4:@aar'

Expand Down
2 changes: 0 additions & 2 deletions phonk_apprunner/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
android:allowBackup="false"
android:hardwareAccelerated="true">

<!--android:autoRemoveFromRecents="true"-->

<activity
android:name="io.phonk.runner.AppRunnerActivity"
android:process=":AppRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ private static void resetValues(Map<String, Object> map) {
// fill with default properties
if (!map.containsKey("name")) map.put("name", "");
if (!map.containsKey("description")) map.put("description", "portrait");
if (!map.containsKey("icon")) map.put("icon", "portrait");
if (!map.containsKey("icon")) map.put("icon", "");
if (!map.containsKey("window_size")) map.put("window_size", "");
if (!map.containsKey("orientation")) map.put("orientation", "current");
if (!map.containsKey("screen_mode")) map.put("screen_mode", "normal");
if (!map.containsKey("featured_image")) map.put("featured_image", "");
if (!map.containsKey("background_service")) map.put("background_service", false);
if (!map.containsKey("protocoder_version")) map.put("protocoder_version", "");
if (!map.containsKey("phonk_version")) map.put("phonk_version", "");
if (!map.containsKey("permissions")) map.put("permissions", "");
if (!map.containsKey("author")) map.put("author", "");
if (!map.containsKey("contact")) map.put("contact", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void finish() {
@PhonkMethod
public void eval(final String code) {
runOnUiThread(r -> {
// getAppRunner().interp.eval(code);
getAppRunner().interp.eval(code);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.phonk.runner.apprunner.AppRunner;
import io.phonk.runner.apprunner.api.boards.PIOIO;
import io.phonk.runner.apprunner.api.boards.PSerial;
import io.phonk.runner.apprunner.api.common.ReturnInterface;

@PhonkObject
public class PBoards extends ProtoBase {
Expand All @@ -38,20 +39,15 @@ public PBoards(AppRunner appRunner) {
super(appRunner);
}


@PhonkMethod(description = "initializes the ioio board", example = "")
@PhonkMethodParam(params = {"function()"})
public PIOIO connectIOIO(PIOIO.startCB callbackfn) {
public PIOIO createIOIO() {
PIOIO ioio = new PIOIO(getAppRunner());
ioio.start(callbackfn);

return ioio;
}

@PhonkMethod(description = "initializes serial communication", example = "")
@PhonkMethodParam(params = {"bauds", "function()"})
public PSerial createSerial(int bauds) {
PSerial serial = new PSerial(getAppRunner());
PSerial serial = new PSerial(getAppRunner(), bauds);
return serial;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package io.phonk.runner.apprunner.api;

import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
Expand All @@ -36,6 +37,7 @@
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.CellInfo;
import android.telephony.TelephonyManager;
import android.util.Log;

Expand All @@ -50,6 +52,7 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
Expand Down Expand Up @@ -586,12 +589,10 @@ public String getNetworkType() {
return type;
}

// http://stackoverflow.com/questions/8818290/how-to-connect-to-mContext-specific-wifi-network-in-android-programmatically

@PhonkMethod(description = "Connect to a given Wifi network with mContext given 'wpa', 'wep', 'open' type and mContext password", example = "")
// http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically
@PhonkMethod(description = "Connect to a given Wifi network with a given 'wpa', 'wep', 'open' type and mContext password", example = "")
@PhonkMethodParam(params = {"ssidName", "type", "password"})
public void connectWifi(String networkSSID, String type, String networkPass) {

WifiConfiguration conf = new WifiConfiguration();
conf.SSID = "\"" + networkSSID + "\""; // Please note the quotes. String
// should contain ssid in quotes
Expand Down Expand Up @@ -623,11 +624,9 @@ public void connectWifi(String networkSSID, String type, String networkPass) {
break;
}
}

}

private Object mIsWifiAPEnabled = true;

private boolean mIsWifiAPEnabled = true;

@PhonkMethod(description = "Enable/Disable a Wifi access point", example = "")
@PhonkMethodParam(params = {"AP name, enabled"})
Expand Down Expand Up @@ -675,7 +674,7 @@ public void onReceive(Context c, Intent intent) {
final PhonkNativeArray valuesArray = new PhonkNativeArray(0);
for (int i = 0; i < results.size(); i++) {

HashMap<String, Object> result = new HashMap<>();
ReturnObject result = new ReturnObject();

result.put("SSID", results.get(i).SSID);
result.put("BSSID", results.get(i).BSSID);
Expand Down Expand Up @@ -705,6 +704,23 @@ public void onReceive(Context c, Intent intent) {
getAppRunner().getAppContext().registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
}

/*
@SuppressLint("MissingPermission")
public void getCellNeightbours() {
TelephonyManager manager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfoList = new ArrayList<>();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return cellInfoList;
}
cellInfoList = manager.getAllCellInfo();
if (cellInfoList != null) {
for (CellInfo info : cellInfoList) {
//
}
}
}
*/

// --------- RegisterServiceCB ---------//
public interface RegisterServiceCB {
void event();
Expand Down
Loading

0 comments on commit 9474d9b

Please sign in to comment.