diff --git a/app/src/androidTest/java/in/co/gorest/grblcontroller/ExampleInstrumentedTest.java b/app/src/androidTest/java/in/co/gorest/grblcontroller/ExampleInstrumentedTest.java index 68c9770..e175bb1 100644 --- a/app/src/androidTest/java/in/co/gorest/grblcontroller/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/in/co/gorest/grblcontroller/ExampleInstrumentedTest.java @@ -17,7 +17,7 @@ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test - public void useAppContext() throws Exception { + public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 16b8f90..e516527 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -38,7 +38,6 @@ - - - - - - - - + - + - - + - + - + + android:value="@string/default_notification_channel_id" /> diff --git a/app/src/main/java/in/co/gorest/grblcontroller/BluetoothConnectionActivity.java b/app/src/main/java/in/co/gorest/grblcontroller/BluetoothConnectionActivity.java index 5fcd588..49a01c0 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/BluetoothConnectionActivity.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/BluetoothConnectionActivity.java @@ -37,6 +37,7 @@ import android.view.Menu; import android.view.MenuItem; +import com.crashlytics.android.Crashlytics; import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.CustomEvent; import com.joanzapata.iconify.IconDrawable; @@ -47,6 +48,7 @@ import org.greenrobot.eventbus.ThreadMode; import java.lang.ref.WeakReference; +import java.util.Objects; import in.co.gorest.grblcontroller.events.BluetoothDisconnectEvent; import in.co.gorest.grblcontroller.events.GrblSettingMessageEvent; @@ -259,7 +261,7 @@ private static class GrblServiceMessageHandler extends Handler { private final WeakReference mActivity; - public GrblServiceMessageHandler(BluetoothConnectionActivity activity){ + GrblServiceMessageHandler(BluetoothConnectionActivity activity){ mActivity = new WeakReference<>(activity); } @@ -360,10 +362,15 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { case Constants.CONNECT_DEVICE_INSECURE: if(resultCode == Activity.RESULT_OK){ - String macAddress = data.getExtras().getString(DeviceListActivity . EXTRA_DEVICE_ADDRESS); - if(grblBluetoothSerialService != null && bluetoothAdapter.isEnabled()){ - sharedPref.edit().putString(getString(R.string.preference_last_connected_device), macAddress).apply(); - connectToDevice(macAddress); + try{ + String macAddress = Objects.requireNonNull(data.getExtras()).getString(DeviceListActivity . EXTRA_DEVICE_ADDRESS); + if(grblBluetoothSerialService != null && bluetoothAdapter.isEnabled()){ + sharedPref.edit().putString(getString(R.string.preference_last_connected_device), macAddress).apply(); + connectToDevice(macAddress); + } + + }catch (NullPointerException e){ + Crashlytics.logException(e); } } } diff --git a/app/src/main/java/in/co/gorest/grblcontroller/GrblActivity.java b/app/src/main/java/in/co/gorest/grblcontroller/GrblActivity.java index 69e379e..476fe35 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/GrblActivity.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/GrblActivity.java @@ -47,8 +47,6 @@ import android.view.View; import android.widget.Toast; -import com.android.volley.Request; -import com.android.volley.toolbox.JsonObjectRequest; import com.crashlytics.android.Crashlytics; import com.joanzapata.iconify.IconDrawable; import com.joanzapata.iconify.Iconify; @@ -58,7 +56,6 @@ import org.apache.commons.collections4.queue.CircularFifoQueue; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import org.json.JSONObject; import in.co.gorest.grblcontroller.databinding.ActivityMainBinding; import in.co.gorest.grblcontroller.events.ConsoleMessageEvent; @@ -155,8 +152,6 @@ public void onDestroy(){ FileSenderListener.resetClass(); MachineStatusListener.resetClass(); isAppRunning = false; - - GrblController.getInstance().cancelPendingRequests(GrblController.class.getSimpleName()); } @Override diff --git a/app/src/main/java/in/co/gorest/grblcontroller/GrblController.java b/app/src/main/java/in/co/gorest/grblcontroller/GrblController.java index 48cbedb..192c017 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/GrblController.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/GrblController.java @@ -23,33 +23,38 @@ import android.app.Application; -import android.content.Context; import android.support.v7.app.AppCompatDelegate; -import android.text.TextUtils; -import com.android.volley.DefaultRetryPolicy; -import com.android.volley.Request; -import com.android.volley.RequestQueue; -import com.android.volley.toolbox.ImageLoader; -import com.android.volley.toolbox.Volley; import com.crashlytics.android.Crashlytics; import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.core.CrashlyticsCore; -import in.co.gorest.grblcontroller.util.GoRestBitmapCache; +import in.co.gorest.grblcontroller.network.GoRestService; import io.fabric.sdk.android.Fabric; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; public class GrblController extends Application { private final String TAG = GrblController.class.getSimpleName(); private static GrblController grblController; - private RequestQueue requestQueue; - private ImageLoader imageLoader; + private GoRestService goRestService; @Override public void onCreate() { super.onCreate(); - Fabric.with(this, new Crashlytics(), new Answers()); + + configureCrashReporting(); + grblController = this; + +// Picasso.Builder builder = new Picasso.Builder(this); +// builder.downloader(new OkHttp3Downloader(this, Integer.MAX_VALUE)); +// Picasso picasso = builder.build(); +// picasso.setIndicatorsEnabled(BuildConfig.DEBUG); +// picasso.setLoggingEnabled(BuildConfig.DEBUG); +// Picasso.setSingletonInstance(picasso); + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); } @@ -57,37 +62,22 @@ public static synchronized GrblController getInstance(){ return grblController; } - public RequestQueue getRequestQueue(){ - if(requestQueue == null) requestQueue = Volley.newRequestQueue(getApplicationContext()); - - return requestQueue; - } - - public ImageLoader getImageLoader(){ - getRequestQueue(); - if(imageLoader == null){ - imageLoader = new ImageLoader(this.requestQueue, new GoRestBitmapCache()); - } - - return this.imageLoader; + private void configureCrashReporting(){ + CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build(); + Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build(), new Answers()); } - public void addToRequestQueue(Request req, String tag) { - // set the default tag if tag is empty - req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); - getRequestQueue().add(req); - } + public GoRestService getRetrofit(){ + if(goRestService == null){ + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://gorest.co.in") + .addConverterFactory(GsonConverterFactory.create()) + .build(); - public void addToRequestQueue(Request req) { - req.setTag(TAG); - getRequestQueue().add(req); - } - - public void cancelPendingRequests(Object tag) { - if (requestQueue != null) { - requestQueue.cancelAll(tag); + goRestService = retrofit.create(GoRestService.class); } - } + return goRestService; + } } diff --git a/app/src/main/java/in/co/gorest/grblcontroller/SettingsActivity.java b/app/src/main/java/in/co/gorest/grblcontroller/SettingsActivity.java index 00253fc..e3efd9e 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/SettingsActivity.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/SettingsActivity.java @@ -81,7 +81,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin if(key.equalsIgnoreCase(getString(R.string.preference_gcode_file_picker_type))){ String value = sharedPreferences.getString(key, ""); - if(value != null && value.equalsIgnoreCase("full")){ + if(value.equalsIgnoreCase("full")){ EventBus.getDefault().post(new UiToastEvent(getString(R.string.text_only_internal_storage_supported))); } } diff --git a/app/src/main/java/in/co/gorest/grblcontroller/UsbConnectionActivity.java b/app/src/main/java/in/co/gorest/grblcontroller/UsbConnectionActivity.java index a20c53e..6246905 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/UsbConnectionActivity.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/UsbConnectionActivity.java @@ -203,7 +203,14 @@ public void handleMessage(Message msg) { private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - switch (intent.getAction()) { + + String intentAction = intent.getAction(); + if(intentAction == null){ + grblToast("Unknown error"); + return; + } + + switch (intentAction) { case GrblUsbSerialService.ACTION_USB_PERMISSION_GRANTED: // USB PERMISSION GRANTED if(getSupportActionBar() != null) getSupportActionBar().setSubtitle(getString(R.string.text_connected)); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/events/GrblSettingMessageEvent.java b/app/src/main/java/in/co/gorest/grblcontroller/events/GrblSettingMessageEvent.java index 485dfbe..d7ebd30 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/events/GrblSettingMessageEvent.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/events/GrblSettingMessageEvent.java @@ -32,7 +32,7 @@ public class GrblSettingMessageEvent { private final GrblLookups lookups; private final String message; - private final static Pattern MESSAGE_REGEX = Pattern.compile("(\\$\\d+)=([^ ]*)\\s?\\(?([^\\)]*)?\\)?"); + private final static Pattern MESSAGE_REGEX = Pattern.compile("(\\$\\d+)=([^ ]*)\\s?\\(?([^)]*)?\\)?"); private String setting; private String value; diff --git a/app/src/main/java/in/co/gorest/grblcontroller/helpers/DepthPageTransformer.java b/app/src/main/java/in/co/gorest/grblcontroller/helpers/DepthPageTransformer.java index 52cbb46..7e4aab8 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/helpers/DepthPageTransformer.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/helpers/DepthPageTransformer.java @@ -22,6 +22,7 @@ package in.co.gorest.grblcontroller.helpers; +import android.support.annotation.NonNull; import android.support.v4.view.ViewPager; import android.view.View; @@ -29,7 +30,7 @@ class DepthPageTransformer implements ViewPager.PageTransformer{ private static final float MIN_SCALE = 0.75f; - public void transformPage(View view, float position) { + public void transformPage(@NonNull View view, float position) { int pageWidth = view.getWidth(); if (position < -1) { // [-Infinity,-1) diff --git a/app/src/main/java/in/co/gorest/grblcontroller/helpers/ReaderViewPagerTransformer.java b/app/src/main/java/in/co/gorest/grblcontroller/helpers/ReaderViewPagerTransformer.java index 8142da7..b777554 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/helpers/ReaderViewPagerTransformer.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/helpers/ReaderViewPagerTransformer.java @@ -21,6 +21,7 @@ package in.co.gorest.grblcontroller.helpers; +import android.support.annotation.NonNull; import android.support.v4.view.ViewPager; import android.view.View; @@ -39,7 +40,7 @@ public ReaderViewPagerTransformer(TransformType transformType) { private static final float SCALE_FACTOR_SLIDE = 0.85f; private static final float MIN_ALPHA_SLIDE = 0.35f; - public void transformPage(View page, float position) { + public void transformPage(@NonNull View page, float position) { final float alpha; final float scale; final float translationX; diff --git a/app/src/main/java/in/co/gorest/grblcontroller/helpers/ZoomOutPageTransformer.java b/app/src/main/java/in/co/gorest/grblcontroller/helpers/ZoomOutPageTransformer.java index b5786ae..dcfb5cc 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/helpers/ZoomOutPageTransformer.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/helpers/ZoomOutPageTransformer.java @@ -21,6 +21,7 @@ package in.co.gorest.grblcontroller.helpers; +import android.support.annotation.NonNull; import android.support.v4.view.ViewPager; import android.view.View; @@ -28,7 +29,7 @@ class ZoomOutPageTransformer implements ViewPager.PageTransformer { private static final float MIN_SCALE = 0.85f; private static final float MIN_ALPHA = 0.5f; - public void transformPage(View view, float position) { + public void transformPage(@NonNull View view, float position) { int pageWidth = view.getWidth(); int pageHeight = view.getHeight(); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/listeners/SerialCommunicationHandler.java b/app/src/main/java/in/co/gorest/grblcontroller/listeners/SerialCommunicationHandler.java index cdfd5fa..4ea1da9 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/listeners/SerialCommunicationHandler.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/listeners/SerialCommunicationHandler.java @@ -56,7 +56,7 @@ public abstract class SerialCommunicationHandler extends Handler { private static GrblLookups GrblAlarms; private static GrblLookups GrblSettings; - private String[] startUpCommands = {GrblUtils.GRBL_BUILD_INFO_COMMAND, GrblUtils.GRBL_VIEW_SETTINGS_COMMAND, GrblUtils.GRBL_VIEW_PARSER_STATE_COMMAND, GrblUtils.GRBL_VIEW_GCODE_PARAMETERS_COMMAND}; + private final String[] startUpCommands = {GrblUtils.GRBL_BUILD_INFO_COMMAND, GrblUtils.GRBL_VIEW_SETTINGS_COMMAND, GrblUtils.GRBL_VIEW_PARSER_STATE_COMMAND, GrblUtils.GRBL_VIEW_GCODE_PARAMETERS_COMMAND}; public SerialCommunicationHandler(){ @@ -225,6 +225,7 @@ private synchronized void updateMachineStatus(String statusMessage){ machineStatus.setMachinePosition(MPos); machineStatus.setWorkPosition(WPos); machineStatus.setWorkCoordsOffset(WCO); + if(!enabledPinsChanged) machineStatus.setEnabledPins(""); if(hasOverrides){ diff --git a/app/src/main/java/in/co/gorest/grblcontroller/model/FcmToken.java b/app/src/main/java/in/co/gorest/grblcontroller/model/FcmToken.java new file mode 100644 index 0000000..f51a646 --- /dev/null +++ b/app/src/main/java/in/co/gorest/grblcontroller/model/FcmToken.java @@ -0,0 +1,100 @@ +/* + * + * * /** + * * * Copyright (C) 2017 Grbl Controller Contributors + * * * + * * * This program is free software; you can redistribute it and/or modify + * * * it under the terms of the GNU General Public License as published by + * * * the Free Software Foundation; either version 2 of the License, or + * * * (at your option) any later version. + * * * + * * * This program is distributed in the hope that it will be useful, + * * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * * GNU General Public License for more details. + * * * + * * * You should have received a copy of the GNU General Public License along + * * * with this program; if not, write to the Free Software Foundation, Inc., + * * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * * * + * * + * + */ + +package in.co.gorest.grblcontroller.model; + +import android.os.Build; + +import com.google.gson.annotations.SerializedName; + +import in.co.gorest.grblcontroller.BuildConfig; + +public class FcmToken { + + @SerializedName("app_name") + private String appName; + + @SerializedName("app_version") + private String appVersion; + + @SerializedName("token") + private String token; + + @SerializedName("device_name") + private String deviceName; + + @SerializedName("os_version") + private String osVersion; + + public FcmToken(){ + + } + + public FcmToken(String token){ + this.token = token; + this.appName = BuildConfig.APPLICATION_ID; + this.appVersion = String.valueOf(BuildConfig.VERSION_CODE); + this.deviceName = Build.MODEL; + this.osVersion = Build.VERSION.RELEASE; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getOsVersion() { + return osVersion; + } + + public void setOsVersion(String osVersion) { + this.osVersion = osVersion; + } +} diff --git a/app/src/main/java/in/co/gorest/grblcontroller/network/GoRestService.java b/app/src/main/java/in/co/gorest/grblcontroller/network/GoRestService.java new file mode 100644 index 0000000..94c9a33 --- /dev/null +++ b/app/src/main/java/in/co/gorest/grblcontroller/network/GoRestService.java @@ -0,0 +1,41 @@ +/* + * + * * /** + * * * Copyright (C) 2017 Grbl Controller Contributors + * * * + * * * This program is free software; you can redistribute it and/or modify + * * * it under the terms of the GNU General Public License as published by + * * * the Free Software Foundation; either version 2 of the License, or + * * * (at your option) any later version. + * * * + * * * This program is distributed in the hope that it will be useful, + * * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * * GNU General Public License for more details. + * * * + * * * You should have received a copy of the GNU General Public License along + * * * with this program; if not, write to the Free Software Foundation, Inc., + * * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * * * + * * + * + */ + +package in.co.gorest.grblcontroller.network; + +import com.google.gson.JsonObject; + +import in.co.gorest.grblcontroller.model.FcmToken; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface GoRestService { + + + @POST("/fcm-registration.html") + Call postFcmToken(@Body FcmToken fcmToken); + + + +} diff --git a/app/src/main/java/in/co/gorest/grblcontroller/service/GrblUsbSerialService.java b/app/src/main/java/in/co/gorest/grblcontroller/service/GrblUsbSerialService.java index d589a17..85a973c 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/service/GrblUsbSerialService.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/service/GrblUsbSerialService.java @@ -72,6 +72,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import in.co.gorest.grblcontroller.R; import in.co.gorest.grblcontroller.events.GrblRealTimeCommandEvent; @@ -250,8 +251,8 @@ public void onDSRChanged(boolean state) { private final BroadcastReceiver usbReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1){ - if(arg1.getAction().equals(ACTION_USB_PERMISSION)){ - boolean granted = arg1.getExtras().getBoolean(UsbManager.EXTRA_PERMISSION_GRANTED); + if(Objects.equals(arg1.getAction(), ACTION_USB_PERMISSION)){ + boolean granted = Objects.requireNonNull(arg1.getExtras()).getBoolean(UsbManager.EXTRA_PERMISSION_GRANTED); if(granted){ Intent intent = new Intent(ACTION_USB_PERMISSION_GRANTED); arg0.sendBroadcast(intent); @@ -261,9 +262,9 @@ public void onReceive(Context arg0, Intent arg1){ Intent intent = new Intent(ACTION_USB_PERMISSION_NOT_GRANTED); arg0.sendBroadcast(intent); } - }else if(arg1.getAction().equals(ACTION_USB_ATTACHED)) { + }else if(Objects.equals(arg1.getAction(), ACTION_USB_ATTACHED)) { if(!serialPortConnected) findSerialPortDevice(); - } else if (arg1.getAction().equals(ACTION_USB_DETACHED)) { + } else if (Objects.equals(arg1.getAction(), ACTION_USB_DETACHED)) { Intent intent = new Intent(ACTION_USB_DISCONNECTED); arg0.sendBroadcast(intent); serialUsbCommunicationHandler.stopGrblStatusUpdateService(); @@ -315,7 +316,7 @@ private void setFilter() { filter.addAction(ACTION_USB_PERMISSION); filter.addAction(ACTION_USB_DETACHED); filter.addAction(ACTION_USB_ATTACHED); - if(usbReceiver != null) registerReceiver(usbReceiver, filter); + registerReceiver(usbReceiver, filter); } /* diff --git a/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseInstanceIDService.java b/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseInstanceIDService.java index c32358a..867d6e9 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseInstanceIDService.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseInstanceIDService.java @@ -23,25 +23,21 @@ package in.co.gorest.grblcontroller.service; -import android.os.Build; +import android.support.annotation.NonNull; import android.util.Log; -import com.android.volley.Request; -import com.android.volley.Response; -import com.android.volley.VolleyError; -import com.android.volley.toolbox.JsonObjectRequest; import com.google.firebase.iid.FirebaseInstanceId; import com.google.firebase.iid.FirebaseInstanceIdService; import com.google.firebase.messaging.FirebaseMessaging; +import com.google.gson.JsonObject; -import org.json.JSONException; -import org.json.JSONObject; - -import in.co.gorest.grblcontroller.BuildConfig; import in.co.gorest.grblcontroller.GrblController; import in.co.gorest.grblcontroller.R; import in.co.gorest.grblcontroller.helpers.EnhancedSharedPreferences; import in.co.gorest.grblcontroller.helpers.NotificationHelper; +import in.co.gorest.grblcontroller.model.FcmToken; +import retrofit2.Call; +import retrofit2.Callback; public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { @@ -65,43 +61,26 @@ public void onTokenRefresh() { public static void sendRegistrationToServer(final String refreshedToken){ - JSONObject fcmToken = new JSONObject(); - try { - fcmToken.put("app_name", BuildConfig.APPLICATION_ID); - fcmToken.put("app_version", String.valueOf(BuildConfig.VERSION_CODE)); - fcmToken.put("token", refreshedToken); - fcmToken.put("device_name", Build.MODEL); - fcmToken.put("os_version", Build.VERSION.RELEASE); - } catch (JSONException e) { - return; - } - - JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST, "https://gorest.co.in/fcm-registration.html", fcmToken, - new Response.Listener() { - @Override - public void onResponse(JSONObject response) { - try { - boolean isSuccess = response.getBoolean("success"); - if(isSuccess){ - EnhancedSharedPreferences sharedPreferences = EnhancedSharedPreferences.getInstance(GrblController.getInstance(), GrblController.getInstance().getString(R.string.shared_preference_key)); - sharedPreferences.edit().putBoolean(GrblController.getInstance().getString(R.string.firebase_cloud_messaging_token_sent), true).apply(); - } - } catch (JSONException e) { - return; + Log.d(TAG, refreshedToken); + + GrblController.getInstance().getRetrofit().postFcmToken(new FcmToken(refreshedToken)).enqueue(new Callback() { + @Override + public void onResponse(@NonNull Call call, @NonNull retrofit2.Response response) { + if(response.isSuccessful()){ + Boolean isSaved = response.body().get("success").getAsBoolean(); + if(isSaved){ + EnhancedSharedPreferences sharedPreferences = EnhancedSharedPreferences.getInstance(GrblController.getInstance(), GrblController.getInstance().getString(R.string.shared_preference_key)); + sharedPreferences.edit().putBoolean(GrblController.getInstance().getString(R.string.firebase_cloud_messaging_token_sent), true).apply(); } } - }, + } - new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { + @Override + public void onFailure(@NonNull Call call, @NonNull Throwable throwable) { - } + } }); - jsObjRequest.setShouldCache(false); - - GrblController.getInstance().addToRequestQueue(jsObjRequest); } } diff --git a/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseMessagingService.java b/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseMessagingService.java index 3512b82..cfc38bd 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseMessagingService.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/service/MyFirebaseMessagingService.java @@ -86,7 +86,7 @@ public void onMessageReceived(RemoteMessage remoteMessage) { }catch (Exception e){ Crashlytics.logException(e); - Log.d(TAG, e.getMessage());; + Log.d(TAG, e.getMessage()); } } diff --git a/app/src/main/java/in/co/gorest/grblcontroller/ui/ConsoleTabFragment.java b/app/src/main/java/in/co/gorest/grblcontroller/ui/ConsoleTabFragment.java index d785b93..c85e958 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/ui/ConsoleTabFragment.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/ui/ConsoleTabFragment.java @@ -25,6 +25,7 @@ import android.content.DialogInterface; import android.databinding.DataBindingUtil; import android.os.Bundle; +import android.support.annotation.NonNull; import android.support.v7.widget.SwitchCompat; import android.text.method.ScrollingMovementMethod; import android.view.LayoutInflater; @@ -65,7 +66,7 @@ public void onCreate(Bundle savedInstanceState) { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FragmentConsoleTabBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_console_tab, container, false); View view = binding.getRoot(); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/ui/FileSenderTabFragment.java b/app/src/main/java/in/co/gorest/grblcontroller/ui/FileSenderTabFragment.java index 666e5f5..968df28 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/ui/FileSenderTabFragment.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/ui/FileSenderTabFragment.java @@ -34,6 +34,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Process; +import android.support.annotation.NonNull; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -55,6 +56,7 @@ import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Objects; import java.util.regex.Pattern; import droidninja.filepicker.FilePickerBuilder; @@ -93,7 +95,7 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); machineStatus = MachineStatusListener.getInstance(); fileSender = FileSenderListener.getInstance(); - sharedPref = EnhancedSharedPreferences.getInstance(getActivity().getApplicationContext(), getString(R.string.shared_preference_key)); + sharedPref = EnhancedSharedPreferences.getInstance(Objects.requireNonNull(getActivity()).getApplicationContext(), getString(R.string.shared_preference_key)); } @Override @@ -109,7 +111,7 @@ public void onStop(){ } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FragmentFileSenderTabBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_file_sender_tab, container, false); binding.setMachineStatus(machineStatus); @@ -198,7 +200,7 @@ private void startFileStreaming(){ if(machineStatus.getState().equals(Constants.MACHINE_STATUS_CHECK)){ FileStreamerIntentService.setShouldContinue(true); - Intent intent = new Intent(getActivity().getApplicationContext(), FileStreamerIntentService.class); + Intent intent = new Intent(Objects.requireNonNull(getActivity()).getApplicationContext(), FileStreamerIntentService.class); intent.putExtra(FileStreamerIntentService.CHECK_MODE_ENABLED, machineStatus.getState().equals(Constants.MACHINE_STATUS_CHECK)); String defaultConnection = sharedPref.getString(getString(R.string.preference_default_serial_connection_type), Constants.SERIAL_CONNECTION_TYPE_BLUETOOTH); @@ -223,7 +225,7 @@ private void startFileStreaming(){ .setPositiveButton(getString(R.string.text_continue_streaming), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { FileStreamerIntentService.setShouldContinue(true); - Intent intent = new Intent(getActivity().getApplicationContext(), FileStreamerIntentService.class); + Intent intent = new Intent(Objects.requireNonNull(getActivity()).getApplicationContext(), FileStreamerIntentService.class); if(Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1){ getActivity().getApplicationContext().startForegroundService(intent); }else{ @@ -248,7 +250,7 @@ private void stopFileStreaming(){ FileStreamerIntentService.setShouldContinue(false); } - Intent intent = new Intent(getActivity().getApplicationContext(), FileStreamerIntentService.class); + Intent intent = new Intent(Objects.requireNonNull(getActivity()).getApplicationContext(), FileStreamerIntentService.class); getActivity().stopService(intent); if(machineStatus.getState().equals(Constants.MACHINE_STATUS_HOLD)){ @@ -276,7 +278,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { if(fileSender.getGcodeFile().exists()){ new ReadFileAsyncTask().execute(fileSender.getGcodeFile()); }else{ - MediaScannerConnection.scanFile(getActivity().getApplicationContext(), new String[] { fileSender.getGcodeFile().getAbsolutePath() }, null, + MediaScannerConnection.scanFile(Objects.requireNonNull(getActivity()).getApplicationContext(), new String[] { fileSender.getGcodeFile().getAbsolutePath() }, null, new MediaScannerConnection.OnScanCompletedListener() { public void onScanCompleted(String path, Uri uri) {} } @@ -483,14 +485,14 @@ private void getFilePicker(){ .enableDocSupport(false) .showFolderView(false) .sortDocumentsBy(SortingTypes.name) - .pickFile(getActivity()); + .pickFile(Objects.requireNonNull(getActivity())); } } private Boolean hasExternalStorageReadPermission(){ Boolean hasPermission = true; if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - if(getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + if(Objects.requireNonNull(getActivity()).checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { hasPermission = false; } } @@ -506,7 +508,7 @@ private void askExternalReadPermission(){ } @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/ui/JoggingTabFragment.java b/app/src/main/java/in/co/gorest/grblcontroller/ui/JoggingTabFragment.java index 866cc01..57e8b54 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/ui/JoggingTabFragment.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/ui/JoggingTabFragment.java @@ -21,12 +21,14 @@ package in.co.gorest.grblcontroller.ui; +import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.DialogInterface; import android.databinding.DataBindingUtil; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.NonNull; import android.support.v7.widget.SwitchCompat; import android.util.Log; import android.view.LayoutInflater; @@ -48,6 +50,7 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.LinkedList; +import java.util.Objects; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; @@ -80,14 +83,20 @@ public static JoggingTabFragment newInstance() { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); machineStatus = MachineStatusListener.getInstance(); - sharedPref = EnhancedSharedPreferences.getInstance(getActivity().getApplicationContext(), getString(R.string.shared_preference_key)); + sharedPref = EnhancedSharedPreferences.getInstance(Objects.requireNonNull(getActivity()).getApplicationContext(), getString(R.string.shared_preference_key)); EventBus.getDefault().register(this); } @Override public void onResume(){ super.onResume(); - SetCustomButtons(getView()); + SetCustomButtons(Objects.requireNonNull(getView())); + + if(sharedPref.getBoolean(getString(R.string.preference_enable_additional_axis), false)){ + getView().findViewById(R.id.additional_axis_layout).setVisibility(View.VISIBLE); + }else{ + getView().findViewById(R.id.additional_axis_layout).setVisibility(View.GONE); + } String joggingPadRotateAngle = sharedPref.getString(getString(R.string.preference_xy_jog_pad_rotation), "0"); String[] joggingPadTags = rotateJogPad(Integer.valueOf(joggingPadRotateAngle)); @@ -106,8 +115,9 @@ public void onDestroy(){ EventBus.getDefault().unregister(this); } + @SuppressLint("ClickableViewAccessibility") @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FragmentJoggingTabBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_jogging_tab, container, false); binding.setMachineStatus(machineStatus); View view = binding.getRoot(); @@ -117,6 +127,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa for(int resourceId : new Integer[]{R.id.jog_y_positive, R.id.jog_x_positive, R.id.jog_z_positive, R.id.jog_xy_top_left, R.id.jog_xy_top_right, R.id.jog_xy_bottom_left, R.id.jog_xy_bottom_right, + R.id.jog_a_positive, R.id.jog_a_negative, R.id.jog_b_positive, R.id.jog_b_negative, R.id.jog_y_negative, R.id.jog_x_negative, R.id.jog_z_negative}){ final IconButton iconButton = view.findViewById(resourceId); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/ui/ProbingTabFragment.java b/app/src/main/java/in/co/gorest/grblcontroller/ui/ProbingTabFragment.java index 3a72b04..44eb1b1 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/ui/ProbingTabFragment.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/ui/ProbingTabFragment.java @@ -26,6 +26,7 @@ import android.databinding.DataBindingUtil; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.NonNull; import android.support.v7.widget.SwitchCompat; import android.view.LayoutInflater; import android.view.View; @@ -43,6 +44,8 @@ import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.util.Objects; + import in.co.gorest.grblcontroller.R; import in.co.gorest.grblcontroller.databinding.FragmentProbingTabBinding; import in.co.gorest.grblcontroller.events.GrblProbeEvent; @@ -73,7 +76,7 @@ public static ProbingTabFragment newInstance() { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); machineStatus = MachineStatusListener.getInstance(); - sharedPref = EnhancedSharedPreferences.getInstance(getActivity().getApplicationContext(), getString(R.string.shared_preference_key)); + sharedPref = EnhancedSharedPreferences.getInstance(Objects.requireNonNull(getActivity()).getApplicationContext(), getString(R.string.shared_preference_key)); EventBus.getDefault().register(this); } @@ -84,7 +87,7 @@ public void onDestroy(){ } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FragmentProbingTabBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_probing_tab, container, false); binding.setMachineStatus(machineStatus); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/util/GcodePreprocessorUtils.java b/app/src/main/java/in/co/gorest/grblcontroller/util/GcodePreprocessorUtils.java index c9bfaea..55a4f60 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/util/GcodePreprocessorUtils.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/util/GcodePreprocessorUtils.java @@ -29,7 +29,7 @@ public class GcodePreprocessorUtils { private static final String EMPTY = ""; private static final Pattern WHITE_SPACE = Pattern.compile("\\s"); private static final Pattern COMMENT = Pattern.compile("\\(.*\\)|\\s*;.*|%$"); - private static final Pattern COMMENT_PARSE = Pattern.compile("(?<=\\()[^\\(\\)]*|(?<=\\;).*|%"); + private static final Pattern COMMENT_PARSE = Pattern.compile("(?<=\\()[^()]*|(?<=;).*|%"); public static String removeWhiteSpace(String command){ return WHITE_SPACE.matcher(command).replaceAll(EMPTY).toUpperCase(); diff --git a/app/src/main/java/in/co/gorest/grblcontroller/util/GoRestBitmapCache.java b/app/src/main/java/in/co/gorest/grblcontroller/util/GoRestBitmapCache.java deleted file mode 100644 index fa0279f..0000000 --- a/app/src/main/java/in/co/gorest/grblcontroller/util/GoRestBitmapCache.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * * /** - * * * Copyright (C) 2017 Grbl Controller Contributors - * * * - * * * This program is free software; you can redistribute it and/or modify - * * * it under the terms of the GNU General Public License as published by - * * * the Free Software Foundation; either version 2 of the License, or - * * * (at your option) any later version. - * * * - * * * This program is distributed in the hope that it will be useful, - * * * but WITHOUT ANY WARRANTY; without even the implied warranty of - * * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * * * GNU General Public License for more details. - * * * - * * * You should have received a copy of the GNU General Public License along - * * * with this program; if not, write to the Free Software Foundation, Inc., - * * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * - * * - * - */ - -package in.co.gorest.grblcontroller.util; - -import android.graphics.Bitmap; -import android.util.LruCache; - -import com.android.volley.toolbox.ImageLoader; - -public class GoRestBitmapCache extends LruCache implements ImageLoader.ImageCache{ - - public static int getDefaultLruCacheSize() { - final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); - final int cacheSize = maxMemory / 8; - - return cacheSize; - } - - public GoRestBitmapCache() { - this(getDefaultLruCacheSize()); - } - - public GoRestBitmapCache(int sizeInKiloBytes) { - super(sizeInKiloBytes); - } - - @Override - protected int sizeOf(String key, Bitmap value) { - return value.getRowBytes() * value.getHeight() / 1024; - } - - @Override - public Bitmap getBitmap(String url) { - return get(url); - } - - @Override - public void putBitmap(String url, Bitmap bitmap) { - put(url, bitmap); - } -} diff --git a/app/src/main/java/in/co/gorest/grblcontroller/util/GrblUtils.java b/app/src/main/java/in/co/gorest/grblcontroller/util/GrblUtils.java index b48e420..2df6dd5 100644 --- a/app/src/main/java/in/co/gorest/grblcontroller/util/GrblUtils.java +++ b/app/src/main/java/in/co/gorest/grblcontroller/util/GrblUtils.java @@ -88,7 +88,7 @@ public static Character getVersionLetter(final String response) { return retValue; } - private static final Pattern TLO_PATTERN = Pattern.compile("^\\[TLO:(.*)\\]$"); + private static final Pattern TLO_PATTERN = Pattern.compile("^\\[TLO:(.*)]$"); public static boolean isGrblToolLengthOffsetMessage(final String response){ return TLO_PATTERN.matcher(response).find(); } @@ -98,7 +98,7 @@ public static Double getToolLengthOffset(final String response){ return matcher.find() ? Double.valueOf(matcher.group(1)) : 0.0; } - private static final String PROBE_REGEX = "^\\[PRB:(.*)\\]$"; + private static final String PROBE_REGEX = "^\\[PRB:(.*)]$"; private static final Pattern PROBE_PATTERN = Pattern.compile(PROBE_REGEX); public static boolean isGrblProbeMessage(final String response) { return PROBE_PATTERN.matcher(response).find(); @@ -109,19 +109,19 @@ public static String getProbeString(final String response){ return matcher.find() ? matcher.group(1) : null; } - private static final String STATUS_REGEX = "^\\<.*\\>$"; + private static final String STATUS_REGEX = "^<.*>$"; private static final Pattern STATUS_PATTERN = Pattern.compile(STATUS_REGEX); public static boolean isGrblStatusString(final String response) { return STATUS_PATTERN.matcher(response).find(); } - private static final String FEEDBACK_REGEX = "^\\[MSG:.*\\]$"; + private static final String FEEDBACK_REGEX = "^\\[MSG:.*]$"; private static final Pattern FEEDBACK_PATTERN = Pattern.compile(FEEDBACK_REGEX); public static boolean isGrblFeedbackMessage(final String response) { return FEEDBACK_PATTERN.matcher(response).find(); } - private static final String BUILD_OPTIONS_REGEX = "^\\[OPT:(.*)\\]$"; + private static final String BUILD_OPTIONS_REGEX = "^\\[OPT:(.*)]$"; private static final Pattern BUILD_OPTIONS_PATTERN = Pattern.compile(BUILD_OPTIONS_REGEX); public static boolean isBuildOptionsMessage(final String response) { return BUILD_OPTIONS_PATTERN.matcher(response).find(); @@ -132,7 +132,7 @@ public static String getBuildOptionString(final String response){ return matcher.find() ? matcher.group(1) : ""; } - private static final String PARSER_STATE_REGEX = "^\\[GC:(.*)\\]$"; + private static final String PARSER_STATE_REGEX = "^\\[GC:(.*)]$"; private static final Pattern PARSER_STATE_PATTERN = Pattern.compile(PARSER_STATE_REGEX); public static boolean isParserStateMessage(final String response){ return PARSER_STATE_PATTERN.matcher(response).find(); @@ -162,8 +162,8 @@ public static boolean isGrblAlarmMessage(final String response){ } public static final Pattern machinePattern = Pattern.compile("(?<=MPos:)(-?\\d*\\..\\d*),(-?\\d*\\..\\d*),(-?\\d*\\..\\d*)"); - public static final Pattern workPattern = Pattern.compile("(?<=WPos:)(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*)"); - public static final Pattern wcoPattern = Pattern.compile("(?<=WCO:)(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*),(\\-?\\d*\\..\\d*)"); + public static final Pattern workPattern = Pattern.compile("(?<=WPos:)(-?\\d*\\..\\d*),(-?\\d*\\..\\d*),(-?\\d*\\..\\d*)"); + public static final Pattern wcoPattern = Pattern.compile("(?<=WCO:)(-?\\d*\\..\\d*),(-?\\d*\\..\\d*),(-?\\d*\\..\\d*)"); public static Position getPositionFromStatusString(final String status, final Pattern pattern) { Matcher matcher = pattern.matcher(status); if (matcher.find()) { diff --git a/app/src/main/res/drawable/ic_keyboard_black_24dp.xml b/app/src/main/res/drawable/ic_keyboard_black_24dp.xml new file mode 100644 index 0000000..b75d6d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_keyboard_black_24dp.xml @@ -0,0 +1,32 @@ + + + + + diff --git a/app/src/main/res/drawable/image_placeholder_email_large.png b/app/src/main/res/drawable/image_placeholder_email_large.png new file mode 100644 index 0000000..73ada97 Binary files /dev/null and b/app/src/main/res/drawable/image_placeholder_email_large.png differ diff --git a/app/src/main/res/layout-large/activity_main.xml b/app/src/main/res/layout-large/activity_main.xml index cee4cb2..f75e568 100644 --- a/app/src/main/res/layout-large/activity_main.xml +++ b/app/src/main/res/layout-large/activity_main.xml @@ -54,9 +54,9 @@ android:layout_height="wrap_content"> - - - + + + @@ -64,9 +64,9 @@ - - - + + + @@ -74,9 +74,9 @@ - - - + + + @@ -84,9 +84,9 @@ - - - + + + @@ -94,9 +94,9 @@ - - - + + + diff --git a/app/src/main/res/layout-large/fragment_console_tab.xml b/app/src/main/res/layout-large/fragment_console_tab.xml index 6d4178e..54e5763 100644 --- a/app/src/main/res/layout-large/fragment_console_tab.xml +++ b/app/src/main/res/layout-large/fragment_console_tab.xml @@ -26,6 +26,7 @@ android:layout_toStartOf="@+id/console_verbose_output" android:layout_alignParentStart="true" android:text="@string/text_verbose_output" + android:textSize="20sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> @@ -54,7 +55,7 @@ android:scrollbars="vertical" android:fadeScrollbars="false" android:textColor="@color/colorAccent" - android:textSize="16sp" + android:textSize="18sp" android:background="@drawable/rounded_border_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" /> @@ -76,7 +77,7 @@ android:textSize="32sp" android:maxLength="78" android:maxLines="1" - android:inputType="text" + android:inputType="textCapCharacters" android:layout_weight="0.7" android:background="@drawable/rounded_border_edit_text" android:layout_width="0dp" diff --git a/app/src/main/res/layout-large/fragment_file_sender_tab.xml b/app/src/main/res/layout-large/fragment_file_sender_tab.xml index 20e05a7..c588212 100644 --- a/app/src/main/res/layout-large/fragment_file_sender_tab.xml +++ b/app/src/main/res/layout-large/fragment_file_sender_tab.xml @@ -27,6 +27,7 @@ android:layout_toStartOf="@+id/select_gcode_file" android:layout_alignParentStart="true" android:text="@{fileSender.gcodeFileName}" + android:textSize="20sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> @@ -54,14 +55,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - + + - - + + - - + + @@ -113,7 +114,7 @@ - + diff --git a/app/src/main/res/layout-large/fragment_jogging_tab.xml b/app/src/main/res/layout-large/fragment_jogging_tab.xml index cfa391d..a325147 100644 --- a/app/src/main/res/layout-large/fragment_jogging_tab.xml +++ b/app/src/main/res/layout-large/fragment_jogging_tab.xml @@ -25,6 +25,7 @@ android:layout_toStartOf="@+id/jogging_step_feed" android:layout_alignParentStart="true" android:text="@string/text_steps_feed" + android:textSize="20sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> @@ -32,6 +33,7 @@ android:id="@+id/jogging_step_feed" android:layout_alignParentEnd="true" android:text='@{machineStatus.jogging.step.toString() + " | " + machineStatus.jogging.feed.toString()}' + android:textSize="20sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> @@ -244,6 +246,62 @@ tools:ignore="HardcodedText" /> + + + + + + + + + + + + @@ -61,6 +64,7 @@ @@ -113,6 +120,7 @@ @@ -137,6 +146,7 @@ @@ -152,6 +162,7 @@ @@ -159,6 +170,7 @@ @@ -174,6 +186,7 @@ diff --git a/app/src/main/res/layout/fragment_jogging_tab.xml b/app/src/main/res/layout/fragment_jogging_tab.xml index 5c2eea9..83aef4b 100644 --- a/app/src/main/res/layout/fragment_jogging_tab.xml +++ b/app/src/main/res/layout/fragment_jogging_tab.xml @@ -225,6 +225,54 @@ tools:ignore="HardcodedText" /> + + + + + + + + + + + + - - 64dp - diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index d0cc88a..2feedfb 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -97,9 +97,9 @@ 若当前不在原点则不发送gcode文件 触觉反馈 按下按钮时将短暂震动 - 忽略错误20 - 继续流在错误无效的命令找到 仅支持内部存储 + 启用 AB 轴 + 在慢跑控制选项卡上启用两个附加的 A 和 B 轴 蓝牙连接 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index 47a76b7..0000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 16dp - - 16dp - 16dp - 8dp - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a1bb422..ca7cb81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -27,7 +27,7 @@ in.co.gorest.grblcontroller.f635f2e523d7c64f5b4ad9179b689433 auto_connect console_verbose_mode - jogging_step_size + jogging_step_size jogging_feed_rate jogging_in_inches jogging_max_step_size @@ -61,7 +61,7 @@ xy_jog_pad_rotation confirm_grbl_soft_reset gcode_file_picker_type - preference_ignore_error_20 + enable_additional_axis firebase_cloud_messaging_token firebase_cloud_messaging_token_sent General @@ -140,9 +140,9 @@ prevents file streaming, if machine is not at zero position Haptic feedback enables short vibration when buttons are touched - Ignore error 20 - continue streaming on error invalid command found Only internal storage is supported + Enable AB Axis + enables two additional A and B axis in jogging control tab Bluetooth diff --git a/app/src/main/res/xml/application_pref.xml b/app/src/main/res/xml/application_pref.xml index 7a4221a..ae7c8cd 100644 --- a/app/src/main/res/xml/application_pref.xml +++ b/app/src/main/res/xml/application_pref.xml @@ -81,8 +81,15 @@ android:summary="%s" /> + +