Skip to content

Commit 73d4e40

Browse files
authored
Merge pull request #100 from victordiaz/develop
Version 1.4.2
2 parents 713f415 + 5ea5803 commit 73d4e40

34 files changed

Lines changed: 554 additions & 209 deletions

‎build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ buildscript {
1010
}
1111

1212
project.ext {
13-
versionCode = 141
14-
versionName = "1.4.1"
13+
versionCode = 142
14+
versionName = "1.4.2"
1515
compileSdkVersion = 30
1616
targetSdkVersion = 29
1717
minSdkVersion = 16

‎phonk_app/src/main/AndroidManifest.xml‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,39 @@
187187
</intent-filter>
188188
</service>
189189

190-
<receiver android:name="io.phonk.server.PhonkBootReceiver">
190+
<receiver android:enabled="true" android:name="io.phonk.BootReceiver">
191191
<intent-filter>
192-
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
192+
<category android:name="android.intent.category.DEFAULT" />
193+
<action android:name="android.intent.action.BOOT_COMPLETED" />
194+
<action android:name="android.intent.action.ACTION_BOOT_COMPLETED" />
195+
<action android:name="android.intent.action.REBOOT" />
196+
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
197+
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
193198
</intent-filter>
194199
</receiver>
195200

201+
<activity
202+
android:name="io.phonk.SharingDispatcherActivity"
203+
android:theme="@style/Transparent"
204+
android:excludeFromRecents="true">
205+
<intent-filter>
206+
<action android:name="android.intent.action.SEND" />
207+
<category android:name="android.intent.category.DEFAULT" />
208+
<data android:mimeType="image/*" />
209+
</intent-filter>
210+
<intent-filter>
211+
<action android:name="android.intent.action.SEND" />
212+
<category android:name="android.intent.category.DEFAULT" />
213+
<data android:mimeType="text/*" />
214+
</intent-filter>
215+
<intent-filter>
216+
<action android:name="android.intent.action.SEND_MULTIPLE" />
217+
<category android:name="android.intent.category.DEFAULT" />
218+
<data android:mimeType="image/*" />
219+
</intent-filter>
220+
</activity>
221+
222+
196223
<!-- New signature permission to ensure only systemui can bind to these services -->
197224
<service android:name="io.phonk.MyCustomControlService" android:label="@string/app_name"
198225
android:permission="android.permission.BIND_CONTROLS">

‎phonk_app/src/main/assets/changelog.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.4.2
2+
- Small WebEditor color tweaks
3+
- Scripts can now receive text and urls from other apps using the Android Share menu. Check the example in Device > Share
4+
- Easier way to select script that can start when the device boots
5+
- MQTT API with options to set the will message, connection timeout and clean session
6+
17
1.4.1
28
- Support of let, const and fat arrows
39
- Help section list links to Forum and Discord

‎phonk_app/src/main/java/io/phonk/App.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import androidx.multidex.MultiDexApplication;
2727

2828
import io.phonk.gui.connectionInfo.EventManager;
29-
import io.phonk.runner.base.utils.TimerUtils;
3029

3130
public class App extends MultiDexApplication {
3231

@@ -39,15 +38,15 @@ public void onCreate() {
3938

4039
MultiDex.install(this);
4140

42-
TimerUtils.start();
43-
TimerUtils.stamp("start");
44-
TimerUtils.stamp("MultiDex.install");
41+
// TimerUtils.start();
42+
// TimerUtils.stamp("start");
43+
// TimerUtils.stamp("MultiDex.install");
4544

4645
myLifecycleHandler = new MyLifecycleHandler();
47-
TimerUtils.stamp("MyLifecycleHandler");
46+
// TimerUtils.stamp("MyLifecycleHandler");
4847

4948
registerActivityLifecycleCallbacks(myLifecycleHandler);
50-
TimerUtils.stamp("registerActivityLifecycleCallbacks");
49+
// TimerUtils.stamp("registerActivityLifecycleCallbacks");
5150

5251
if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof PhonkExceptionHandler)) {
5352
Thread.setDefaultUncaughtExceptionHandler(new PhonkExceptionHandler());

phonk_app/src/main/java/io/phonk/server/PhonkBootReceiver.java renamed to phonk_app/src/main/java/io/phonk/BootReceiver.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,43 @@
2020
*
2121
*/
2222

23-
package io.phonk.server;
23+
package io.phonk;
2424

2525
import android.content.BroadcastReceiver;
2626
import android.content.Context;
2727
import android.content.Intent;
28+
import android.widget.Toast;
2829

29-
import io.phonk.MainActivity;
3030
import io.phonk.gui.settings.UserPreferences;
31+
import io.phonk.helpers.PhonkAppHelper;
32+
import io.phonk.runner.AppRunnerActivity;
33+
import io.phonk.runner.base.models.Project;
3134
import io.phonk.runner.base.utils.MLog;
3235

33-
public class PhonkBootReceiver extends BroadcastReceiver {
36+
public class BootReceiver extends BroadcastReceiver {
3437

35-
private static final String TAG = PhonkBootReceiver.class.getSimpleName();
38+
private static final String TAG = BootReceiver.class.getSimpleName();
3639

3740
@Override
3841
public void onReceive(Context context, Intent intent) {
3942
if ((boolean) UserPreferences.getInstance().get("launch_on_device_boot")) {
40-
MLog.d(TAG, "launching Protocoder on boot");
41-
Intent in = new Intent(context, MainActivity.class);
43+
MLog.d(TAG, "launching PHONK on boot");
44+
Intent in = new Intent(context, LauncherActivity.class);
4245
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
4346
context.startActivity(in);
4447
}
48+
49+
String scriptToLaunch = (String) UserPreferences.getInstance().get("launch_script_on_boot");
50+
51+
if (!scriptToLaunch.isEmpty()) {
52+
// PhonkAppHelper.launchScript(context, new Project(scriptToLaunch));
53+
54+
Project p = new Project(scriptToLaunch);
55+
Intent newIntent = new Intent(context, AppRunnerActivity.class);
56+
newIntent.putExtra("projectName", p.getName());
57+
newIntent.putExtra("projectFolder", p.getFolder());
58+
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
59+
context.startActivity(newIntent);
60+
}
4561
}
4662
}

‎phonk_app/src/main/java/io/phonk/LauncherActivity.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public void onCreate(Bundle savedInstanceState) {
7070
} else {
7171
intent = new Intent(this, MainActivity.class);
7272
// intent = new Intent(this, NewMainActivity.class);
73+
// intent = new Intent(this, SharingDispatcherActivity.class);
7374
// intent = new Intent(this, SettingsActivity.class);
7475
// intent.putExtras();
7576
}

‎phonk_app/src/main/java/io/phonk/MainActivity.java‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
package io.phonk;
2424

2525
import android.content.BroadcastReceiver;
26+
import android.content.ComponentName;
2627
import android.content.Context;
2728
import android.content.Intent;
2829
import android.content.IntentFilter;
30+
import android.content.pm.PackageManager;
2931
import android.net.ConnectivityManager;
3032
import android.os.Build;
3133
import android.os.Bundle;
@@ -151,7 +153,13 @@ protected void onCreate(Bundle savedInstanceState) {
151153
PhonkAppHelper.launchScript(this, p);
152154
}
153155

154-
// PhonkAppHelper.launchScript(this, new Project("playground/User Projects/grid"));
156+
// ComponentName component = new ComponentName("com.xxx.launcher.desktop", "com.xxx.launcher.desktop.testActivity");
157+
// getPackageManager().setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
158+
159+
HashMap<String, String> extras = new HashMap<>();
160+
extras.put("qq1", "1");
161+
extras.put("qq2", "2");
162+
// PhonkAppHelper.launchScript(this, new Project("playground/User Projects/activity"), extras);
155163
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Basic Views"));
156164
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Styling & Theming"));
157165
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Extra Views"));
@@ -210,6 +218,11 @@ public void onProjectSelected(Project p) {
210218
@Override
211219
public void onMultipleProjectsSelected(HashMap<Project, Boolean> projects) {
212220
}
221+
222+
@Override
223+
public void onActionClicked(String action) {
224+
225+
}
213226
});
214227

215228
// Create Fragments

‎phonk_app/src/main/java/io/phonk/MyCustomControlService.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import io.reactivex.Flowable;
5858
import io.reactivex.processors.ReplayProcessor;
5959

60-
public class MyCustomControlService extends ControlsProviderService {
60+
public class MyCustomControlService extends ControlsProviderService {
6161
private ReplayProcessor updatePublisher;
6262

6363
@Override

‎phonk_app/src/main/java/io/phonk/NewMainActivity.java‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import android.os.Bundle;
2626
import android.widget.Button;
27+
import android.widget.Toast;
2728

2829
import androidx.fragment.app.FragmentManager;
2930

@@ -43,26 +44,32 @@ public class NewMainActivity extends BaseActivity {
4344
protected void onCreate(Bundle savedInstanceState) {
4445
super.onCreate(savedInstanceState);
4546

46-
FragmentManager fm = getSupportFragmentManager();
47-
4847
setContentView(R.layout.new_main_activity);
48+
4949
Button btn = findViewById(R.id.btnOpenProjectBrowser);
50-
ProjectBrowserDialogFragment projectBrowserDialogFragment = ProjectBrowserDialogFragment.newInstance(ProjectItem.MODE_MULTIPLE_PICK);
50+
51+
FragmentManager fm = getSupportFragmentManager();
52+
ProjectBrowserDialogFragment projectBrowserDialogFragment = ProjectBrowserDialogFragment.newInstance(ProjectItem.MODE_SINGLE_PICK);
5153

5254
projectBrowserDialogFragment.setListener(new ProjectListFragment.ProjectSelectedListener() {
5355
@Override
5456
public void onProjectSelected(Project p) {
55-
MLog.d("qq", "project clicked " + p.getFullPath());
57+
projectBrowserDialogFragment.dismiss();
58+
Toast.makeText(getApplicationContext(), "Sending to " + p.getFullPath(), Toast.LENGTH_LONG).show();
5659
}
5760

5861
@Override
5962
public void onMultipleProjectsSelected(HashMap<Project, Boolean> projects) {
6063
for (Map.Entry<Project, Boolean> entry : projects.entrySet()) {
6164
Project project = entry.getKey();
6265
boolean selection = entry.getValue();
63-
MLog.d("qq2", "selected " + project.getFullPath());
6466
}
6567
}
68+
69+
@Override
70+
public void onActionClicked(String action) {
71+
72+
}
6673
});
6774

6875
btn.setOnClickListener(view -> {

‎phonk_app/src/main/java/io/phonk/ProtoContentProvider2.java‎

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)