Skip to content

Commit

Permalink
Merge pull request #100 from victordiaz/develop
Browse files Browse the repository at this point in the history
Version 1.4.2
  • Loading branch information
victordiaz authored Apr 2, 2021
2 parents 713f415 + 5ea5803 commit 73d4e40
Show file tree
Hide file tree
Showing 34 changed files with 554 additions and 209 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ buildscript {
}

project.ext {
versionCode = 141
versionName = "1.4.1"
versionCode = 142
versionName = "1.4.2"
compileSdkVersion = 30
targetSdkVersion = 29
minSdkVersion = 16
Expand Down
31 changes: 29 additions & 2 deletions phonk_app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,39 @@
</intent-filter>
</service>

<receiver android:name="io.phonk.server.PhonkBootReceiver">
<receiver android:enabled="true" android:name="io.phonk.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>

<activity
android:name="io.phonk.SharingDispatcherActivity"
android:theme="@style/Transparent"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>


<!-- New signature permission to ensure only systemui can bind to these services -->
<service android:name="io.phonk.MyCustomControlService" android:label="@string/app_name"
android:permission="android.permission.BIND_CONTROLS">
Expand Down
6 changes: 6 additions & 0 deletions phonk_app/src/main/assets/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.4.2
- Small WebEditor color tweaks
- Scripts can now receive text and urls from other apps using the Android Share menu. Check the example in Device > Share
- Easier way to select script that can start when the device boots
- MQTT API with options to set the will message, connection timeout and clean session

1.4.1
- Support of let, const and fat arrows
- Help section list links to Forum and Discord
Expand Down
11 changes: 5 additions & 6 deletions phonk_app/src/main/java/io/phonk/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import androidx.multidex.MultiDexApplication;

import io.phonk.gui.connectionInfo.EventManager;
import io.phonk.runner.base.utils.TimerUtils;

public class App extends MultiDexApplication {

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

MultiDex.install(this);

TimerUtils.start();
TimerUtils.stamp("start");
TimerUtils.stamp("MultiDex.install");
// TimerUtils.start();
// TimerUtils.stamp("start");
// TimerUtils.stamp("MultiDex.install");

myLifecycleHandler = new MyLifecycleHandler();
TimerUtils.stamp("MyLifecycleHandler");
// TimerUtils.stamp("MyLifecycleHandler");

registerActivityLifecycleCallbacks(myLifecycleHandler);
TimerUtils.stamp("registerActivityLifecycleCallbacks");
// TimerUtils.stamp("registerActivityLifecycleCallbacks");

if (!(Thread.getDefaultUncaughtExceptionHandler() instanceof PhonkExceptionHandler)) {
Thread.setDefaultUncaughtExceptionHandler(new PhonkExceptionHandler());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,43 @@
*
*/

package io.phonk.server;
package io.phonk;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import io.phonk.MainActivity;
import io.phonk.gui.settings.UserPreferences;
import io.phonk.helpers.PhonkAppHelper;
import io.phonk.runner.AppRunnerActivity;
import io.phonk.runner.base.models.Project;
import io.phonk.runner.base.utils.MLog;

public class PhonkBootReceiver extends BroadcastReceiver {
public class BootReceiver extends BroadcastReceiver {

private static final String TAG = PhonkBootReceiver.class.getSimpleName();
private static final String TAG = BootReceiver.class.getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
if ((boolean) UserPreferences.getInstance().get("launch_on_device_boot")) {
MLog.d(TAG, "launching Protocoder on boot");
Intent in = new Intent(context, MainActivity.class);
MLog.d(TAG, "launching PHONK on boot");
Intent in = new Intent(context, LauncherActivity.class);
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(in);
}

String scriptToLaunch = (String) UserPreferences.getInstance().get("launch_script_on_boot");

if (!scriptToLaunch.isEmpty()) {
// PhonkAppHelper.launchScript(context, new Project(scriptToLaunch));

Project p = new Project(scriptToLaunch);
Intent newIntent = new Intent(context, AppRunnerActivity.class);
newIntent.putExtra("projectName", p.getName());
newIntent.putExtra("projectFolder", p.getFolder());
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(newIntent);
}
}
}
1 change: 1 addition & 0 deletions phonk_app/src/main/java/io/phonk/LauncherActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void onCreate(Bundle savedInstanceState) {
} else {
intent = new Intent(this, MainActivity.class);
// intent = new Intent(this, NewMainActivity.class);
// intent = new Intent(this, SharingDispatcherActivity.class);
// intent = new Intent(this, SettingsActivity.class);
// intent.putExtras();
}
Expand Down
15 changes: 14 additions & 1 deletion phonk_app/src/main/java/io/phonk/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
package io.phonk;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -151,7 +153,13 @@ protected void onCreate(Bundle savedInstanceState) {
PhonkAppHelper.launchScript(this, p);
}

// PhonkAppHelper.launchScript(this, new Project("playground/User Projects/grid"));
// ComponentName component = new ComponentName("com.xxx.launcher.desktop", "com.xxx.launcher.desktop.testActivity");
// getPackageManager().setComponentEnabledSetting(component, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

HashMap<String, String> extras = new HashMap<>();
extras.put("qq1", "1");
extras.put("qq2", "2");
// PhonkAppHelper.launchScript(this, new Project("playground/User Projects/activity"), extras);
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Basic Views"));
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Styling & Theming"));
// PhonkAppHelper.launchScript(this, new Project("examples/Graphical User Interface/Extra Views"));
Expand Down Expand Up @@ -210,6 +218,11 @@ public void onProjectSelected(Project p) {
@Override
public void onMultipleProjectsSelected(HashMap<Project, Boolean> projects) {
}

@Override
public void onActionClicked(String action) {

}
});

// Create Fragments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import io.reactivex.Flowable;
import io.reactivex.processors.ReplayProcessor;

public class MyCustomControlService extends ControlsProviderService {
public class MyCustomControlService extends ControlsProviderService {
private ReplayProcessor updatePublisher;

@Override
Expand Down
17 changes: 12 additions & 5 deletions phonk_app/src/main/java/io/phonk/NewMainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;

import androidx.fragment.app.FragmentManager;

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

FragmentManager fm = getSupportFragmentManager();

setContentView(R.layout.new_main_activity);

Button btn = findViewById(R.id.btnOpenProjectBrowser);
ProjectBrowserDialogFragment projectBrowserDialogFragment = ProjectBrowserDialogFragment.newInstance(ProjectItem.MODE_MULTIPLE_PICK);

FragmentManager fm = getSupportFragmentManager();
ProjectBrowserDialogFragment projectBrowserDialogFragment = ProjectBrowserDialogFragment.newInstance(ProjectItem.MODE_SINGLE_PICK);

projectBrowserDialogFragment.setListener(new ProjectListFragment.ProjectSelectedListener() {
@Override
public void onProjectSelected(Project p) {
MLog.d("qq", "project clicked " + p.getFullPath());
projectBrowserDialogFragment.dismiss();
Toast.makeText(getApplicationContext(), "Sending to " + p.getFullPath(), Toast.LENGTH_LONG).show();
}

@Override
public void onMultipleProjectsSelected(HashMap<Project, Boolean> projects) {
for (Map.Entry<Project, Boolean> entry : projects.entrySet()) {
Project project = entry.getKey();
boolean selection = entry.getValue();
MLog.d("qq2", "selected " + project.getFullPath());
}
}

@Override
public void onActionClicked(String action) {

}
});

btn.setOnClickListener(view -> {
Expand Down
91 changes: 0 additions & 91 deletions phonk_app/src/main/java/io/phonk/ProtoContentProvider2.java

This file was deleted.

Loading

0 comments on commit 73d4e40

Please sign in to comment.