Skip to content

Commit fa1ea2b

Browse files
authored
Merge pull request #56 from victordiaz/develop
1.2.7
2 parents 98205d2 + 7a3b2fe commit fa1ea2b

File tree

73 files changed

+1213
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1213
-586
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ buildscript {
1010
}
1111

1212
project.ext {
13-
versionCode = 126
14-
versionName = "1.2.6-alpha-3"
13+
versionCode = 127
14+
versionName = "1.2.7"
1515
}
1616

1717
task hello {

phonk_app/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
1111

1212
android {
1313
// flavorDimensions "normal", "extended"
14-
flavorDimensions "default"
14+
// flavorDimensions "default"
15+
flavorDimensions "version"
1516

1617
compileSdkVersion 29
1718

@@ -61,11 +62,13 @@ android {
6162
productFlavors {
6263
normal {
6364
applicationId "io.phonk"
65+
dimension "version"
6466
versionName project.versionName + "_normal"
6567
}
6668

6769
extended {
6870
applicationId "io.phonk.extended"
71+
dimension "version"
6972
versionName project.versionName + "_extended"
7073
}
7174
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<!--
23
~ Part of Phonk http://www.phonk.io
34
~ A prototyping platform for Android devices
@@ -6,7 +7,7 @@
67
~ Copyright (C) 2017 - Victor Diaz Barrales @victordiaz (Phonk)
78
~
89
~ Phonk is free software: you can redistribute it and/or modify
9-
~ it under the terms of the GNU Lesser General Public License as published by
10+
~ it under the terms of the GNU General Public License as published by
1011
~ the Free Software Foundation, either version 3 of the License, or
1112
~ (at your option) any later version.
1213
~
@@ -15,14 +16,12 @@
1516
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1617
~ GNU General Public License for more details.
1718
~
18-
~ You should have received a copy of the GNU Lesser General Public License
19+
~ You should have received a copy of the GNU General Public License
1920
~ along with Phonk. If not, see <http://www.gnu.org/licenses/>.
2021
~
2122
-->
2223

23-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
24-
package="io.phonk.runner">
25-
26-
<uses-permission android:name="android.permission.SEND_SMS" />
27-
<uses-permission android:name="android.permission.CALL_PHONE" />
24+
<manifest
25+
xmlns:android="http://schemas.android.com/apk/res/android"
26+
xmlns:tools="http://schemas.android.com/tools">
2827
</manifest>

phonk_app/src/main/AndroidManifest.xml

+7-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@
5858
</intent-filter>
5959
<intent-filter>
6060
<action android:name="android.intent.action.ASSIST" />
61-
<category android:name="android.intent.category.DEFAULT" >
62-
</category>
61+
<category android:name="android.intent.category.DEFAULT" />
6362
</intent-filter>
6463
</activity>
6564

@@ -136,6 +135,11 @@
136135
android:theme="@style/PhonkAppTheme"
137136
android:label="About" >
138137
</activity>
138+
<activity
139+
android:name="io.phonk.gui.UpdateActivity"
140+
android:theme="@style/PhonkAppTheme"
141+
android:label="PHONK Update" >
142+
</activity>
139143
<activity
140144
android:name="io.phonk.gui.InfoScriptActivity"
141145
android:theme="@style/PhonkAppTheme"
@@ -202,7 +206,7 @@
202206
-->
203207

204208
</application>
209+
205210
<uses-permission android:name="android.permission.INTERNET" />
206211
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
207-
208212
</manifest>
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
1.2.7
2+
- Better notifications in WebEditor
3+
- Better NFC handling
4+
- Bluetooth LE can disconnect properly
5+
- About section included
6+
- Update screen (this!) included
7+
- HTTP server can serve images to Web editor console
8+
- Sending SMS works again
9+
- Add app.finish() method
10+
- Check bluetooth and sensors availability
11+
- Remove unused desktop widget
12+
- Updated some examples that did not work correctly
13+
14+
1.2.5
15+
- This should fix a problem on devices Android < 5.0 where views such Buttons, Texts, etc don't appear correctly
16+
- Fix lat/lon swap when adding marker in maps
17+
- Fix user input in MQTT
18+
- Removed staggered animation on UI load
19+
- Better theming
20+
- Min requirement is 4.1 now
21+
22+
1.2.3
23+
- Fix buttons not appearing on installation
24+
- Better alignment in tablets
25+
- Fix crash on Edit
26+
- Added better way for customizing views (there is not example yet)
27+
- Remove vibration on app load
28+
- APK is now half the size
29+
- Updated some dependencies
30+
- Slider has a way to change only on drag
31+
32+
1.2.2
33+
- Update MQTT library with Eclipse Paho
34+
- Improved connection info layout
35+
- Added onClick event on map markers
36+
- User projects not visible is folder is empty
37+
38+
1.2.0
39+
- Lot's of cosmetic changes in PHONK
40+
- API tweaks and improvements
41+
- New website
42+
- Now released as well in Google Play Store

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import android.os.Bundle;
2929
import android.widget.Toast;
3030

31+
import io.phonk.gui.AboutActivity;
32+
import io.phonk.gui.UpdateActivity;
33+
3134
public class LauncherActivity extends Activity {
3235

3336
Intent intent = null;
@@ -39,21 +42,29 @@ public void onCreate(Bundle savedInstanceState) {
3942

4043
// this Activity chooses between launching the welcome installer
4144
// or the app it self
42-
4345
SharedPreferences userDetails = getSharedPreferences("io.phonk", MODE_PRIVATE);
4446
boolean firstLaunch = userDetails.getBoolean(getResources().getString(R.string.pref_is_first_launch), true);
4547

4648
// uncomment to reset (true) first launch
4749
// userDetails.edit().putBoolean(getResources().getString(R.string.pref_is_first_launch), true).commit();
50+
// userDetails.edit().putInt("last_version_reinstalled", 126).commit();
4851

4952
Intent i = getIntent();
5053
boolean wasCrash = i.getBooleanExtra("wasCrash", false);
5154
if (wasCrash) {
5255
Toast.makeText(this, "The script crashed :(", Toast.LENGTH_LONG).show();
5356
}
5457

58+
/*
59+
* Launch WelcomeActivity if first time
60+
* Launch Update if there is a higher version code
61+
* or Launch the MainApp
62+
*/
5563
if (firstLaunch) {
5664
intent = new Intent(this, WelcomeActivity.class);
65+
} else if (BuildConfig.VERSION_CODE > userDetails.getInt("last_version_reinstalled", 125)) {
66+
// Toast.makeText(this, "this needs to update", Toast.LENGTH_LONG).show();
67+
intent = new Intent(this, UpdateActivity.class);
5768
} else {
5869
intent = new Intent(this, MainActivity.class);
5970
// intent.putExtras();

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.content.Context;
2727
import android.content.Intent;
2828
import android.content.IntentFilter;
29+
import android.content.SharedPreferences;
2930
import android.content.res.Configuration;
3031
import android.net.ConnectivityManager;
3132
import android.os.Bundle;
@@ -127,6 +128,7 @@ protected void onCreate(Bundle savedInstanceState) {
127128

128129
mAppRunner = new AppRunnerCustom(this);
129130
mAppRunner.initDefaultObjects(AppRunnerHelper.createSettings()).initInterpreter();
131+
130132
// PhonkApp phonkApp = new PhonkApp(mAppRunner);
131133
// phonkApp.network.checkVersion();
132134
// mAppRunner.interp.eval("device.vibrate(100);");
@@ -331,7 +333,7 @@ public void onPageScrollStateChanged(int state) {
331333
PhonkAppHelper.launchHelp(MainActivity.this);
332334
return true;
333335
} else if (itemId == R.id.more_options_about) {
334-
PhonkAppHelper.launchHelp(MainActivity.this);
336+
PhonkAppHelper.launchAbout(MainActivity.this);
335337
return true;
336338
}
337339

phonk_app/src/main/java/io/phonk/WelcomeActivity.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,10 @@ private void checkPermissions() {
139139
requiredPermissions.add(Manifest.permission.WRITE_SETTINGS);
140140
requiredPermissions.add(Manifest.permission.NFC);
141141
requiredPermissions.add(Manifest.permission.RECEIVE_SMS);
142+
requiredPermissions.add(Manifest.permission.SEND_SMS);
142143
requiredPermissions.add(Manifest.permission.INSTALL_SHORTCUT);
143144
requiredPermissions.add(Manifest.permission.CAMERA);
144-
145145
// requiredPermissions.add(Manifest.permission.FLASHLIGHT);
146-
147146
requiredPermissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
148147
requiredPermissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
149148
requiredPermissions.add(Manifest.permission.MODIFY_AUDIO_SETTINGS);
@@ -206,7 +205,6 @@ public void installExamples() {
206205

207206
// install examples
208207
PhonkSettingsHelper.installExamples(getApplicationContext(), PhonkSettings.EXAMPLES_FOLDER, () -> runOnUiThread(() -> goToStep(STEP_INSTALL_EXAMPLES_OK)));
209-
210208
}
211209

212210
public void ready() {
@@ -244,26 +242,16 @@ public void goToStep(int step) {
244242

245243
checkPermissions();
246244

247-
// show some feedback
248-
249245
break;
250246

251247
case STEP_ASK_PERMISSIONS_ERROR:
252248
mNextStepButton.setEnabled(true);
253249
mNextStepButton.setText("ask permissions");
254250
mNextStep = STEP_ASK_PERMISSIONS_PROMPT;
255251

256-
// hide feedback process
257-
258-
// show feedback error
259-
260252
break;
261253

262254
case STEP_ASK_PERMISSIONS_OK:
263-
// hide feedback process
264-
// show feedback OK
265-
266-
// after some time go to next
267255
goToStep(STEP_INSTALL_EXAMPLES_PROMPT);
268256

269257
break;

phonk_app/src/main/java/io/phonk/appinterpreter/Network.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public class Network {
3636
public void checkVersion() {
3737
//check if new version is available
3838
if (mAppRunner.pNetwork.isNetworkAvailable() && (boolean) UserPreferences.getInstance().get("notify_new_version")) {
39-
mAppRunner.pNetwork.httpGet("http://www.phonk.io/downloads/list_latest.php", data -> {
39+
mAppRunner.pNetwork.httpGet("http://www.phonk.app/downloads/list_latest.php", data -> {
4040
//console.log(event + " " + data);
4141
String[] splitted = ((String) data.get("response")).split(":");
42-
String remoteFile = "http://www.phonk.io/downloads/" + splitted[0];
42+
String remoteFile = "http://www.phonk.app/downloads/" + splitted[0];
4343
String versionName = splitted[1];
4444
int versionCode = Integer.parseInt(splitted[2]);
4545

phonk_app/src/main/java/io/phonk/gui/AboutActivity.java

+47-8
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,20 @@
2222

2323
package io.phonk.gui;
2424

25+
import android.content.Intent;
26+
import android.graphics.Color;
27+
import android.graphics.PixelFormat;
28+
import android.media.MediaPlayer;
29+
import android.net.Uri;
2530
import android.os.Bundle;
31+
import android.preference.ListPreference;
2632
import android.view.View;
2733
import android.widget.FrameLayout;
34+
import android.widget.ImageButton;
35+
import android.widget.TextView;
36+
import android.widget.VideoView;
2837

38+
import io.phonk.BuildConfig;
2939
import io.phonk.R;
3040
import io.phonk.gui._components.APIWebviewFragment;
3141
import io.phonk.runner.base.BaseActivity;
@@ -34,21 +44,44 @@
3444
public class AboutActivity extends BaseActivity {
3545

3646
private static final String TAG = AboutActivity.class.getSimpleName();
47+
private VideoView videoView;
3748

3849
@Override
3950
public void onCreate(Bundle savedInstanceState) {
4051
super.onCreate(savedInstanceState);
41-
setContentView(R.layout.help_activity);
52+
setContentView(R.layout.about_activity);
4253

4354
setupActivity();
4455

45-
FrameLayout fl = findViewById(R.id.fragmentWebview);
46-
fl.setVisibility(View.VISIBLE);
47-
MLog.d(TAG, "using webide");
48-
APIWebviewFragment webViewFragment = new APIWebviewFragment();
49-
Bundle bundle = new Bundle();
50-
bundle.putString("url", "http://127.0.0.1:8585");
51-
webViewFragment.setArguments(bundle);
56+
ImageButton btnPatreon = findViewById(R.id.btnPatreon);
57+
ImageButton btnBuyMeACoffee = findViewById(R.id.btnBuyMeACoffee);
58+
59+
btnPatreon.setOnClickListener(view -> openLink("https://www.patreon.com/victornomad"));
60+
btnBuyMeACoffee.setOnClickListener(view -> openLink("https://www.buymeacoffee.com/victordiaz"));
61+
62+
TextView phonkVersionName = findViewById(R.id.versionName);
63+
phonkVersionName.setText(BuildConfig.VERSION_NAME);
64+
65+
videoView = findViewById(R.id.videoView);
66+
String videoURI = "android.resource://" + getPackageName() + "/" + R.raw.phonk;
67+
videoView.setVideoURI(Uri.parse(videoURI));
68+
// videoView.setBackgroundColor(Color.WHITE);
69+
70+
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
71+
@Override
72+
public void onPrepared(MediaPlayer mediaPlayer) {
73+
mediaPlayer.setLooping(true);
74+
videoView.setBackgroundColor(Color.TRANSPARENT);
75+
// videoView.setZOrderOnTop(true);
76+
}
77+
});
78+
videoView.start();
79+
}
80+
81+
private void openLink(String url) {
82+
Intent i = new Intent(Intent.ACTION_VIEW);
83+
i.setData(Uri.parse(url));
84+
startActivity(i);
5285
}
5386

5487
@Override
@@ -57,4 +90,10 @@ protected void setupActivity() {
5790

5891
enableBackOnToolbar();
5992
}
93+
94+
@Override
95+
protected void onResume() {
96+
super.onResume();
97+
videoView.start();
98+
}
6099
}

phonk_app/src/main/java/io/phonk/gui/ConnectionInfoFragment.java

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import android.os.Bundle;
2626
import android.os.Handler;
27+
import android.os.Looper;
2728
import android.text.method.ScrollingMovementMethod;
2829
import android.view.LayoutInflater;
2930
import android.view.View;

0 commit comments

Comments
 (0)