From f7a70e718f96d32df5c108fe310b3e441120ab83 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 9 Jun 2016 10:41:56 +0200 Subject: [PATCH 001/389] log everything in initial phase --- .../org/envirocar/core/logging/Logger.java | 4 +-- .../obd/adapter/CommandExecutor.java | 27 +++++++++++++------ .../envirocar/obd/adapter/SyncAdapter.java | 7 ++++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/logging/Logger.java b/org.envirocar.core/src/main/java/org/envirocar/core/logging/Logger.java index de607ead1..2c594d1f6 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/logging/Logger.java +++ b/org.envirocar.core/src/main/java/org/envirocar/core/logging/Logger.java @@ -80,7 +80,7 @@ public static Logger getLogger(String name) { return new Logger(name); } - protected final void log(int level, String message, Throwable e) { + public final void log(int level, String message, Throwable e) { if (level > minimumLogLevel) { return; } @@ -105,7 +105,7 @@ private String createConcatenatedMessage(String message, Throwable e) { return sb.toString(); } - protected final void log(int level, String message) { + public final void log(int level, String message) { StringBuilder sb = new StringBuilder(); sb.append("["); sb.append(this.name); diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CommandExecutor.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CommandExecutor.java index d7a27e0c9..f59265ac5 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CommandExecutor.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CommandExecutor.java @@ -25,6 +25,8 @@ public class CommandExecutor { private OutputStream outputStream; private InputStream inputStream; private ResponseQuirkWorkaround quirk; + private boolean logEverything = false; + private int currentLogLevel = Logger.DEBUG; public CommandExecutor(InputStream is, OutputStream os, @@ -39,6 +41,18 @@ public CommandExecutor(InputStream is, OutputStream os, this.endOfLineOutput = (byte) endOfLineOutput.charValue(); this.endOfLineInput = (byte) endOfLineInput.charValue(); + + this.setLogEverything(false); + } + + public final void setLogEverything(boolean logEverything) { + this.logEverything = logEverything; + if (this.logEverything && !LOGGER.isEnabled(Logger.DEBUG)) { + this.currentLogLevel = Logger.INFO; + } + else { + this.currentLogLevel = Logger.DEBUG; + } } public void setQuirk(ResponseQuirkWorkaround quirk) { @@ -52,8 +66,8 @@ public void execute(BasicCommand cmd) throws IOException { byte[] bytes = cmd.getOutputBytes(); - if (LOGGER.isEnabled(Logger.DEBUG)) { - LOGGER.debug("Sending bytes: "+ new String(bytes)); + if (LOGGER.isEnabled(this.currentLogLevel)) { + LOGGER.log(this.currentLogLevel, "Sending bytes: "+ new String(bytes)); } // write to OutputStream, or in this case a BluetoothSocket @@ -71,9 +85,6 @@ public void call(Subscriber subscriber) { try { while (!subscriber.isUnsubscribed()) { byte[] bytes = readResponseLine(); - if (LOGGER.isEnabled(Logger.DEBUG)) { - LOGGER.debug("Received bytes: "+ Base64.encodeToString(bytes, Base64.DEFAULT)); - } subscriber.onNext(bytes); } } catch (IOException e) { @@ -108,14 +119,14 @@ private byte[] readResponseLine() throws IOException, StreamFinishedException { } if (byteArray.length == 0){ - LOGGER.info("Unexpected empty line anonmaly detected. Try to read next line."); + LOGGER.info("Unexpected empty line anomaly detected. Try to read next line."); baos.reset(); readUntilLineEnd(baos); byteArray = baos.toByteArray(); } - if (byteArray.length > 0 && LOGGER.isEnabled(Logger.DEBUG)) { - LOGGER.debug("Received bytes: " + Base64.encodeToString(byteArray, Base64.DEFAULT)); + if (LOGGER.isEnabled(currentLogLevel)) { + LOGGER.log(currentLogLevel, "Received bytes: "+ Base64.encodeToString(byteArray, Base64.DEFAULT)); } return byteArray; diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java index d56285a5c..f88b8b659 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java @@ -71,6 +71,7 @@ public Observable initialize(InputStream is, OutputStream os) { public void call(Subscriber subscriber) { try { boolean analyzedSuccessfully = false; + commandExecutor.setLogEverything(true); while (!subscriber.isUnsubscribed()) { if (analyzedSuccessfully) { @@ -112,7 +113,7 @@ public void call(Subscriber subscriber) { if (cc.awaitsResults()) { try { Thread.sleep(1000); - + LOGGER.info("Retrieving initial phase response..."); byte[] resp = commandExecutor.retrieveLatestResponse(); LOGGER.info("Retrieved initial phase response: "+Base64.encodeToString(resp, Base64.DEFAULT)); analyzedSuccessfully = analyzedSuccessfully | analyzeMetadataResponse(resp, cc); @@ -121,6 +122,9 @@ public void call(Subscriber subscriber) { } } + else { + LOGGER.info("Command does not expect a result, continuing."); + } } } } catch (IOException | AdapterFailedException e) { @@ -144,6 +148,7 @@ public Observable observe() { @Override public void call(Subscriber subscriber) { LOGGER.info("SyncAdapter.observe().call()"); + commandExecutor.setLogEverything(false); //prepare all pending data commands preparePendingCommands(); From 64d22c8e3de566eb96d056d0a34da286d6471921 Mon Sep 17 00:00:00 2001 From: matthesrieke Date: Thu, 9 Jun 2016 10:57:55 +0200 Subject: [PATCH 002/389] log EVERY command of car trend initial phase to a buffer --- .../java/org/envirocar/obd/OBDController.java | 15 ++++++++++++++ .../obd/adapter/CarTrendAdapter.java | 20 +++++++++++++++++-- .../org/envirocar/obd/adapter/OBDAdapter.java | 2 ++ .../envirocar/obd/adapter/SyncAdapter.java | 5 +++++ .../obd/adapter/async/AsyncAdapter.java | 4 ++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/OBDController.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/OBDController.java index 1c5aac4d7..04bc16289 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/OBDController.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/OBDController.java @@ -189,6 +189,15 @@ public void onCompleted() { @Override public void onError(Throwable e) { LOG.warn("Adapter failed: " + obdAdapter.getClass().getSimpleName(), e); + + try { + LOG.info("State message is: "+obdAdapter.getStateMessage()); + } + catch (Exception ex) { + LOG.warn("Could not log state message", ex); + } + + try { this.unsubscribe(); @@ -219,6 +228,12 @@ public void onError(Throwable e) { @Override public void onNext(Boolean b) { LOG.info("Connection verified - starting data collection"); + try { + LOG.info("State message from adapter: "+obdAdapter.getStateMessage()); + } + catch (Exception ex) { + LOG.warn("Could not log state message", ex); + } //unsubscribe, otherwise we will get a timeout this.unsubscribe(); diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java index 712a3efea..2d55bb49b 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java @@ -7,6 +7,8 @@ import org.envirocar.obd.commands.request.PIDCommand; import org.envirocar.obd.exception.AdapterFailedException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.util.ArrayDeque; import java.util.Arrays; import java.util.List; @@ -16,6 +18,8 @@ public class CarTrendAdapter extends SyncAdapter { private static final Logger logger = Logger.getLogger(CarTrendAdapter.class); private static final int MAX_METADATA_COUNT = 25; + private static final byte[] LOG_RESPONSE_SEPARATOR = "§|§".getBytes(); + private int requiredCount; private boolean protocolFound; private boolean identifySuccess; @@ -25,14 +29,15 @@ public class CarTrendAdapter extends SyncAdapter { private Queue initializeRing; private int ringSize; private int initialCount; + private ByteArrayOutputStream initialPhaseResponseLog = new ByteArrayOutputStream(); @Override protected BasicCommand pollNextInitializationCommand() { if (this.initializeRing == null) { this.initializeRing = new ArrayDeque<>(); - this.initializeRing.add(new EmptyCommand()); +// this.initializeRing.add(new EmptyCommand()); this.initializeRing.add(new IdentifyCommand()); - this.initializeRing.add(new EmptyCommand()); +// this.initializeRing.add(new EmptyCommand()); this.initializeRing.add(new ProtocolCommand("S")); this.initializeRing.add(new ProtocolCommand("1")); this.initializeRing.add(new ProtocolCommand("2")); @@ -71,6 +76,13 @@ protected List providePendingCommands() { @Override protected boolean analyzeMetadataResponse(byte[] response, BasicCommand sentCommand) throws AdapterFailedException { + try { + initialPhaseResponseLog.write(response); + initialPhaseResponseLog.write(LOG_RESPONSE_SEPARATOR); + } catch (IOException e) { + logger.warn("Error writing metadata response to initial log", e); + } + logger.info("Parsing meta response: "+ Base64.encodeToString(response, Base64.DEFAULT)+ "; sentCommand="+Base64.encodeToString(sentCommand.getOutputBytes(), Base64.DEFAULT)); @@ -214,4 +226,8 @@ public String toString() { } } + @Override + public String getStateMessage() { + return String.format("All initial responses: %s", Base64.encodeToString(this.initialPhaseResponseLog.toByteArray(), Base64.DEFAULT)); + } } diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/OBDAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/OBDAdapter.java index fbd1b8b08..077ee0e85 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/OBDAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/OBDAdapter.java @@ -100,4 +100,6 @@ enum ConnectionState { * @return the time (in ms) the adapter might take to connect to the OBD layer */ long getExpectedInitPeriod(); + + String getStateMessage(); } diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java index f88b8b659..50ec9c0d6 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java @@ -306,4 +306,9 @@ public long getExpectedInitPeriod() { protected abstract boolean analyzeMetadataResponse(byte[] response, BasicCommand sentCommand) throws AdapterFailedException; protected abstract byte[] preProcess(byte[] bytes) throws AdapterFailedException; + + @Override + public String getStateMessage() { + return "no state message"; + } } diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/async/AsyncAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/async/AsyncAdapter.java index f7966d2b2..b95c57f36 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/async/AsyncAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/async/AsyncAdapter.java @@ -226,4 +226,8 @@ public Observable observe() { */ protected abstract DataResponse processResponse(byte[] bytes) throws InvalidCommandResponseException, NoDataReceivedException, UnmatchedResponseException, AdapterSearchingException; + @Override + public String getStateMessage() { + return "no state message"; + } } From ff259d3cae2cc793a08056b4e23f2ed6bc2bafb2 Mon Sep 17 00:00:00 2001 From: dewall Date: Wed, 15 Jun 2016 16:58:10 +0200 Subject: [PATCH 003/389] removed empty commands for the cartrend adapter --- .../main/java/org/envirocar/obd/adapter/CarTrendAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java index 712a3efea..0f53088fa 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java @@ -30,9 +30,9 @@ public class CarTrendAdapter extends SyncAdapter { protected BasicCommand pollNextInitializationCommand() { if (this.initializeRing == null) { this.initializeRing = new ArrayDeque<>(); - this.initializeRing.add(new EmptyCommand()); +// this.initializeRing.add(new EmptyCommand()); this.initializeRing.add(new IdentifyCommand()); - this.initializeRing.add(new EmptyCommand()); +// this.initializeRing.add(new EmptyCommand()); this.initializeRing.add(new ProtocolCommand("S")); this.initializeRing.add(new ProtocolCommand("1")); this.initializeRing.add(new ProtocolCommand("2")); From b22c2f3dca53635111f8eaa1d434299da66999f8 Mon Sep 17 00:00:00 2001 From: dewall Date: Thu, 16 Jun 2016 13:53:49 +0200 Subject: [PATCH 004/389] reduced the sleep for retrieving the response --- .../src/main/java/org/envirocar/obd/adapter/SyncAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java index 50ec9c0d6..a1b318efc 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/SyncAdapter.java @@ -112,7 +112,7 @@ public void call(Subscriber subscriber) { //check if the command needs a response (most likely) if (cc.awaitsResults()) { try { - Thread.sleep(1000); + Thread.sleep(750); LOGGER.info("Retrieving initial phase response..."); byte[] resp = commandExecutor.retrieveLatestResponse(); LOGGER.info("Retrieved initial phase response: "+Base64.encodeToString(resp, Base64.DEFAULT)); From c78c2880ca5965d33251b160da1311b2b8d8451d Mon Sep 17 00:00:00 2001 From: dewall Date: Thu, 16 Jun 2016 13:57:12 +0200 Subject: [PATCH 005/389] reduced expected init period for the cartrend adapter --- .../main/java/org/envirocar/obd/adapter/CarTrendAdapter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java index 2d55bb49b..8c8f0a7fa 100644 --- a/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java +++ b/org.envirocar.obd/src/main/java/org/envirocar/obd/adapter/CarTrendAdapter.java @@ -19,6 +19,7 @@ public class CarTrendAdapter extends SyncAdapter { private static final Logger logger = Logger.getLogger(CarTrendAdapter.class); private static final int MAX_METADATA_COUNT = 25; private static final byte[] LOG_RESPONSE_SEPARATOR = "§|§".getBytes(); + private static final long EXPECTED_INIT_PERIOD = 27500; private int requiredCount; private boolean protocolFound; @@ -155,7 +156,7 @@ public boolean hasCertifiedConnection() { @Override public long getExpectedInitPeriod() { - return 35000; + return EXPECTED_INIT_PERIOD; } private static class ConfigCommand extends GenericCommand { From 7c07b167c822c2784365825cc77ba94fc3eba361 Mon Sep 17 00:00:00 2001 From: dewall Date: Thu, 16 Jun 2016 14:05:57 +0200 Subject: [PATCH 006/389] raised version --- build.gradle | 4 ++-- org.envirocar.app/AndroidManifest.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 3bc964c0f..1c33f81af 100644 --- a/build.gradle +++ b/build.gradle @@ -40,8 +40,8 @@ ext { compileSdkVersion = 23 targetSdkVersion = 23 buildToolsVersion = '23.0.2' - versionCode = 33 - versionName = "0.22.4" + versionCode = 34 + versionName = "0.22.5" javaCompileVersion = JavaVersion.VERSION_1_8 diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index c2ec0c5cc..c01c9f2cd 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -3,8 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="org.envirocar.app" android:installLocation="internalOnly" - android:versionCode="33" - android:versionName="0.22.4"> + android:versionCode="34" + android:versionName="0.22.5"> Date: Sun, 19 Jun 2016 19:53:42 +0200 Subject: [PATCH 007/389] corrected german string --- org.envirocar.app/res/values-de/strings_notification.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.envirocar.app/res/values-de/strings_notification.xml b/org.envirocar.app/res/values-de/strings_notification.xml index 609854058..13d9b60f0 100644 --- a/org.envirocar.app/res/values-de/strings_notification.xml +++ b/org.envirocar.app/res/values-de/strings_notification.xml @@ -45,7 +45,7 @@ starte die Aufzeichnung. - Zeiche auf... + Zeichne auf... Fahrt wird aufgezeichnet. Aufzeichnung beenden From 272a9f1f868e1b40fa03c70aa32a1709b01732f6 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Fri, 2 Mar 2018 17:48:37 +0530 Subject: [PATCH 008/389] Removed extra "w" in AndroidManifest (line no 102) of org.envirocar.app package --- org.envirocar.app/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index c2ec0c5cc..206656faa 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -99,7 +99,7 @@ - w + From d1653a3884ca44b1c3f1cac179989076fe2f6f5b Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Fri, 2 Mar 2018 23:08:20 +0530 Subject: [PATCH 009/389] Fixed Issue #311 and #312 --- .../layout/activity_car_selection_layout.xml | 19 +++++---- ...activity_car_selection_newcar_fragment.xml | 2 +- .../res/layout/activity_logbook.xml | 34 ++++++++++++---- .../activity_logbook_add_fueling_card.xml | 7 +++- .../carselection/CarSelectionActivity.java | 3 ++ .../app/view/logbook/LogbookActivity.java | 25 +++++++----- .../logbook/LogbookAddFuelingFragment.java | 39 ++++++++++++++++++- 7 files changed, 99 insertions(+), 30 deletions(-) diff --git a/org.envirocar.app/res/layout/activity_car_selection_layout.xml b/org.envirocar.app/res/layout/activity_car_selection_layout.xml index 8b5725464..c84e32498 100644 --- a/org.envirocar.app/res/layout/activity_car_selection_layout.xml +++ b/org.envirocar.app/res/layout/activity_car_selection_layout.xml @@ -19,7 +19,7 @@ with the enviroCar app. If not, see http://www.gnu.org/licenses/. --> - - @@ -142,4 +136,13 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> - + + + + diff --git a/org.envirocar.app/res/layout/activity_car_selection_newcar_fragment.xml b/org.envirocar.app/res/layout/activity_car_selection_newcar_fragment.xml index 7a6933383..78f7ef7b1 100644 --- a/org.envirocar.app/res/layout/activity_car_selection_newcar_fragment.xml +++ b/org.envirocar.app/res/layout/activity_car_selection_newcar_fragment.xml @@ -31,7 +31,7 @@ android:layout_height="?actionBarSize" android:background="@color/blue_dark_cario" android:elevation="@dimen/spacing_medium" - android:visibility="gone"> + android:visibility="visible"> - + + - + + + @@ -116,4 +126,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> - + + + diff --git a/org.envirocar.app/res/layout/activity_logbook_add_fueling_card.xml b/org.envirocar.app/res/layout/activity_logbook_add_fueling_card.xml index 282f11bc4..76ff668da 100644 --- a/org.envirocar.app/res/layout/activity_logbook_add_fueling_card.xml +++ b/org.envirocar.app/res/layout/activity_logbook_add_fueling_card.xml @@ -23,7 +23,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/white" android:orientation="vertical"> @@ -71,7 +71,10 @@ + android:layout_height="match_parent" + android:background="@color/white" + android:id="@+id/activity_logbook_add_fueling_card_scrollview" + > { - addFuelingFragment = new LogbookAddFuelingFragment(); - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.activity_logbook_container, addFuelingFragment) - .commit(); - LOG.info("AddFuelingCard should now be visible"); - }); + ECAnimationUtils.animateShowView(this, overlayView, R.anim.fade_in); + ECAnimationUtils.animateHideView(this, newFuelingFab, R.anim.fade_out); + this.addFuelingFragment = new LogbookAddFuelingFragment(); + getSupportFragmentManager().beginTransaction() + .replace(R.id.activity_logbook_container, this.addFuelingFragment) + .commit(); + LOG.info("AddFuelingCard should now be visible"); + + + + } /** @@ -337,6 +342,6 @@ private void hideAddFuelingCard() { } private void showSnackbarInfo(int resourceID) { - Snackbar.make(toolbar, resourceID, Snackbar.LENGTH_LONG).show(); + Snackbar.make(newFuelingFab, resourceID, Snackbar.LENGTH_LONG).show(); } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java index 4d0da7d39..353146cb8 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java @@ -63,6 +63,7 @@ import butterknife.InjectView; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; +import rx.functions.Action0; import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; @@ -85,8 +86,12 @@ public class LogbookAddFuelingFragment extends BaseInjectorFragment { @InjectView(R.id.logbook_layout_addfueling_toolbar) protected Toolbar addFuelingToolbar; + @InjectView(R.id.activity_log_book_add_fueling_toolbar_exp) + protected View addFuelingToolbarExp; @InjectView(R.id.activity_logbook_add_fueling_card_content) protected View contentView; + @InjectView(R.id.activity_logbook_add_fueling_card_scrollview) + protected View contentScrollview; @InjectView(R.id.activity_logbook_add_fueling_car_selection) protected Spinner addFuelingCarSelection; @InjectView(R.id.logbook_add_fueling_milagetext) @@ -133,12 +138,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle addFuelingToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); addFuelingToolbar.inflateMenu(R.menu.menu_logbook_add_fueling); addFuelingToolbar.setNavigationOnClickListener(v -> - ((LogbookUiListener) getActivity()).onHideAddFuelingCard()); + closeThisFragment()); addFuelingToolbar.setOnMenuItemClickListener(item -> { onClickAddFueling(); return true; }); + // initially we set the toolbar exp to gone + addFuelingToolbar.setVisibility(View.GONE); + addFuelingToolbarExp.setVisibility(View.GONE); + contentScrollview.setVisibility(View.GONE); + initTextViews(); Car selectedCar = carHandler.getCar(); @@ -174,6 +184,18 @@ public void onDestroy() { super.onDestroy(); } + @Override + public void onResume() { + LOG.info("onResume()"); + super.onResume(); + ECAnimationUtils.animateShowView(getContext(), addFuelingToolbar, + R.anim.translate_slide_in_top_fragment); + ECAnimationUtils.animateShowView(getContext(), addFuelingToolbarExp, + R.anim.translate_slide_in_top_fragment); + ECAnimationUtils.animateShowView(getContext(), contentScrollview, + R.anim.translate_slide_in_bottom_fragment); + } + private void onClickAddFueling() { // Reset the errors. addFuelingMilageText.setError(null); @@ -601,4 +623,19 @@ public CharSequence filter(CharSequence source, int start, int end, Spanned dest return null; } } + + public void closeThisFragment() { + // ^^ + ECAnimationUtils.animateHideView(getContext(), + ((LogbookActivity) getActivity()).overlayView, R.anim.fade_out); + ECAnimationUtils.animateHideView(getContext(), R.anim + .translate_slide_out_top_fragment, addFuelingToolbar, addFuelingToolbarExp); + ECAnimationUtils.animateHideView(getContext(), contentScrollview, R.anim + .translate_slide_out_bottom, new Action0() { + @Override + public void call() { + ((LogbookUiListener) getActivity()).onHideAddFuelingCard(); + } + }); + } } From 73461ca3da6df3370bfc3538247dfcea0bcae4ae Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Sat, 3 Mar 2018 00:22:00 +0530 Subject: [PATCH 010/389] Repositioned the text "Help" in the toolbar to center in HelpActivity --- org.envirocar.app/res/layout/activity_help_layout_general.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/org.envirocar.app/res/layout/activity_help_layout_general.xml b/org.envirocar.app/res/layout/activity_help_layout_general.xml index 7c0e075a4..596f46572 100644 --- a/org.envirocar.app/res/layout/activity_help_layout_general.xml +++ b/org.envirocar.app/res/layout/activity_help_layout_general.xml @@ -41,6 +41,7 @@ app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginEnd="64dp" app:expandedTitleMarginStart="48dp" + app:expandedTitleGravity="bottom|center_horizontal" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:statusBarScrim="@android:color/transparent"> From 929b27a522757959092d15fdeb24748b87cb5cb9 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Sat, 3 Mar 2018 00:31:57 +0530 Subject: [PATCH 011/389] Title "Select a Car" is set to the toolbar of CarSelectionActivity --- .../envirocar/app/view/carselection/CarSelectionActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java index 5264065fd..f0e92453b 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java @@ -109,6 +109,7 @@ protected void onCreate(Bundle savedInstanceState) { setSupportActionBar(mToolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setTitle("Select a Car"); setupListView(); } From 9d97ebc9fec609412fbdaf6748e1ec40608eac59 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Sat, 3 Mar 2018 01:10:11 +0530 Subject: [PATCH 012/389] Solved the Issue #317 --- .../src/org/envirocar/app/view/SendLogFileFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java b/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java index fb04672b2..77bdaa4d6 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java @@ -111,7 +111,9 @@ private void resolveInputFields(View view) { * @param reportBundle the file to attach */ protected void sendLogFile(File reportBundle) { - Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); + Intent emailIntent = new Intent(android.content.Intent.ACTION_SENDTO); + emailIntent.setType("message/rfc822"); + emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{REPORTING_EMAIL}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, @@ -120,7 +122,7 @@ protected void sendLogFile(File reportBundle) { createEmailContents()); emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.fromFile(reportBundle)); - emailIntent.setType("application/zip"); + //emailIntent.setType("application/zip"); startActivity(Intent.createChooser(emailIntent, "Send Log Report")); getFragmentManager().popBackStack(); From 450372b1f19d96c96cd53188238868cbf6a2a47b Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Mon, 5 Mar 2018 00:50:06 +0530 Subject: [PATCH 013/389] Solved the Issue #319 --- .../src/org/envirocar/app/BaseMainActivity.java | 8 ++++++++ .../org/envirocar/app/view/SendLogFileFragment.java | 13 +++++++++++++ .../carselection/CarSelectionAddCarFragment.java | 10 +++++++++- .../app/view/logbook/LogbookAddFuelingFragment.java | 13 +++++++++++-- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java index ad2c2fbff..064172063 100644 --- a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java @@ -18,6 +18,7 @@ */ package org.envirocar.app; +import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -41,6 +42,7 @@ import android.view.MenuItem; import android.view.View; import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; import android.widget.TextView; import com.afollestad.materialdialogs.MaterialDialog; @@ -478,6 +480,7 @@ private void initNavigationDrawerLayout() { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); + hideKeyboard(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); @@ -746,4 +749,9 @@ private void readSavedState(Bundle savedInstanceState) { } } + public void hideKeyboard(View view) { + InputMethodManager inputMethodManager =(InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + } diff --git a/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java b/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java index 77bdaa4d6..fb42d8e2b 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/SendLogFileFragment.java @@ -18,6 +18,7 @@ */ package org.envirocar.app.view; +import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -25,6 +26,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; @@ -104,6 +106,12 @@ private void resolveInputFields(View view) { this.comments = (EditText) view.findViewById(R.id.send_log_comments); } + @Override + public void onPause() { + super.onPause(); + hideKeyboard(getView()); + } + /** * creates a new {@link Intent#ACTION_SEND} with the report * bundle attached. @@ -217,4 +225,9 @@ public boolean accept(File pathname) { return Arrays.asList(allFiles); } + public void hideKeyboard(View view) { + InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + } diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java index 484b857b0..9acd83ace 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java @@ -1,5 +1,6 @@ package org.envirocar.app.view.carselection; +import android.app.Activity; import android.graphics.Point; import android.os.Bundle; import android.support.annotation.Nullable; @@ -12,6 +13,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -135,7 +137,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); toolbar.inflateMenu(R.menu.menu_logbook_add_fueling); - toolbar.setNavigationOnClickListener(v -> closeThisFragment()); + toolbar.setNavigationOnClickListener(v -> {hideKeyboard(v); closeThisFragment(); }); // initially we set the toolbar exp to gone @@ -164,6 +166,7 @@ public void onError(Throwable e) { public void onNext(Car car) { LOG.info("car added"); ((CarSelectionUiListener) getActivity()).onCarAdded(car); + hideKeyboard(getView()); closeThisFragment(); } }); @@ -707,4 +710,9 @@ public void call() { } }); } + + public void hideKeyboard(View view) { + InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java index 4d0da7d39..4009bd427 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java @@ -18,6 +18,7 @@ */ package org.envirocar.app.view.logbook; +import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; @@ -27,6 +28,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; @@ -132,10 +134,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle addFuelingToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); addFuelingToolbar.inflateMenu(R.menu.menu_logbook_add_fueling); - addFuelingToolbar.setNavigationOnClickListener(v -> - ((LogbookUiListener) getActivity()).onHideAddFuelingCard()); + addFuelingToolbar.setNavigationOnClickListener(v ->{((LogbookUiListener) getActivity()).onHideAddFuelingCard(); + hideKeyboard(v);}); addFuelingToolbar.setOnMenuItemClickListener(item -> { onClickAddFueling(); + hideKeyboard(getView()); return true; }); @@ -601,4 +604,10 @@ public CharSequence filter(CharSequence source, int start, int end, Spanned dest return null; } } + + public void hideKeyboard(View view) { + InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + } From 100986bdcef4a9650d481adbd67ed551e57861d5 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Mon, 5 Mar 2018 21:05:50 +0530 Subject: [PATCH 014/389] During the merge conflict resolution, hideKeyboard() method is removed by mistake --- .../app/view/logbook/LogbookAddFuelingFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java index 22e84159c..c97a18555 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java @@ -645,4 +645,9 @@ public void call() { }); } + public void hideKeyboard(View view) { + InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); + inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + } From bfd77c3ed12f84d9e74a2ba95c0af5e353544bb2 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Wed, 16 May 2018 02:19:18 +0530 Subject: [PATCH 015/389] Solved the issue #322 --- .../layout/activity_track_details_layout2.xml | 35 +++++++++ .../trackdetails/TrackDetailsActivity.java | 78 +++++++++++++++++-- 2 files changed, 107 insertions(+), 6 deletions(-) diff --git a/org.envirocar.app/res/layout/activity_track_details_layout2.xml b/org.envirocar.app/res/layout/activity_track_details_layout2.xml index 4bde6f520..43b70ac58 100644 --- a/org.envirocar.app/res/layout/activity_track_details_layout2.xml +++ b/org.envirocar.app/res/layout/activity_track_details_layout2.xml @@ -42,6 +42,13 @@ app:layout_scrollFlags="scroll|exitUntilCollapsed" app:statusBarScrim="@android:color/transparent"> + + + + + + + + + + { + TrackStatisticsActivity.createInstance(TrackDetailsActivity.this, mTrackID); }); + + //closing the expanded mapview on "cancel" button clicked + mMapViewExpandedCancel.setOnClickListener(v-> closeExpandedMapView()); + //expanding the expandable mapview on clicking the framelayout which is surrounded by header map view in collapsingtoolbarlayout + mMapViewContainer.setOnClickListener(v-> expandMapView(track)); } private void updateStatusBarColor() { @@ -196,6 +216,16 @@ protected void onResume() { supportStartPostponedEnterTransition(); } + @Override + public void onBackPressed() { + //if the expandable mapview is expanded, then close it first + if(mMapViewExpandedContainer != null && mMapViewExpandedContainer.getVisibility() == View.VISIBLE){ + closeExpandedMapView(); + }else{ + super.onBackPressed(); + } + } + /** * Initializes the activity enter and return transitions of the activity. */ @@ -219,6 +249,7 @@ private void initMapView() { // Set the openstreetmap tile layer as baselayer of the map. WebSourceTileLayer source = MapUtils.getOSMTileLayer(); mMapView.setTileSource(source); + mMapViewExpanded.setTileSource(source); // set the bounding box and min and max zoom level accordingly. BoundingBox box = source.getBoundingBox(); @@ -244,6 +275,7 @@ private void initTrackPath(Track track) { // Adds the path overlay to the mapview. mMapView.getOverlays().add(trackMapOverlay); + mMapViewExpanded.getOverlays().add(trackMapOverlay); final BoundingBox viewBbox = trackMapOverlay.getViewBoundingBox(); final BoundingBox scrollableLimit = trackMapOverlay.getScrollableLimitBox(); @@ -251,7 +283,41 @@ private void initTrackPath(Track track) { mMapView.setScrollableAreaLimit(scrollableLimit); mMapView.setConstraintRegionFit(true); mMapView.zoomToBoundingBox(viewBbox, true); + mMapViewExpanded.zoomToBoundingBox(viewBbox, true); + } + + //function which expands the mapview + private void expandMapView(Track track){ + TrackSpeedMapOverlay trackMapOverlay = new TrackSpeedMapOverlay(track); + final BoundingBox viewBbox = trackMapOverlay.getViewBoundingBox(); + mMapViewExpanded.zoomToBoundingBox(viewBbox, true); + + animateShowView(mMapViewExpandedContainer,R.anim.translate_slide_in_top_fragment); + animateHideView(mAppBarLayout,R.anim.translate_slide_out_top_fragment); + animateHideView(mNestedScrollView,R.anim.translate_slide_out_bottom); + animateHideView(mFAB,R.anim.fade_out); + } + + //function which closes the expanded mapview + private void closeExpandedMapView(){ + animateHideView(mMapViewExpandedContainer,R.anim.translate_slide_out_top_fragment); + animateShowView(mAppBarLayout,R.anim.translate_slide_in_top_fragment); + animateShowView(mNestedScrollView,R.anim.translate_slide_in_bottom_fragment); + animateShowView(mFAB,R.anim.fade_in); + } + + //general function to animate the view and hide it + private void animateHideView(View view, int animResource){ + Animation animation = AnimationUtils.loadAnimation(getApplicationContext(),animResource); + view.startAnimation(animation); + view.setVisibility(View.GONE); + } + //general function to animate and show the view + private void animateShowView(View view, int animResource){ + Animation animation = AnimationUtils.loadAnimation(getApplicationContext(),animResource); + view.setVisibility(View.VISIBLE); + view.startAnimation(animation); } private void initViewValues(Track track) { From ba8ee09e16e88ac0f0a8cf12745a978ef86f6e4d Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Wed, 16 May 2018 02:26:08 +0530 Subject: [PATCH 016/389] Solved the issue #322(a minor change) --- org.envirocar.app/res/layout/activity_track_details_layout2.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/org.envirocar.app/res/layout/activity_track_details_layout2.xml b/org.envirocar.app/res/layout/activity_track_details_layout2.xml index 43b70ac58..9ccd7224d 100644 --- a/org.envirocar.app/res/layout/activity_track_details_layout2.xml +++ b/org.envirocar.app/res/layout/activity_track_details_layout2.xml @@ -46,6 +46,7 @@ android:id="@+id/activity_track_details_header_map_container" android:layout_width="match_parent" android:layout_height="match_parent" + android:elevation="1dp" android:background="@android:color/transparent" /> From 1f32e5745e743d45dfb9138b28f00517047c7300 Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Thu, 17 May 2018 00:23:22 +0530 Subject: [PATCH 017/389] Most of the libraries like Android Support libraries, Butterknife, MaterialDialogs, fabProgressCircle, rxbinding, hellocharts-library, commons-compress were updated(Dagger is remaining, app will not run without updating Dagger) --- android-obd-simulator/build.gradle | 10 +-- build.gradle | 34 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- org.envirocar.algorithm/build.gradle | 18 ++--- org.envirocar.app/build.gradle | 78 +++++++++---------- .../org/envirocar/app/BaseMainActivity.java | 16 ++-- .../org/envirocar/app/view/HelpActivity.java | 6 +- .../org/envirocar/app/view/LoginActivity.java | 44 +++++------ .../app/view/UserStatisticsAdapter.java | 12 +-- .../carselection/CarSelectionActivity.java | 18 ++--- .../CarSelectionAddCarFragment.java | 34 ++++---- .../carselection/CarSelectionListAdapter.java | 16 ++-- .../view/dashboard/DashboardMainFragment.java | 12 +-- .../view/dashboard/DashboardMapFragment.java | 6 +- .../dashboard/DashboardTempomatFragment.java | 6 +- .../DashboardTrackDetailsFragment.java | 18 ++--- .../dashboard/DashboardTrackMapFragment.java | 8 +- .../DashboardTrackSettingsFragment.java | 16 ++-- .../app/view/logbook/LogbookActivity.java | 26 +++---- .../logbook/LogbookAddFuelingFragment.java | 36 ++++----- .../logbook/LogbookCarSpinnerAdapter.java | 8 +- .../app/view/logbook/LogbookListAdapter.java | 22 +++--- .../obdselection/OBDDeviceListAdapter.java | 12 +-- .../obdselection/OBDSelectionActivity.java | 10 +-- .../obdselection/OBDSelectionFragment.java | 16 ++-- .../BluetoothDiscoveryIntervalPreference.java | 12 +-- .../BluetoothPairingPreference.java | 18 ++--- .../bluetooth/SelectBluetoothAdapter.java | 3 - .../app/view/settings/SettingsActivity.java | 16 ++-- .../trackdetails/TrackDetailsActivity.java | 26 +++---- .../trackdetails/TrackStatisticsActivity.java | 12 +-- .../AbstractTrackListCardAdapter.java | 24 +++--- .../AbstractTrackListCardFragment.java | 22 +++--- .../tracklist/TrackListPagerFragment.java | 8 +- .../app/view/utils/TimerInputView.java | 12 +-- org.envirocar.core/build.gradle | 26 +++---- org.envirocar.obd/build.gradle | 22 +++--- org.envirocar.remote/build.gradle | 22 +++--- org.envirocar.storage/build.gradle | 22 +++--- 39 files changed, 355 insertions(+), 374 deletions(-) diff --git a/android-obd-simulator/build.gradle b/android-obd-simulator/build.gradle index 9ec424eac..fc5e94359 100644 --- a/android-obd-simulator/build.gradle +++ b/android-obd-simulator/build.gradle @@ -1,12 +1,12 @@ -apply plugin: 'android' +apply plugin: 'com.android.application' dependencies { - compile fileTree(dir: 'libs', include: '*.jar') + implementation fileTree(dir: 'libs', include: '*.jar') } android { - compileSdkVersion 23 - buildToolsVersion "23.0.2" + compileSdkVersion 27 + buildToolsVersion "27.0.3" sourceSets { main { @@ -20,7 +20,7 @@ android { } // Move the tests to tests/java, tests/res, etc... - instrumentTest.setRoot('tests') + androidTest.setRoot('tests') // Move the build types to build-types/ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... diff --git a/build.gradle b/build.gradle index 1c33f81af..206ea9ed5 100644 --- a/build.gradle +++ b/build.gradle @@ -4,12 +4,11 @@ buildscript { jcenter() maven { url "https://jitpack.io" } maven { url "https://plugins.gradle.org/m2/" } + google() } dependencies { - classpath 'me.tatarka:gradle-retrolambda:3.2.3' - classpath 'com.android.tools.build:gradle:2.1.0' - classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7+' + classpath 'com.android.tools.build:gradle:3.1.2' classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1" } } @@ -31,31 +30,33 @@ allprojects { maven { url "https://jitpack.io" } mavenCentral() jcenter() + google() } } ext { - androidPlugin = 'com.android.tools.build:gradle:2.1.0' + androidPlugin = 'com.android.tools.build:gradle:3.1.2' minSdkVersion = 16 - compileSdkVersion = 23 - targetSdkVersion = 23 - buildToolsVersion = '23.0.2' + compileSdkVersion = 27 + targetSdkVersion = 27 + buildToolsVersion = '27.0.3' versionCode = 34 versionName = "0.22.5" javaCompileVersion = JavaVersion.VERSION_1_8 // Android dependencies. - supportV4 = 'com.android.support:support-v4:23.2.0' - supportV7 = 'com.android.support:appcompat-v7:23.2.0' - supportDesign = 'com.android.support:design:23.2.0' - supportCardview = 'com.android.support:cardview-v7:23.2.0' - supportRecyclerview = 'com.android.support:recyclerview-v7:23.2.0' + supportV4 = 'com.android.support:support-v4:27.1.1' + supportV7 = 'com.android.support:appcompat-v7:27.1.1' + supportDesign = 'com.android.support:design:27.1.1' + supportCardview = 'com.android.support:cardview-v7:27.1.1' + supportRecyclerview = 'com.android.support:recyclerview-v7:27.1.1' // Dependency injection, view injection, event bus... dagger = 'com.squareup.dagger:dagger:1.2.2' daggerCompiler = 'com.squareup.dagger:dagger-compiler:1.2.2' - butterKnife = 'com.jakewharton:butterknife:6.1.0' + butterKnife = 'com.jakewharton:butterknife:8.8.1' + butterknifeCompiler = 'com.jakewharton:butterknife-compiler:8.8.1' otto = 'com.squareup:otto:1.3.8' // Retrofit dependencies. @@ -67,7 +68,6 @@ ext { // RxJava dependencies. rxJava = 'io.reactivex:rxjava:1.0.16' rxAndroid = 'io.reactivex:rxandroid:1.0.1' - //rxBinding = 'com.jakewharton.rxbinding:rxbinding:0.3.0' rxPreferences = 'com.f2prateek.rx.preferences:rx-preferences:1.0.1' sqlBrite = 'com.squareup.sqlbrite:sqlbrite:0.4.1' @@ -80,9 +80,9 @@ ext { acra = 'ch.acra:acra:4.6.2' // other third party dependencies. - materialDialogs = 'com.github.afollestad.material-dialogs:core:0.8.5.6@aar' - helloCharts = 'com.github.lecho:hellocharts-library:1.5.5@aar' - fabProgressCircle = 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar' + materialDialogs = 'com.afollestad.material-dialogs:core:0.9.6.0' + helloCharts = 'com.github.lecho:hellocharts-library:1.5.8@aar' + fabProgressCircle = 'com.github.jorgecastilloprz:fabprogresscircle:1.01' mapbox = 'com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4@aar' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aef5dcf10..29a7f5385 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/org.envirocar.algorithm/build.gradle b/org.envirocar.algorithm/build.gradle index 6e69bc1ce..c236f2ebc 100644 --- a/org.envirocar.algorithm/build.gradle +++ b/org.envirocar.algorithm/build.gradle @@ -1,6 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'com.neenbedankt.android-apt' -apply plugin: 'me.tatarka.retrolambda' android { compileSdkVersion rootProject.ext.compileSdkVersion @@ -27,15 +25,15 @@ android { } dependencies { - testCompile 'junit:junit:4.12' - androidTestCompile 'junit:junit:4.12' - compile supportV7 + testImplementation 'junit:junit:4.12' + androidTestImplementation 'junit:junit:4.12' + implementation supportV7 - compile rootProject.ext.dagger - apt rootProject.ext.daggerCompiler + implementation rootProject.ext.dagger + annotationProcessor rootProject.ext.daggerCompiler - compile rootProject.ext.rxAndroid - compile rootProject.ext.rxJava + implementation rootProject.ext.rxAndroid + implementation rootProject.ext.rxJava - compile project(':org.envirocar.obd') + api project(path : ':org.envirocar.obd') } diff --git a/org.envirocar.app/build.gradle b/org.envirocar.app/build.gradle index 5b00e8b98..131f5e8b5 100644 --- a/org.envirocar.app/build.gradle +++ b/org.envirocar.app/build.gradle @@ -1,64 +1,60 @@ apply plugin: 'com.android.application' //or apply plugin: 'java' -apply plugin: 'com.neenbedankt.android-apt' -apply plugin: 'me.tatarka.retrolambda' apply plugin: "com.github.hierynomus.license" dependencies { - compile rootProject.ext.supportV4 - compile rootProject.ext.supportV7 - compile rootProject.ext.supportDesign - compile rootProject.ext.supportCardview - compile rootProject.ext.supportRecyclerview - compile rootProject.ext.dagger - //apt rootProject.ext.daggerCompiler - provided rootProject.ext.daggerCompiler - compile rootProject.ext.sqlBrite - compile rootProject.ext.otto - compile rootProject.ext.butterKnife - compile rootProject.ext.acra - compile rootProject.ext.helloCharts - compile rootProject.ext.fabProgressCircle - compile rootProject.ext.gson - //compile rootProject.ext.guava - compile(materialDialogs) { + implementation rootProject.ext.supportV4 + implementation rootProject.ext.supportV7 + implementation rootProject.ext.supportDesign + implementation rootProject.ext.supportCardview + implementation rootProject.ext.supportRecyclerview + implementation rootProject.ext.dagger + //annotationProcessor rootProject.ext.daggerCompiler + compileOnly rootProject.ext.daggerCompiler + implementation rootProject.ext.otto + implementation rootProject.ext.butterKnife + annotationProcessor rootProject.ext.butterknifeCompiler + implementation rootProject.ext.acra + implementation rootProject.ext.helloCharts + implementation rootProject.ext.fabProgressCircle + implementation rootProject.ext.gson + //implementation rootProject.ext.guava + implementation(materialDialogs) { exclude module: 'appcompat-v7' exclude module: 'recyclerview-v7' exclude module: 'support-annotations' transitive = true } - compile rootProject.ext.rxAndroid - compile rootProject.ext.rxJava - compile rootProject.ext.rxPreferences - compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.3.0' - compile rootProject.ext.findBugs - // Commons compress - compile 'org.apache.commons:commons-compress:1.5' + implementation rootProject.ext.rxAndroid + implementation rootProject.ext.rxJava + implementation rootProject.ext.rxPreferences + implementation 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0' + implementation rootProject.ext.findBugs // MapBox SDK - compile(rootProject.ext.mapbox) { + implementation(rootProject.ext.mapbox) { transitive = true } - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.9.5' - testCompile('org.powermock:powermock-api-mockito:1.6.2') { + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-core:1.9.5' + testImplementation('org.powermock:powermock-api-mockito:1.6.2') { exclude module: 'hamcrest-core' exclude module: 'objenesis' } - testCompile('org.powermock:powermock-module-junit4:1.6.2') { + testImplementation('org.powermock:powermock-module-junit4:1.6.2') { exclude module: 'hamcrest-core' exclude module: 'objenesis' } - androidTestCompile 'junit:junit:4.12' - androidTestCompile('com.android.support.test:runner:0.3') { + androidTestImplementation 'junit:junit:4.12' + androidTestImplementation('com.android.support.test:runner:0.3') { exclude module: 'support-annotations' } - androidTestCompile('com.android.support.test:rules:0.3') { + androidTestImplementation('com.android.support.test:rules:0.3') { exclude module: 'support-annotations' } - compile project(':org.envirocar.core') - compile project(':org.envirocar.remote') - compile project(':org.envirocar.obd') - compile project(':org.envirocar.storage') - compile project(':org.envirocar.algorithm') + api project(path: ':org.envirocar.core') + api project(path: ':org.envirocar.remote') + api project(path: ':org.envirocar.obd') + api project(path: ':org.envirocar.storage') + api project(path: ':org.envirocar.algorithm') } @@ -119,7 +115,3 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } - -retrolambda { - javaVersion JavaVersion.VERSION_1_7 -} diff --git a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java index 064172063..f90e0b06f 100644 --- a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java @@ -91,7 +91,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.subscriptions.CompositeSubscription; @@ -125,18 +125,18 @@ public class BaseMainActivity extends BaseInjectorActivity { protected BluetoothHandler mBluetoothHandler; - @InjectView(R.id.main_layout_toolbar) + @BindView(R.id.main_layout_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.drawer_layout) + @BindView(R.id.drawer_layout) protected DrawerLayout mDrawerLayout; - @InjectView(R.id.nav_drawer_navigation_view) + @BindView(R.id.nav_drawer_navigation_view) protected NavigationView mNavigationView; - @InjectView(R.id.nav_drawer_list_header_layout) + @BindView(R.id.nav_drawer_list_header_layout) protected View mHeaderLayout; - @InjectView(R.id.nav_drawer_list_header_username) + @BindView(R.id.nav_drawer_list_header_username) protected TextView mUsernameText; - @InjectView(R.id.nav_drawer_list_header_email) + @BindView(R.id.nav_drawer_list_header_email) protected TextView mEmailText; @@ -177,7 +177,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.main_layout); mNavigationView = (NavigationView) findViewById(R.id.nav_drawer_navigation_view); LayoutInflater.from(this).inflate(R.layout.nav_drawer_list_header, mNavigationView); - ButterKnife.inject(this); + ButterKnife.bind(this); // Initializes the Toolbar. setSupportActionBar(mToolbar); diff --git a/org.envirocar.app/src/org/envirocar/app/view/HelpActivity.java b/org.envirocar.app/src/org/envirocar/app/view/HelpActivity.java index f40395418..5f59391f6 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/HelpActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/HelpActivity.java @@ -26,7 +26,7 @@ import org.envirocar.app.R; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * TODO JavaDoc @@ -35,7 +35,7 @@ */ public class HelpActivity extends AppCompatActivity { - @InjectView(R.id.activity_help_layout_general_toolbar) + @BindView(R.id.activity_help_layout_general_toolbar) protected Toolbar toolbar; @Override @@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_help_layout_general); // Inject views - ButterKnife.inject(this); + ButterKnife.bind(this); // Set Actionbar setSupportActionBar(toolbar); diff --git a/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java b/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java index a361a5b0f..7ccba15a9 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java @@ -63,7 +63,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import rx.Scheduler; import rx.Subscriber; @@ -80,49 +80,49 @@ public class LoginActivity extends BaseInjectorActivity { private static final Logger LOG = Logger.getLogger(LoginActivity.class); - @InjectView(R.id.activity_login_toolbar) + @BindView(R.id.activity_login_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.activity_login_exp_toolbar) + @BindView(R.id.activity_login_exp_toolbar) protected Toolbar mExpToolbar; - @InjectView(R.id.activity_login_logo_dump) + @BindView(R.id.activity_login_logo_dump) protected View mLogoView; - @InjectView(R.id.activity_login_exp_toolbar_content) + @BindView(R.id.activity_login_exp_toolbar_content) protected View mExpToolbarContent; - @InjectView(R.id.activity_login_account_image) + @BindView(R.id.activity_login_account_image) protected ImageView mAccountImage; - @InjectView(R.id.activity_login_account_name) + @BindView(R.id.activity_login_account_name) protected TextView mAccountName; - @InjectView(R.id.activity_account_exp_toolbar_tracknumber) + @BindView(R.id.activity_account_exp_toolbar_tracknumber) protected TextView mGlobalTrackNumber; - @InjectView(R.id.activity_account_exp_toolbar_local_tracknumber) + @BindView(R.id.activity_account_exp_toolbar_local_tracknumber) protected TextView mLocalTrackNumber; - @InjectView(R.id.activity_account_exp_toolbar_remote_tracknumber) + @BindView(R.id.activity_account_exp_toolbar_remote_tracknumber) protected TextView mRemoteTrackNumber; - @InjectView(R.id.activity_login_card) + @BindView(R.id.activity_login_card) protected CardView mLoginCard; - @InjectView(R.id.activity_account_login_card_username_text) + @BindView(R.id.activity_account_login_card_username_text) protected EditText mLoginUsername; - @InjectView(R.id.activity_account_login_card_password_text) + @BindView(R.id.activity_account_login_card_password_text) protected EditText mLoginPassword; - @InjectView(R.id.activity_register_card) + @BindView(R.id.activity_register_card) protected CardView mRegisterCard; - @InjectView(R.id.activity_account_register_email_input) + @BindView(R.id.activity_account_register_email_input) protected EditText mRegisterEmail; - @InjectView(R.id.activity_account_register_username_input) + @BindView(R.id.activity_account_register_username_input) protected EditText mRegisterUsername; - @InjectView(R.id.activity_account_register_password_input) + @BindView(R.id.activity_account_register_password_input) protected EditText mRegisterPassword; - @InjectView(R.id.activity_account_register_password2_input) + @BindView(R.id.activity_account_register_password2_input) protected EditText mRegisterPassword2; - @InjectView(R.id.activity_account_statistics_no_statistics_info) + @BindView(R.id.activity_account_statistics_no_statistics_info) protected View mNoStatisticsInfo; - @InjectView(R.id.activity_account_statistics_listview) + @BindView(R.id.activity_account_statistics_listview) protected ListView mStatisticsListView; - @InjectView(R.id.activity_account_statistics_progress) + @BindView(R.id.activity_account_statistics_progress) protected View mStatisticsProgressView; @Inject @@ -151,7 +151,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_login); // Inject the Views. - ButterKnife.inject(this); + ButterKnife.bind(this); TypefaceEC.applyCustomFont((ViewGroup) mAccountName.getParent(), TypefaceEC.Raleway(this)); diff --git a/org.envirocar.app/src/org/envirocar/app/view/UserStatisticsAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/UserStatisticsAdapter.java index 9e1d655cf..cfc9dc06c 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/UserStatisticsAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/UserStatisticsAdapter.java @@ -32,7 +32,7 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @author dewall @@ -66,7 +66,7 @@ public View getView(int position, View convertView, ViewGroup parent) { // Create a new viewholder and inject the sub-views of the newly inflated convertView. viewHolder = new ViewHolder(); - ButterKnife.inject(viewHolder, convertView); + ButterKnife.bind(viewHolder, convertView); // Set the viewHolder as tag on the convertView. convertView.setTag(viewHolder); @@ -86,13 +86,13 @@ public View getView(int position, View convertView, ViewGroup parent) { } static final class ViewHolder { - @InjectView(R.id.activity_account_statistics_list_entry_phenomenon) + @BindView(R.id.activity_account_statistics_list_entry_phenomenon) TextView mPhenomenonTextView; - @InjectView(R.id.activity_account_statistics_list_entry_avg_value) + @BindView(R.id.activity_account_statistics_list_entry_avg_value) TextView mAvgValue; - @InjectView(R.id.activity_account_statistics_list_entry_max_value) + @BindView(R.id.activity_account_statistics_list_entry_max_value) TextView mMaxValue; - @InjectView(R.id.activity_account_statistics_list_entry_min_value) + @BindView(R.id.activity_account_statistics_list_entry_min_value) TextView mMinValue; } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java index 1b42a667e..5b49f5a9c 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java @@ -45,7 +45,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import rx.Observable; import rx.Subscriber; @@ -61,21 +61,21 @@ public class CarSelectionActivity extends BaseInjectorActivity implements CarSel private static final int DURATION_SHEET_ANIMATION = 350; - @InjectView(R.id.activity_car_selection_layout_content) + @BindView(R.id.activity_car_selection_layout_content) protected View mContentView; - @InjectView(R.id.activity_car_selection_layout_toolbar) + @BindView(R.id.activity_car_selection_layout_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.activity_car_selection_layout_exptoolbar) + @BindView(R.id.activity_car_selection_layout_exptoolbar) protected Toolbar mExpToolbar; - @InjectView(R.id.actvity_car_selection_layout_loading) + @BindView(R.id.actvity_car_selection_layout_loading) protected View loadingView; - @InjectView(R.id.overlay) + @BindView(R.id.overlay) protected View overlayView; - @InjectView(R.id.activity_car_selection_new_car_fab) + @BindView(R.id.activity_car_selection_new_car_fab) protected FloatingActionButton mFab; - @InjectView(R.id.activity_car_selection_layout_carlist) + @BindView(R.id.activity_car_selection_layout_carlist) protected ListView mCarListView; @Inject @@ -103,7 +103,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_car_selection_layout); // Inject all annotated views. - ButterKnife.inject(this); + ButterKnife.bind(this); // Set the toolbar as default actionbar. setSupportActionBar(mToolbar); diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java index 9acd83ace..ad15b2120 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java @@ -45,7 +45,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Scheduler; import rx.Subscriber; import rx.Subscription; @@ -62,40 +62,40 @@ public class CarSelectionAddCarFragment extends BaseInjectorFragment { private static final Logger LOG = Logger.getLogger(CarSelectionAddCarFragment.class); - @InjectView(R.id.activity_car_selection_newcar_toolbar) + @BindView(R.id.activity_car_selection_newcar_toolbar) protected Toolbar toolbar; - @InjectView(R.id.activity_car_selection_newcar_toolbar_exp) + @BindView(R.id.activity_car_selection_newcar_toolbar_exp) protected View toolbarExp; - @InjectView(R.id.activity_car_selection_newcar_content_view) + @BindView(R.id.activity_car_selection_newcar_content_view) protected View contentView; - @InjectView(R.id.activity_car_selection_newcar_download_layout) + @BindView(R.id.activity_car_selection_newcar_download_layout) protected View downloadView; - @InjectView(R.id.activity_car_selection_newcar_manufacturer) + @BindView(R.id.activity_car_selection_newcar_manufacturer) protected TextView manufacturerText; - @InjectView(R.id.activity_car_selection_newcar_manufacturer_spinner) + @BindView(R.id.activity_car_selection_newcar_manufacturer_spinner) protected Spinner manufacturerSpinner; - @InjectView(R.id.activity_car_selection_newcar_model) + @BindView(R.id.activity_car_selection_newcar_model) protected TextView modelText; - @InjectView(R.id.activity_car_selection_newcar_model_spinner) + @BindView(R.id.activity_car_selection_newcar_model_spinner) protected Spinner modelSpinner; - @InjectView(R.id.activity_car_selection_newcar_year) + @BindView(R.id.activity_car_selection_newcar_year) protected TextView yearText; - @InjectView(R.id.activity_car_selection_newcar_year_spinner) + @BindView(R.id.activity_car_selection_newcar_year_spinner) protected Spinner yearSpinner; - @InjectView(R.id.activity_car_selection_newcar_engine) + @BindView(R.id.activity_car_selection_newcar_engine) protected TextView engineText; - @InjectView(R.id.activity_car_selection_newcar_engine_spinner) + @BindView(R.id.activity_car_selection_newcar_engine_spinner) protected Spinner engineSpinner; - @InjectView(R.id.activity_car_selection_newcar_radio_group) + @BindView(R.id.activity_car_selection_newcar_radio_group) protected RadioGroup fuelTypeRadioGroup; - @InjectView(R.id.activity_car_selection_newcar_radio_group_gasoline) + @BindView(R.id.activity_car_selection_newcar_radio_group_gasoline) protected RadioButton gasolineRadio; - @InjectView(R.id.activity_car_selection_newcar_radio_group_diesel) + @BindView(R.id.activity_car_selection_newcar_radio_group_diesel) protected RadioButton dieselRadio; @Inject @@ -121,7 +121,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View view = inflater.inflate( R.layout.activity_car_selection_newcar_fragment, container, false); - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); // Get the display size in pixels Display display = getActivity().getWindowManager().getDefaultDisplay(); diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionListAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionListAdapter.java index 227b75b23..a0b1e324d 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionListAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionListAdapter.java @@ -36,7 +36,7 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @author dewall @@ -221,19 +221,19 @@ static class CarViewHolder { protected final View mCoreView; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_icon) + @BindView(R.id.activity_car_selection_layout_carlist_entry_icon) protected ImageView mIconView; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_firstline) + @BindView(R.id.activity_car_selection_layout_carlist_entry_firstline) protected TextView mFirstLineText; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_engine) + @BindView(R.id.activity_car_selection_layout_carlist_entry_engine) protected TextView mEngineText; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_gasoline) + @BindView(R.id.activity_car_selection_layout_carlist_entry_gasoline) protected TextView mGasolineText; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_year) + @BindView(R.id.activity_car_selection_layout_carlist_entry_year) protected TextView mYearText; - @InjectView(R.id.activity_car_selection_layout_carlist_entry_radio) + @BindView(R.id.activity_car_selection_layout_carlist_entry_radio) protected RadioButton mRadioButton; /** @@ -243,7 +243,7 @@ static class CarViewHolder { */ CarViewHolder(View view) { this.mCoreView = view; - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); } } } \ No newline at end of file diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java index 2e5600b68..d4f16926a 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java @@ -55,7 +55,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import rx.Scheduler; import rx.Subscriber; @@ -78,13 +78,13 @@ public class DashboardMainFragment extends BaseInjectorFragment { @Inject protected LocationHandler mLocationHandler; - @InjectView(R.id.fragment_startup_info_field) + @BindView(R.id.fragment_startup_info_field) protected View mInfoField; - @InjectView(R.id.fragment_startup_info_text) + @BindView(R.id.fragment_startup_info_text) protected TextView mInfoText; - @InjectView(R.id.fragment_startup_start_button) + @BindView(R.id.fragment_startup_start_button) protected View mStartStopButton; - @InjectView(R.id.fragment_startup_start_button_inner) + @BindView(R.id.fragment_startup_start_button_inner) protected TextView mStartStopButtonInner; private MaterialDialog mConnectingDialog; @@ -115,7 +115,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View contentView = inflater.inflate(R.layout.fragment_startup, container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // Get the settings fragment and the header fragment. mDashboardSettingsFragment = getChildFragmentManager() diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java index 8ff07483d..f5c9b3d1d 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java @@ -33,7 +33,7 @@ import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * TODO JavaDoc @@ -43,7 +43,7 @@ public class DashboardMapFragment extends BaseInjectorFragment { private static final Logger LOG = Logger.getLogger(DashboardMapFragment.class); - @InjectView(R.id.fragment_dashboard_frag_map_mapview) + @BindView(R.id.fragment_dashboard_frag_map_mapview) protected MapView mMapView; @Nullable @@ -56,7 +56,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View contentView = inflater.inflate(R.layout.fragment_dashboard_frag_map, container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // Init the map view mMapView.setTileSource(MapUtils.getOSMTileLayer()); diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java index 5dc3c1d23..e0d4b7c8f 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java @@ -35,7 +35,7 @@ import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @author dewall @@ -43,7 +43,7 @@ public class DashboardTempomatFragment extends BaseInjectorFragment { private static final Logger LOG = Logger.getLogger(DashboardTempomatFragment.class); - @InjectView(R.id.fragment_dashboard_tempomat_view) + @BindView(R.id.fragment_dashboard_tempomat_view) protected Tempomat mTempomatView; @Nullable @@ -58,7 +58,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View contentView = inflater.inflate(R.layout.fragment_dashboard, container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // return the inflated content view. return contentView; diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java index f57ffc582..eb45179ab 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java @@ -44,7 +44,7 @@ import java.text.DecimalFormat; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; @@ -57,21 +57,21 @@ public class DashboardTrackDetailsFragment extends BaseInjectorFragment { private static final DecimalFormat DECIMAL_FORMATTER = new DecimalFormat("###.#"); - @InjectView(R.id.fragment_dashboard_header_gps_image) + @BindView(R.id.fragment_dashboard_header_gps_image) protected ImageView mGpsImage; - @InjectView(R.id.fragment_dashboard_header_gps_text) + @BindView(R.id.fragment_dashboard_header_gps_text) protected TextView mGpsText; - @InjectView(R.id.fragment_dashboard_header_bt_image) + @BindView(R.id.fragment_dashboard_header_bt_image) protected ImageView mBluetoothImage; - @InjectView(R.id.fragment_dashboard_header_bt_text) + @BindView(R.id.fragment_dashboard_header_bt_text) protected TextView mBluetoothText; - @InjectView(R.id.fragment_dashboard_header_time_timer) + @BindView(R.id.fragment_dashboard_header_time_timer) protected Chronometer mTimerText; - @InjectView(R.id.fragment_dashboard_header_speed_text) + @BindView(R.id.fragment_dashboard_header_speed_text) protected TextView mSpeedText; - @InjectView(R.id.fragment_dashboard_header_distance_text) + @BindView(R.id.fragment_dashboard_header_distance_text) protected TextView mDistanceText; @@ -88,7 +88,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View contentView = inflater.inflate(R.layout.fragment_dashboard_header, container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // Update the image and text of the bluetooth related views. updateBluetoothViews(true); diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java index 7b687be2b..1d372e5fd 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java @@ -41,7 +41,7 @@ import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import butterknife.OnTouch; import rx.Scheduler; @@ -53,9 +53,9 @@ public class DashboardTrackMapFragment extends BaseInjectorFragment { private static final Logger LOG = Logger.getLogger(DashboardTrackMapFragment.class); - @InjectView(R.id.fragment_dashboard_frag_map_mapview) + @BindView(R.id.fragment_dashboard_frag_map_mapview) protected MapView mMapView; - @InjectView(R.id.fragment_dashboard_frag_map_follow_fab) + @BindView(R.id.fragment_dashboard_frag_map_follow_fab) protected FloatingActionButton mFollowFab; private PathOverlay mPathOverlay; @@ -77,7 +77,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle View contentView = inflater.inflate(R.layout.fragment_dashboard_frag_map, container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // Init the map view mMapView.setTileSource(MapUtils.getOSMTileLayer()); diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java index 40741cc55..f6d9cd505 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java @@ -45,7 +45,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * TODO JavaDoc @@ -60,18 +60,18 @@ public class DashboardTrackSettingsFragment extends BaseInjectorFragment { @Inject protected BluetoothHandler mBluetoothHandler; - @InjectView(R.id.fragment_startup_obd_selection) + @BindView(R.id.fragment_startup_obd_selection) protected View mOBDTypeView; - @InjectView(R.id.fragment_startup_obd_selection_text1) + @BindView(R.id.fragment_startup_obd_selection_text1) protected TextView mOBDTypeTextView; - @InjectView(R.id.fragment_startup_obd_selection_text2) + @BindView(R.id.fragment_startup_obd_selection_text2) protected TextView mOBDTypeSubTextView; - @InjectView(R.id.fragment_startup_car_selection) + @BindView(R.id.fragment_startup_car_selection) protected View mCarTypeView; - @InjectView(R.id.fragment_startup_car_selection_text1) + @BindView(R.id.fragment_startup_car_selection_text1) protected TextView mCarTypeTextView; - @InjectView(R.id.fragment_startup_car_selection_text2) + @BindView(R.id.fragment_startup_car_selection_text2) protected TextView mCarTypeSubTextView; @Nullable @@ -85,7 +85,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle container, false); // Inject all dashboard-related views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); mCarTypeView.setOnClickListener(v -> { Intent intent = new Intent(getActivity(), CarSelectionActivity.class); diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java index 6269ccc23..3c36343f9 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java @@ -47,7 +47,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; import rx.Observer; import rx.Subscriber; @@ -70,29 +70,29 @@ public class LogbookActivity extends BaseInjectorActivity implements LogbookUiLi @Inject protected UserManager userManager; - @InjectView(R.id.activity_logbook_toolbar) + @BindView(R.id.activity_logbook_toolbar) protected Toolbar toolbar; - @InjectView(R.id.activity_logbook_header) + @BindView(R.id.activity_logbook_header) protected View headerView; - @InjectView(R.id.activity_logbook_toolbar_new_fueling_fab) + @BindView(R.id.activity_logbook_toolbar_new_fueling_fab) protected View newFuelingFab; - @InjectView(R.id.activity_logbook_toolbar_fuelinglist) + @BindView(R.id.activity_logbook_toolbar_fuelinglist) protected ListView fuelingList; - @InjectView(R.id.overlay) + @BindView(R.id.overlay) protected View overlayView; - @InjectView(R.id.layout_general_info_background) + @BindView(R.id.layout_general_info_background) protected View infoBackground; - @InjectView(R.id.layout_general_info_background_img) + @BindView(R.id.layout_general_info_background_img) protected ImageView infoBackgroundImg; - @InjectView(R.id.layout_general_info_background_firstline) + @BindView(R.id.layout_general_info_background_firstline) protected TextView infoBackgroundFirst; - @InjectView(R.id.layout_general_info_background_secondline) + @BindView(R.id.layout_general_info_background_secondline) protected TextView infoBackgroundSecond; -// @InjectView(R.id.activity_logbook_not_logged_in) +// @BindView(R.id.activity_logbook_not_logged_in) // protected View notLoggedInView; -// @InjectView(R.id.activity_logbook_no_fuelings_info_view) +// @BindView(R.id.activity_logbook_no_fuelings_info_view) // protected View noFuelingsView; protected LogbookListAdapter fuelingListAdapter; @@ -110,7 +110,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_logbook); // Inject the Views. - ButterKnife.inject(this); + ButterKnife.bind(this); // Initializes the Toolbar. setSupportActionBar(toolbar); diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java index c97a18555..94064d276 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java @@ -62,7 +62,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; @@ -86,38 +86,38 @@ public class LogbookAddFuelingFragment extends BaseInjectorFragment { DECIMAL_FORMATTER_3.setDecimalFormatSymbols(symbols); } - @InjectView(R.id.logbook_layout_addfueling_toolbar) + @BindView(R.id.logbook_layout_addfueling_toolbar) protected Toolbar addFuelingToolbar; - @InjectView(R.id.activity_log_book_add_fueling_toolbar_exp) + @BindView(R.id.activity_log_book_add_fueling_toolbar_exp) protected View addFuelingToolbarExp; - @InjectView(R.id.activity_logbook_add_fueling_card_content) + @BindView(R.id.activity_logbook_add_fueling_card_content) protected View contentView; - @InjectView(R.id.activity_logbook_add_fueling_card_scrollview) + @BindView(R.id.activity_logbook_add_fueling_card_scrollview) protected View contentScrollview; - @InjectView(R.id.activity_logbook_add_fueling_car_selection) + @BindView(R.id.activity_logbook_add_fueling_car_selection) protected Spinner addFuelingCarSelection; - @InjectView(R.id.logbook_add_fueling_milagetext) + @BindView(R.id.logbook_add_fueling_milagetext) protected EditText addFuelingMilageText; - @InjectView(R.id.logbook_add_fueling_volumetext) + @BindView(R.id.logbook_add_fueling_volumetext) protected EditText addFuelingVolumeText; - @InjectView(R.id.logbook_add_fueling_totalpricetext) + @BindView(R.id.logbook_add_fueling_totalpricetext) protected EditText addFuelingTotalCostText; - @InjectView(R.id.logbook_add_fueling_priceperlitretext) + @BindView(R.id.logbook_add_fueling_priceperlitretext) protected EditText addFuelingPricePerLitreText; - @InjectView(R.id.logbook_add_fueling_partialfueling_checkbox) + @BindView(R.id.logbook_add_fueling_partialfueling_checkbox) protected CheckBox partialFuelingCheckbox; - @InjectView(R.id.logbook_add_fueling_missedfueling_checkbox) + @BindView(R.id.logbook_add_fueling_missedfueling_checkbox) protected CheckBox missedFuelingCheckbox; - @InjectView(R.id.logbook_add_fueling_comment) + @BindView(R.id.logbook_add_fueling_comment) protected EditText commentText; - @InjectView(R.id.layout_general_info_background) + @BindView(R.id.layout_general_info_background) protected View infoBackground; - @InjectView(R.id.layout_general_info_background_img) + @BindView(R.id.layout_general_info_background_img) protected ImageView infoBackgroundImg; - @InjectView(R.id.layout_general_info_background_firstline) + @BindView(R.id.layout_general_info_background_firstline) protected TextView infoBackgroundFirst; - @InjectView(R.id.layout_general_info_background_secondline) + @BindView(R.id.layout_general_info_background_secondline) protected TextView infoBackgroundSecond; @Inject @@ -135,7 +135,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle // Inflate the view and inject the annotated view. View view = inflater.inflate(R.layout.activity_logbook_add_fueling_card, container, false); - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); addFuelingToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); addFuelingToolbar.inflateMenu(R.menu.menu_logbook_add_fueling); diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookCarSpinnerAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookCarSpinnerAdapter.java index 376a6af19..681006c72 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookCarSpinnerAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookCarSpinnerAdapter.java @@ -31,7 +31,7 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * TODO JavaDoc @@ -87,9 +87,9 @@ public View getDropDownView(int position, View convertView, ViewGroup parent) { static class CarSpinnerEntryHolder { - @InjectView(R.id.activity_logbook_car_spinner_entry_firstline) + @BindView(R.id.activity_logbook_car_spinner_entry_firstline) protected TextView title; - @InjectView(R.id.activity_logbook_car_spinner_entry_secondline) + @BindView(R.id.activity_logbook_car_spinner_entry_secondline) protected TextView secondLine; @@ -99,7 +99,7 @@ static class CarSpinnerEntryHolder { * @param view the parent view of an entry in the car spinner. */ CarSpinnerEntryHolder(View view) { - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); } } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookListAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookListAdapter.java index a8a99bc8c..124b563a5 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookListAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookListAdapter.java @@ -38,7 +38,7 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * TODO JavaDoc @@ -119,24 +119,24 @@ public Fueling getItem(int position) { } static class FuelingViewHolder { - @InjectView(R.id.activity_logbook_listentry_date) + @BindView(R.id.activity_logbook_listentry_date) protected TextView dateText; - @InjectView(R.id.activity_logbook_listentry_kmliter) + @BindView(R.id.activity_logbook_listentry_kmliter) protected TextView kmAndLiter; - @InjectView(R.id.activity_logbook_listentry_priceperliter) + @BindView(R.id.activity_logbook_listentry_priceperliter) protected TextView pricePerLiter; - @InjectView(R.id.activity_logbook_listentry_totalprice) + @BindView(R.id.activity_logbook_listentry_totalprice) protected TextView totalPrice; - @InjectView(R.id.activity_logbook_listentry_car) + @BindView(R.id.activity_logbook_listentry_car) protected TextView car; - @InjectView(R.id.activity_logbook_listentry_comment_view) + @BindView(R.id.activity_logbook_listentry_comment_view) protected View commentView; - @InjectView(R.id.activity_logbook_listentry_comment) + @BindView(R.id.activity_logbook_listentry_comment) protected TextView commentText; - @InjectView(R.id.activity_logbook_listentry_fillup) + @BindView(R.id.activity_logbook_listentry_fillup) protected View filledUpView; - @InjectView(R.id.activity_logbook_listentry_missedfillup) + @BindView(R.id.activity_logbook_listentry_missedfillup) protected View missedFillUpView; /** @@ -145,7 +145,7 @@ static class FuelingViewHolder { * @param view the core view to inject the subviews from. */ FuelingViewHolder(View view) { - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); } } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDDeviceListAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDDeviceListAdapter.java index 174f49d60..b8400779a 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDDeviceListAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDDeviceListAdapter.java @@ -32,7 +32,7 @@ import org.envirocar.app.R; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @author dewall @@ -215,13 +215,13 @@ static class ViewHolder { public final View mContentView; // All the views of a row to lookup for. - @InjectView(R.id.activity_obd_selection_layout_paired_list_entry_image) + @BindView(R.id.activity_obd_selection_layout_paired_list_entry_image) protected ImageView mImageView; - @InjectView(R.id.activity_obd_selection_layout_paired_list_entry_text) + @BindView(R.id.activity_obd_selection_layout_paired_list_entry_text) protected TextView mTextView; - @InjectView(R.id.activity_obd_selection_layout_paired_list_entry_delete) + @BindView(R.id.activity_obd_selection_layout_paired_list_entry_delete) protected ImageButton mDeleteButton; - @InjectView(R.id.activity_obd_selection_layout_paired_list_entry_radio) + @BindView(R.id.activity_obd_selection_layout_paired_list_entry_radio) protected AppCompatRadioButton mRadioButton; /** @@ -232,7 +232,7 @@ static class ViewHolder { ViewHolder(View content) { this.mContentView = content; // Inject the annotated views. - ButterKnife.inject(this, content); + ButterKnife.bind(this, content); } } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java index 956596d5f..9633b16a0 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java @@ -42,7 +42,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @dewall @@ -54,11 +54,11 @@ public class OBDSelectionActivity extends BaseInjectorActivity implements @Inject protected BluetoothHandler mBluetoothHandler; - @InjectView(R.id.activity_obd_selection_layout_toolbar) + @BindView(R.id.activity_obd_selection_layout_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.activity_obd_selection_layout_enablebt_switch) + @BindView(R.id.activity_obd_selection_layout_enablebt_switch) protected Switch mSwitch; - @InjectView(R.id.activity_obd_selection_layout_enablebt_text) + @BindView(R.id.activity_obd_selection_layout_enablebt_text) protected TextView mEnableBTText; protected Fragment mOBDSelectionFragment; @@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_obd_selection_layout); // Inject all annotated views. - ButterKnife.inject(this); + ButterKnife.bind(this); // Set the toolbar as default actionbar. setSupportActionBar(mToolbar); diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java index d2ceb96a8..4999d6fd9 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java @@ -47,7 +47,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Subscriber; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; @@ -72,18 +72,18 @@ public interface ShowSnackbarListener { @Inject protected BluetoothHandler mBluetoothHandler; - @InjectView(R.id.activity_obd_selection_layout_content) + @BindView(R.id.activity_obd_selection_layout_content) protected View mContentView; - @InjectView(R.id.activity_obd_selection_layout_paired_devices_text) + @BindView(R.id.activity_obd_selection_layout_paired_devices_text) protected TextView mPairedDevicesTextView; - @InjectView(R.id.activity_obd_selection_layout_paired_devices_list) + @BindView(R.id.activity_obd_selection_layout_paired_devices_list) protected ListView mPairedDevicesListView; - @InjectView(R.id.activity_obd_selection_layout_available_devices_list) + @BindView(R.id.activity_obd_selection_layout_available_devices_list) protected ListView mNewDevicesListView; - @InjectView(R.id.activity_obd_selection_layout_search_devices_progressbar) + @BindView(R.id.activity_obd_selection_layout_search_devices_progressbar) protected ProgressBar mProgressBar; - @InjectView(R.id.activity_obd_selection_layout_available_devices_info) + @BindView(R.id.activity_obd_selection_layout_available_devices_info) protected TextView mNewDevicesInfoTextView; // ArrayAdapter for the two different list views. @@ -101,7 +101,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle container, false); // Inject all annotated views. - ButterKnife.inject(this, contentView); + ButterKnife.bind(this, contentView); // Setup the listviews, its adapters, and its onClick listener. setupListViews(); diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java index df2228aee..fc6739058 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java @@ -33,7 +33,7 @@ import org.envirocar.app.handler.PreferenceConstants; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; /** * @author dewall @@ -62,13 +62,13 @@ public String format(int value) { } }; - @InjectView(R.id.default_header_toolbar) + @BindView(R.id.default_header_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.bluetooth_discovery_interval_preference_numberpicker_text) + @BindView(R.id.bluetooth_discovery_interval_preference_numberpicker_text) protected TextView mText; - @InjectView(R.id.bluetooth_discovery_interval_preference_numberpicker_min) + @BindView(R.id.bluetooth_discovery_interval_preference_numberpicker_min) protected NumberPicker mMinutePicker; - @InjectView(R.id.bluetooth_discovery_interval_preference_numberpicker_sec) + @BindView(R.id.bluetooth_discovery_interval_preference_numberpicker_sec) protected NumberPicker mSecondsPicker; // The seconds and minutes the timepicker have to show @@ -97,7 +97,7 @@ protected void onBindDialogView(View view) { super.onBindDialogView(view); // Inject all views - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); // Toolbar settings. mToolbar.setTitle(R.string.pref_bt_discovery_interval_title); diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java index 56f1bf9f2..e8dc780bf 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java @@ -49,7 +49,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Subscriber; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; @@ -62,21 +62,21 @@ public class BluetoothPairingPreference extends DialogPreference { private static final Logger LOGGER = Logger.getLogger(BluetoothPairingPreference.class); // Views for the already paired devices. - @InjectView(R.id.bluetooth_pairing_preference_paired_devices_text) + @BindView(R.id.bluetooth_pairing_preference_paired_devices_text) public TextView mPairedDevicesTextView; - @InjectView(R.id.bluetooth_pairing_preference_paired_devices_list) + @BindView(R.id.bluetooth_pairing_preference_paired_devices_list) public ListView mPairedDevicesListView; // Views for the newly discovered devices. - @InjectView(R.id.bluetooth_pairing_preference_available_devices_text) + @BindView(R.id.bluetooth_pairing_preference_available_devices_text) public TextView mNewDevicesTextView; - @InjectView(R.id.bluetooth_pairing_preference_available_devices_list) + @BindView(R.id.bluetooth_pairing_preference_available_devices_list) public ListView mNewDevicesListView; // No device found. - @InjectView(R.id.bluetooth_pairing_preference_available_devices_info) + @BindView(R.id.bluetooth_pairing_preference_available_devices_info) public TextView mNewDevicesInfoTextView; - @InjectView(R.id.bluetooth_pairing_preference_search_devices_progressbar) + @BindView(R.id.bluetooth_pairing_preference_search_devices_progressbar) public ProgressBar mProgressBar; // Injected variables. @@ -86,7 +86,7 @@ public class BluetoothPairingPreference extends DialogPreference { protected BluetoothHandler mBluetoothHandler; // Main parent view for the content. - @InjectView(R.id.bluetooth_pairing_preference_content) + @BindView(R.id.bluetooth_pairing_preference_content) protected LinearLayout mContentView; // ArrayAdapter for the two different list views. @@ -119,7 +119,7 @@ protected void onBindDialogView(final View view) { super.onBindDialogView(view); // Inject all views. - ButterKnife.inject(this, view); + ButterKnife.bind(this, view); // Initialize the array adapter for both list views mNewDevicesArrayAdapter = new BluetoothDeviceListAdapter(getContext(), diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/bluetooth/SelectBluetoothAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/bluetooth/SelectBluetoothAdapter.java index 183a64106..d67509aa0 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/bluetooth/SelectBluetoothAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/bluetooth/SelectBluetoothAdapter.java @@ -26,12 +26,9 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.CheckedTextView; -import android.widget.TextView; import org.envirocar.app.R; -import java.util.Collection; - /** * @author dewall */ diff --git a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java index a4d953382..831ed0445 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java @@ -32,7 +32,7 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import butterknife.OnClick; /** @@ -42,18 +42,18 @@ */ public class SettingsActivity extends BaseInjectorActivity { - @InjectView(R.id.fragment_settings_main_toolbar) + @BindView(R.id.fragment_settings_main_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.fragment_settings_main_general_settings) + @BindView(R.id.fragment_settings_main_general_settings) protected View mGeneralSettingsLayout; - @InjectView(R.id.fragment_settings_main_obd_settings) + @BindView(R.id.fragment_settings_main_obd_settings) protected View mOBDSettingsLayout; - @InjectView(R.id.fragment_settings_main_car_settings) + @BindView(R.id.fragment_settings_main_car_settings) protected View mCarSettingsLayout; - @InjectView(R.id.fragment_settings_main_optional_settings) + @BindView(R.id.fragment_settings_main_optional_settings) protected View mOptionalSettingsLayout; - @InjectView(R.id.fragment_settings_main_other_settings) + @BindView(R.id.fragment_settings_main_other_settings) protected View mOtherSettingsLayout; private Fragment mCurrentVisibleFragment; @@ -62,7 +62,7 @@ public class SettingsActivity extends BaseInjectorActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_settings_main); - ButterKnife.inject(this); + ButterKnife.bind(this); setSupportActionBar(mToolbar); // Enables the home button. diff --git a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java index d9fc5432f..95bc43ef9 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java @@ -65,7 +65,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.schedulers.Schedulers; /** @@ -99,27 +99,27 @@ public static void navigate(Activity activity, View transition, int trackID) { @Inject protected EnviroCarDB mEnvirocarDB; - @InjectView(R.id.activity_track_details_fab) + @BindView(R.id.activity_track_details_fab) protected FloatingActionButton mFAB; - @InjectView(R.id.activity_track_details_header_map) + @BindView(R.id.activity_track_details_header_map) protected MapView mMapView; - @InjectView(R.id.activity_track_details_header_toolbar) + @BindView(R.id.activity_track_details_header_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.activity_track_details_attr_description_value) + @BindView(R.id.activity_track_details_attr_description_value) protected TextView mDescriptionText; - @InjectView(R.id.track_details_attributes_header_duration) + @BindView(R.id.track_details_attributes_header_duration) protected TextView mDurationText; - @InjectView(R.id.track_details_attributes_header_distance) + @BindView(R.id.track_details_attributes_header_distance) protected TextView mDistanceText; - @InjectView(R.id.activity_track_details_attr_begin_value) + @BindView(R.id.activity_track_details_attr_begin_value) protected TextView mBeginText; - @InjectView(R.id.activity_track_details_attr_end_value) + @BindView(R.id.activity_track_details_attr_end_value) protected TextView mEndText; - @InjectView(R.id.activity_track_details_attr_car_value) + @BindView(R.id.activity_track_details_attr_car_value) protected TextView mCarText; - @InjectView(R.id.activity_track_details_attr_emission_value) + @BindView(R.id.activity_track_details_attr_emission_value) protected TextView mEmissionText; - @InjectView(R.id.activity_track_details_attr_consumption_value) + @BindView(R.id.activity_track_details_attr_consumption_value) protected TextView mConsumptionText; @@ -130,7 +130,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_track_details_layout2); // Inject all annotated views. - ButterKnife.inject(this); + ButterKnife.bind(this); supportPostponeEnterTransition(); diff --git a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java index 6bd105412..812ad81a3 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java @@ -45,7 +45,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import lecho.lib.hellocharts.formatter.SimpleAxisValueFormatter; import lecho.lib.hellocharts.gesture.ZoomType; import lecho.lib.hellocharts.listener.DummyVieportChangeListener; @@ -77,7 +77,7 @@ public static void createInstance(Activity activity, int trackID) { @Inject protected EnviroCarDB enviroCarDB; - @InjectView(R.id.activity_track_statistics_toolbar) + @BindView(R.id.activity_track_statistics_toolbar) protected Toolbar mToolbar; private Track mTrack; @@ -111,7 +111,7 @@ protected void onCreate(Bundle savedInstanceState) { }); // Inject all annotated views. - ButterKnife.inject(this); + ButterKnife.bind(this); // Initializes the Toolbar. setSupportActionBar(mToolbar); @@ -158,9 +158,9 @@ private void inflateMenuProperties(Track track) { public static class PlaceholderFragment extends Fragment { - @InjectView(R.id.activity_track_statistics_fragment_chart) + @BindView(R.id.activity_track_statistics_fragment_chart) protected LineChartView mChart; - @InjectView(R.id.activity_track_statistics_fragment_chart_preview) + @BindView(R.id.activity_track_statistics_fragment_chart_preview) protected PreviewLineChartView mPreviewChart; private LineChartData mChartData; @@ -185,7 +185,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle container, false); // Inject all annotated views. - ButterKnife.inject(this, rootView); + ButterKnife.bind(this, rootView); generateData(Measurement.PropertyKey.SPEED); diff --git a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardAdapter.java b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardAdapter.java index bda4e7f04..f42dff448 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardAdapter.java +++ b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardAdapter.java @@ -49,8 +49,8 @@ import java.util.Locale; import java.util.TimeZone; +import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.InjectView; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; @@ -272,19 +272,19 @@ static class TrackCardViewHolder extends RecyclerView.ViewHolder { protected final View mItemView; - @InjectView(R.id.fragment_tracklist_cardlayout_toolbar) + @BindView(R.id.fragment_tracklist_cardlayout_toolbar) protected Toolbar mToolbar; - @InjectView(R.id.fragment_tracklist_cardlayout_toolbar_title) + @BindView(R.id.fragment_tracklist_cardlayout_toolbar_title) protected TextView mTitleTextView; - @InjectView(R.id.fragment_tracklist_cardlayout_content) + @BindView(R.id.fragment_tracklist_cardlayout_content) protected View mContentView; - @InjectView(R.id.track_details_attributes_header_distance) + @BindView(R.id.track_details_attributes_header_distance) protected TextView mDistance; - @InjectView(R.id.track_details_attributes_header_duration) + @BindView(R.id.track_details_attributes_header_duration) protected TextView mDuration; - @InjectView(R.id.fragment_tracklist_cardlayout_map) + @BindView(R.id.fragment_tracklist_cardlayout_map) protected MapView mMapView; - @InjectView(R.id.fragment_tracklist_cardlayout_invis_mapbutton) + @BindView(R.id.fragment_tracklist_cardlayout_invis_mapbutton) protected ImageButton mInvisMapButton; /** @@ -295,7 +295,7 @@ static class TrackCardViewHolder extends RecyclerView.ViewHolder { public TrackCardViewHolder(View itemView) { super(itemView); this.mItemView = itemView; - ButterKnife.inject(this, itemView); + ButterKnife.bind(this, itemView); } } @@ -320,11 +320,11 @@ public LocalTrackCardViewHolder(View itemView) { */ static class RemoteTrackCardViewHolder extends TrackCardViewHolder { - @InjectView(R.id.fragment_tracklist_cardlayout_remote_progresscircle) + @BindView(R.id.fragment_tracklist_cardlayout_remote_progresscircle) protected FABProgressCircle mProgressCircle; - @InjectView(R.id.fragment_tracklist_cardlayout_remote_downloadfab) + @BindView(R.id.fragment_tracklist_cardlayout_remote_downloadfab) protected FloatingActionButton mDownloadButton; - @InjectView(R.id.fragment_tracklist_cardlayout_downloading_notification) + @BindView(R.id.fragment_tracklist_cardlayout_downloading_notification) protected TextView mDownloadNotification; /** diff --git a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java index 4b61c1525..0df45ac3a 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java @@ -59,7 +59,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.BindView; import rx.Observable; import rx.Scheduler; import rx.Subscriber; @@ -89,24 +89,24 @@ public abstract class AbstractTrackListCardFragment Date: Fri, 18 May 2018 10:37:12 +0530 Subject: [PATCH 018/389] Small change to the previous commit i.e using annotationProcessor in gradle script to compile the annotation compiler libraries like Dagger compiler --- org.envirocar.app/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/org.envirocar.app/build.gradle b/org.envirocar.app/build.gradle index 131f5e8b5..3302fca47 100644 --- a/org.envirocar.app/build.gradle +++ b/org.envirocar.app/build.gradle @@ -8,8 +8,7 @@ dependencies { implementation rootProject.ext.supportCardview implementation rootProject.ext.supportRecyclerview implementation rootProject.ext.dagger - //annotationProcessor rootProject.ext.daggerCompiler - compileOnly rootProject.ext.daggerCompiler + annotationProcessor rootProject.ext.daggerCompiler implementation rootProject.ext.otto implementation rootProject.ext.butterKnife annotationProcessor rootProject.ext.butterknifeCompiler From fa8638d6db0b20b58041eaf179feb67e9870e78c Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Mon, 21 May 2018 15:31:11 +0530 Subject: [PATCH 019/389] Updated Dagger 1 to Dagger 2 --- build.gradle | 4 +- org.envirocar.algorithm/build.gradle | 1 + org.envirocar.app/AndroidManifest.xml | 1 + org.envirocar.app/build.gradle | 1 + .../org/envirocar/app/BaseApplication.java | 73 ++++---- .../app/BaseApplicationComponent.java | 97 +++++++++++ .../envirocar/app/BaseApplicationModule.java | 75 +++----- .../org/envirocar/app/BaseMainActivity.java | 18 +- .../envirocar/app/MainActivityComponent.java | 37 ++++ .../org/envirocar/app/MainActivityModule.java | 44 +---- .../app/activity/StartStopButtonUtil.java | 15 +- .../app/handler/BluetoothHandler.java | 2 +- .../app/handler/CarPreferenceHandler.java | 3 +- .../app/handler/CarRemoteListCache.java | 1 - .../envirocar/app/handler}/DAOProvider.java | 55 +++--- .../envirocar/app/handler/HandlerModule.java | 16 +- .../app/handler/LocationHandler.java | 2 +- .../app/handler/TemporaryFileManager.java | 2 +- .../app/handler/TermsOfUseManager.java | 3 +- .../app/handler/TrackDAOHandler.java | 3 +- .../app/handler/TrackRecordingHandler.java | 7 +- .../app/handler/TrackUploadHandler.java | 3 +- .../envirocar/app/handler/UserHandler.java | 3 +- .../app}/injection/BaseInjectorActivity.java | 37 +--- .../app}/injection/BaseInjectorFragment.java | 76 ++------ .../app}/injection/BaseInjectorService.java | 37 +--- .../app/services/NotificationHandler.java | 4 +- .../app/services/OBDConnectionService.java | 21 +-- .../app/services/OBDServiceModule.java | 20 +-- .../app/services/SystemStartupService.java | 19 +- .../app/services/TrackUploadService.java | 13 +- .../app/services/obd/OBDServiceHandler.java | 7 +- .../envirocar/app/view/LogbookFragment.java | 12 +- .../org/envirocar/app/view/LoginActivity.java | 10 +- .../carselection/CarSelectionActivity.java | 10 +- .../CarSelectionAddCarFragment.java | 10 +- .../view/dashboard/DashboardMainFragment.java | 10 +- .../view/dashboard/DashboardMapFragment.java | 11 +- .../dashboard/DashboardTempomatFragment.java | 10 +- .../DashboardTrackDetailsFragment.java | 10 +- .../dashboard/DashboardTrackMapFragment.java | 10 +- .../DashboardTrackSettingsFragment.java | 11 +- .../app/view/logbook/LogbookActivity.java | 10 +- .../logbook/LogbookAddFuelingFragment.java | 10 +- .../obdselection/OBDSelectionActivity.java | 16 +- .../obdselection/OBDSelectionFragment.java | 8 +- .../view/obdselection/OBDSelectionModule.java | 21 --- .../BluetoothDiscoveryIntervalPreference.java | 4 +- .../BluetoothPairingPreference.java | 4 +- .../SelectBluetoothPreference.java | 4 +- .../app/view/preferences/Tempomat.java | 3 + .../view/settings/OBDSettingsFragment.java | 4 +- .../app/view/settings/SettingsActivity.java | 18 +- .../app/view/settings/SettingsModule.java | 23 --- .../trackdetails/TrackDetailsActivity.java | 18 +- .../trackdetails/TrackStatisticsActivity.java | 8 +- .../AbstractTrackListCardFragment.java | 21 +-- .../tracklist/TrackListLocalCardFragment.java | 19 +- .../tracklist/TrackListPagerFragment.java | 12 +- .../TrackListRemoteCardFragment.java | 27 +-- org.envirocar.core/build.gradle | 1 + .../src/main/AndroidManifest.xml | 1 + .../injection/InjectionModuleProvider.java | 33 ---- .../envirocar/core/injection/Injector.java | 41 ----- .../InjectApplicationScope.java | 2 +- .../InjectionActivityScope.java | 2 +- org.envirocar.obd/build.gradle | 1 + org.envirocar.remote/build.gradle | 9 +- .../org/envirocar/remote/CacheModule.java | 94 ---------- .../org/envirocar/remote/RemoteModule.java | 162 ++++++++++++------ .../remote/service/EnviroCarService.java | 37 +++- org.envirocar.storage/build.gradle | 3 +- .../org/envirocar/storage/DatabaseModule.java | 11 +- .../storage/EnviroCarDBOpenHelper.java | 2 +- 74 files changed, 668 insertions(+), 765 deletions(-) create mode 100644 org.envirocar.app/src/org/envirocar/app/BaseApplicationComponent.java create mode 100644 org.envirocar.app/src/org/envirocar/app/MainActivityComponent.java rename {org.envirocar.remote/src/main/java/org/envirocar/remote => org.envirocar.app/src/org/envirocar/app/handler}/DAOProvider.java (62%) rename {org.envirocar.core/src/main/java/org/envirocar/core => org.envirocar.app/src/org/envirocar/app}/injection/BaseInjectorActivity.java (64%) rename {org.envirocar.core/src/main/java/org/envirocar/core => org.envirocar.app/src/org/envirocar/app}/injection/BaseInjectorFragment.java (60%) rename {org.envirocar.core/src/main/java/org/envirocar/core => org.envirocar.app/src/org/envirocar/app}/injection/BaseInjectorService.java (56%) delete mode 100644 org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionModule.java delete mode 100644 org.envirocar.app/src/org/envirocar/app/view/settings/SettingsModule.java delete mode 100644 org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionModuleProvider.java delete mode 100644 org.envirocar.core/src/main/java/org/envirocar/core/injection/Injector.java rename org.envirocar.core/src/main/java/org/envirocar/core/{injection => util}/InjectApplicationScope.java (96%) rename org.envirocar.core/src/main/java/org/envirocar/core/{injection => util}/InjectionActivityScope.java (96%) delete mode 100644 org.envirocar.remote/src/main/java/org/envirocar/remote/CacheModule.java diff --git a/build.gradle b/build.gradle index 206ea9ed5..0e4b2c8b0 100644 --- a/build.gradle +++ b/build.gradle @@ -53,8 +53,8 @@ ext { supportRecyclerview = 'com.android.support:recyclerview-v7:27.1.1' // Dependency injection, view injection, event bus... - dagger = 'com.squareup.dagger:dagger:1.2.2' - daggerCompiler = 'com.squareup.dagger:dagger-compiler:1.2.2' + dagger = 'com.google.dagger:dagger:2.16' + daggerCompiler = 'com.google.dagger:dagger-compiler:2.16' butterKnife = 'com.jakewharton:butterknife:8.8.1' butterknifeCompiler = 'com.jakewharton:butterknife-compiler:8.8.1' otto = 'com.squareup:otto:1.3.8' diff --git a/org.envirocar.algorithm/build.gradle b/org.envirocar.algorithm/build.gradle index c236f2ebc..063bd6e42 100644 --- a/org.envirocar.algorithm/build.gradle +++ b/org.envirocar.algorithm/build.gradle @@ -31,6 +31,7 @@ dependencies { implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler + implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.rxAndroid implementation rootProject.ext.rxJava diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index ff0ad3e1b..d00070faa 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -26,6 +26,7 @@ + diff --git a/org.envirocar.app/build.gradle b/org.envirocar.app/build.gradle index 3302fca47..37d49c22f 100644 --- a/org.envirocar.app/build.gradle +++ b/org.envirocar.app/build.gradle @@ -9,6 +9,7 @@ dependencies { implementation rootProject.ext.supportRecyclerview implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler + implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.otto implementation rootProject.ext.butterKnife annotationProcessor rootProject.ext.butterknifeCompiler diff --git a/org.envirocar.app/src/org/envirocar/app/BaseApplication.java b/org.envirocar.app/src/org/envirocar/app/BaseApplication.java index 64731d942..6fcac9f3e 100644 --- a/org.envirocar.app/src/org/envirocar/app/BaseApplication.java +++ b/org.envirocar.app/src/org/envirocar/app/BaseApplication.java @@ -28,34 +28,53 @@ import android.os.Build; import android.preference.PreferenceManager; -import com.google.common.base.Preconditions; - import org.acra.ACRA; import org.acra.annotation.ReportsCrashes; import org.envirocar.app.handler.PreferenceConstants; -import org.envirocar.core.injection.InjectionModuleProvider; -import org.envirocar.core.injection.Injector; +import org.envirocar.app.services.obd.OBDServiceHandler; import org.envirocar.core.logging.ACRACustomSender; import org.envirocar.core.logging.Logger; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.util.Util; +import org.envirocar.remote.service.AnnouncementsService; +import org.envirocar.remote.service.CarService; +import org.envirocar.remote.service.EnviroCarService; +import org.envirocar.remote.service.FuelingService; +import org.envirocar.remote.service.TermsOfUseService; +import org.envirocar.remote.service.TrackService; +import org.envirocar.remote.service.UserService; -import java.util.Arrays; -import java.util.List; +import javax.inject.Inject; -import dagger.ObjectGraph; /** * @author dewall */ @ReportsCrashes -public class BaseApplication extends Application implements Injector, InjectionModuleProvider { +public class BaseApplication extends Application { private static final String TAG = BaseApplication.class.getSimpleName(); private static final Logger LOGGER = Logger.getLogger(BaseApplication.class); - protected ObjectGraph mObjectGraph; + BaseApplicationComponent baseApplicationComponent; protected BroadcastReceiver mScreenReceiver; protected BroadcastReceiver mGPSReceiver; + @Inject + UserService userService; + @Inject + CarService carService; + @Inject + TrackService trackService; + @Inject + TermsOfUseService termsOfUseService; + @Inject + FuelingService fuelingService; + @Inject + AnnouncementsService announcementsService; + @InjectApplicationScope + @Inject + Context context; + private SharedPreferences.OnSharedPreferenceChangeListener preferenceListener = (sharedPreferences, key) -> { if (PreferenceConstants.ENABLE_DEBUG_LOGGING.equals(key)) { @@ -68,13 +87,18 @@ public class BaseApplication extends Application implements Injector, InjectionM public void onCreate() { super.onCreate(); - // create initial ObjectGraph - mObjectGraph = ObjectGraph.create(getInjectionModules().toArray()); - mObjectGraph.validate(); + baseApplicationComponent = DaggerBaseApplicationComponent.builder() + .baseApplicationModule(new BaseApplicationModule(this)) + .build(); + baseApplicationComponent.inject(this); - // Inject the LazyLoadingStrategy into track. Its the only static injection - // TODO: Remove the static injection. - mObjectGraph.injectStatics(); + EnviroCarService.setCarService(carService); + EnviroCarService.setAnnouncementsService(announcementsService); + EnviroCarService.setFuelingService(fuelingService); + EnviroCarService.setTermsOfUseService(termsOfUseService); + EnviroCarService.setTrackService(trackService); + EnviroCarService.setUserService(userService); + OBDServiceHandler.context = context; SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); @@ -160,23 +184,12 @@ public void onTrimMemory(int level) { LOGGER.info("freeMemory: " + Runtime.getRuntime().freeMemory()); } - - @Override - public ObjectGraph getObjectGraph() { - return mObjectGraph; - } - - @Override - public List getInjectionModules() { - return Arrays.asList( - new BaseApplicationModule(this)); + public BaseApplicationComponent getBaseApplicationComponent(){ + return baseApplicationComponent; } - @Override - public void injectObjects(Object instance) { - Preconditions.checkNotNull(instance, "Cannot inject into Null objects."); - Preconditions.checkNotNull(mObjectGraph, "The ObjectGraph must be initialized before use."); - mObjectGraph.inject(instance); + public static BaseApplication get(Context context){ + return (BaseApplication) context.getApplicationContext(); } } diff --git a/org.envirocar.app/src/org/envirocar/app/BaseApplicationComponent.java b/org.envirocar.app/src/org/envirocar/app/BaseApplicationComponent.java new file mode 100644 index 000000000..3f87aaa56 --- /dev/null +++ b/org.envirocar.app/src/org/envirocar/app/BaseApplicationComponent.java @@ -0,0 +1,97 @@ +package org.envirocar.app; + +import com.squareup.sqlbrite.SqlBrite; + +import org.envirocar.app.activity.StartStopButtonUtil; +import org.envirocar.app.handler.DAOProvider; +import org.envirocar.app.handler.TrackRecordingHandler; +import org.envirocar.app.services.OBDConnectionService; +import org.envirocar.app.services.SystemStartupService; +import org.envirocar.app.services.TrackUploadService; +import org.envirocar.app.view.LoginActivity; +import org.envirocar.app.view.carselection.CarSelectionActivity; +import org.envirocar.app.view.carselection.CarSelectionAddCarFragment; +import org.envirocar.app.view.logbook.LogbookActivity; +import org.envirocar.app.view.logbook.LogbookAddFuelingFragment; +import org.envirocar.app.view.obdselection.OBDSelectionActivity; +import org.envirocar.app.view.obdselection.OBDSelectionFragment; +import org.envirocar.app.view.preferences.BluetoothDiscoveryIntervalPreference; +import org.envirocar.app.view.preferences.BluetoothPairingPreference; +import org.envirocar.app.view.preferences.SelectBluetoothPreference; +import org.envirocar.app.view.preferences.Tempomat; +import org.envirocar.app.view.settings.OBDSettingsFragment; +import org.envirocar.app.view.settings.SettingsActivity; +import org.envirocar.app.view.trackdetails.TrackDetailsActivity; +import org.envirocar.app.view.trackdetails.TrackStatisticsActivity; +import org.envirocar.remote.dao.CacheAnnouncementsDAO; +import org.envirocar.remote.dao.CacheCarDAO; +import org.envirocar.remote.dao.CacheFuelingDAO; +import org.envirocar.remote.dao.CacheTermsOfUseDAO; +import org.envirocar.remote.dao.CacheTrackDAO; +import org.envirocar.remote.dao.CacheUserDAO; +import org.envirocar.remote.dao.RemoteAnnouncementsDAO; +import org.envirocar.remote.dao.RemoteCarDAO; +import org.envirocar.remote.dao.RemoteFuelingDAO; +import org.envirocar.remote.dao.RemoteTermsOfUseDAO; +import org.envirocar.remote.dao.RemoteTrackDAO; +import org.envirocar.remote.dao.RemoteUserDAO; +import org.envirocar.remote.dao.RemoteUserStatisticsDAO; + +import javax.inject.Singleton; + +import dagger.Component; +import retrofit.Retrofit; + +/** + * @author Sai Krishna + */ +@Singleton +@Component( + modules = BaseApplicationModule.class +) +public interface BaseApplicationComponent { + + void inject(BaseApplication baseApplication); + void inject(StartStopButtonUtil startStopButtonUtil); + void inject(TrackRecordingHandler trackRecordingHandler); + void inject(OBDConnectionService obdConnectionService); + void inject(SystemStartupService systemStartupService); + void inject(TrackUploadService trackUploadService); + void inject(CarSelectionActivity carSelectionActivity); + void inject(CarSelectionAddCarFragment carSelectionAddCarFragment); + void inject(LogbookActivity logbookActivity); + void inject(LogbookAddFuelingFragment logbookAddFuelingFragment); + void inject(OBDSelectionActivity obdSelectionActivity); + void inject(OBDSelectionFragment obdSelectionFragment); + void inject(BluetoothDiscoveryIntervalPreference bluetoothDiscoveryIntervalPreference); + void inject(BluetoothPairingPreference bluetoothPairingPreference); + void inject(SelectBluetoothPreference selectBluetoothPreference); + void inject(Tempomat tempomat); + void inject(OBDSettingsFragment obdSettingsFragment); + void inject(SettingsActivity settingsActivity); + void inject(TrackDetailsActivity trackDetailsActivity); + void inject(TrackStatisticsActivity trackStatisticsActivity); + void inject(LoginActivity loginActivity); + void inject(DAOProvider daoProvider); + + MainActivityComponent plus(MainActivityModule mainActivityModule); + + + CacheCarDAO getCacheCarDAO(); + RemoteCarDAO getRemoteCarDAO(); + RemoteTrackDAO getRemoteTrackDAO(); + CacheTrackDAO getCacheTrackDAO(); + RemoteUserDAO getRemoteUserDAO(); + CacheUserDAO getCacheUserDAO(); + RemoteUserStatisticsDAO getRemoteUserStatisticsDAO(); + RemoteFuelingDAO getRemoteFuelingDAO(); + CacheFuelingDAO getCacheFuelingDAO(); + RemoteTermsOfUseDAO getRemoteTermsOfUseDAO(); + CacheTermsOfUseDAO getCacheTermsOfUseDAO(); + RemoteAnnouncementsDAO getRemoteAnnouncementsDAO(); + CacheAnnouncementsDAO getCacheAnnouncementsDAO(); + Retrofit provideRetrofit(); + SqlBrite provideSqlBrite(); + + +} diff --git a/org.envirocar.app/src/org/envirocar/app/BaseApplicationModule.java b/org.envirocar.app/src/org/envirocar/app/BaseApplicationModule.java index e6f0891fa..02d9f5371 100644 --- a/org.envirocar.app/src/org/envirocar/app/BaseApplicationModule.java +++ b/org.envirocar.app/src/org/envirocar/app/BaseApplicationModule.java @@ -31,28 +31,13 @@ import org.envirocar.app.handler.HandlerModule; import org.envirocar.app.handler.TemporaryFileManager; import org.envirocar.app.handler.TrackRecordingHandler; -import org.envirocar.app.services.SystemStartupService; -import org.envirocar.app.services.TrackUploadService; -import org.envirocar.app.services.obd.OBDServiceHandler; -import org.envirocar.app.view.LoginActivity; -import org.envirocar.app.view.carselection.CarSelectionActivity; -import org.envirocar.app.view.carselection.CarSelectionAddCarFragment; -import org.envirocar.app.view.logbook.LogbookActivity; -import org.envirocar.app.view.logbook.LogbookAddFuelingFragment; -import org.envirocar.app.view.obdselection.OBDSelectionActivity; -import org.envirocar.app.view.preferences.BluetoothDiscoveryIntervalPreference; -import org.envirocar.app.view.preferences.BluetoothPairingPreference; -import org.envirocar.app.view.preferences.SelectBluetoothPreference; -import org.envirocar.app.view.settings.SettingsActivity; -import org.envirocar.app.view.trackdetails.TrackDetailsActivity; -import org.envirocar.app.view.trackdetails.TrackStatisticsActivity; -import org.envirocar.core.injection.InjectApplicationScope; -import org.envirocar.core.injection.Injector; +import org.envirocar.core.util.InjectApplicationScope; +import org.envirocar.app.services.OBDServiceModule; +import org.envirocar.core.CacheDirectoryProvider; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.CacheModule; -import org.envirocar.remote.DAOProvider; +import org.envirocar.core.util.Util; +import org.envirocar.app.handler.DAOProvider; import org.envirocar.remote.RemoteModule; -import org.envirocar.remote.service.EnviroCarService; import org.envirocar.storage.DatabaseModule; import javax.inject.Singleton; @@ -69,30 +54,11 @@ @Module( includes = { RemoteModule.class, - CacheModule.class, DatabaseModule.class, - HandlerModule.class - }, - injects = { - BluetoothPairingPreference.class, - SelectBluetoothPreference.class, - TemporaryFileManager.class, - SystemStartupService.class, - BluetoothDiscoveryIntervalPreference.class, - TrackDetailsActivity.class, - CarSelectionActivity.class, - OBDSelectionActivity.class, - TrackStatisticsActivity.class, - LoginActivity.class, - SettingsActivity.class, - TrackUploadService.class, - LogbookActivity.class, - LogbookAddFuelingFragment.class, - CarSelectionAddCarFragment.class - }, - staticInjections = {EnviroCarService.class, OBDServiceHandler.class}, - library = true, - complete = false + HandlerModule.class, + OBDServiceModule.class + } + ) public class BaseApplicationModule { private static final Logger LOGGER = Logger.getLogger(BaseApplicationModule.class); @@ -133,17 +99,6 @@ Context provideApplicationContext() { return mAppContext; } - /** - * Provides the Application Injector. - * - * @return the Injector of the application. - */ - @Provides - @Singleton - Injector provideApplicationInjector() { - return (Injector) mApplication; - } - /** * Provides the event bus for the application. * @@ -199,4 +154,16 @@ SharedPreferences provideSharedPreferences(@InjectApplicationScope Context conte RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs){ return RxSharedPreferences.create(prefs); } + + /** + * Provides the CacheDirectoryProvider. + * + * @return the provider for cache access. + */ + @Provides + @Singleton + public CacheDirectoryProvider provideCacheDirectoryProvider( + @InjectApplicationScope Context context) { + return () -> Util.resolveCacheFolder(context); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java index f90e0b06f..ad9e07efa 100644 --- a/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/BaseMainActivity.java @@ -55,6 +55,7 @@ import org.envirocar.app.handler.PreferencesHandler; import org.envirocar.app.handler.TemporaryFileManager; import org.envirocar.app.handler.UserHandler; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.app.services.OBDConnectionService; import org.envirocar.app.services.SystemStartupService; import org.envirocar.app.view.HelpActivity; @@ -73,16 +74,14 @@ import org.envirocar.core.exception.DataRetrievalFailureException; import org.envirocar.core.exception.NoMeasurementsException; import org.envirocar.core.exception.NotConnectedException; -import org.envirocar.core.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; import org.envirocar.core.util.Util; import org.envirocar.core.util.VersionRange; import org.envirocar.obd.events.BluetoothServiceStateChangedEvent; import org.envirocar.obd.service.BluetoothServiceState; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -90,8 +89,8 @@ import javax.inject.Inject; -import butterknife.ButterKnife; import butterknife.BindView; +import butterknife.ButterKnife; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.subscriptions.CompositeSubscription; @@ -158,6 +157,12 @@ public class BaseMainActivity extends BaseInjectorActivity { private Scheduler.Worker mMainThreadWorker = AndroidSchedulers.mainThread().createWorker(); + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(this)); + mainActivityComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { /** @@ -604,11 +609,6 @@ private void replaceFragment(Fragment fragment, int animIn, int animOut) { ft.commit(); } - @Override - public List getInjectionModules() { - return Arrays.asList(new MainActivityModule(this)); - } - @Subscribe public void onReceiveTrackFinishedEvent(final TrackFinishedEvent event) { LOGGER.info(String.format("onReceiveTrackFinishedEvent(): event=%s", event.toString())); diff --git a/org.envirocar.app/src/org/envirocar/app/MainActivityComponent.java b/org.envirocar.app/src/org/envirocar/app/MainActivityComponent.java new file mode 100644 index 000000000..8cf4e45a7 --- /dev/null +++ b/org.envirocar.app/src/org/envirocar/app/MainActivityComponent.java @@ -0,0 +1,37 @@ +package org.envirocar.app; + +import org.envirocar.app.view.LogbookFragment; +import org.envirocar.app.view.dashboard.DashboardMainFragment; +import org.envirocar.app.view.dashboard.DashboardMapFragment; +import org.envirocar.app.view.dashboard.DashboardTempomatFragment; +import org.envirocar.app.view.dashboard.DashboardTrackDetailsFragment; +import org.envirocar.app.view.dashboard.DashboardTrackMapFragment; +import org.envirocar.app.view.dashboard.DashboardTrackSettingsFragment; +import org.envirocar.app.view.tracklist.TrackListLocalCardFragment; +import org.envirocar.app.view.tracklist.TrackListPagerFragment; +import org.envirocar.app.view.tracklist.TrackListRemoteCardFragment; + +import dagger.Subcomponent; + +/** + * @author Sai Krishna + */ +@Subcomponent( + modules = MainActivityModule.class +) +public interface MainActivityComponent { + + void inject(BaseMainActivity baseMainActivity); + void inject(DashboardMainFragment dashboardMainFragment); + void inject(DashboardMapFragment dashboardMapFragment); + void inject(DashboardTempomatFragment dashboardTempomatFragment); + void inject(DashboardTrackDetailsFragment dashboardTrackDetailsFragment); + void inject(DashboardTrackMapFragment dashboardTrackMapFragment); + void inject(DashboardTrackSettingsFragment dashboardTrackSettingsFragment); + void inject(TrackListLocalCardFragment trackListLocalCardFragment); + void inject(TrackListPagerFragment trackListPagerFragment); + void inject(TrackListRemoteCardFragment trackListRemoteCardFragment); + void inject(LogbookFragment logbookFragment); + + +} diff --git a/org.envirocar.app/src/org/envirocar/app/MainActivityModule.java b/org.envirocar.app/src/org/envirocar/app/MainActivityModule.java index 3ca77eead..eaa74eeed 100644 --- a/org.envirocar.app/src/org/envirocar/app/MainActivityModule.java +++ b/org.envirocar.app/src/org/envirocar/app/MainActivityModule.java @@ -22,23 +22,7 @@ import android.app.Activity; import android.content.Context; -import org.envirocar.app.activity.StartStopButtonUtil; -import org.envirocar.app.handler.CarPreferenceHandler; -import org.envirocar.app.handler.TermsOfUseManager; -import org.envirocar.app.view.LogbookFragment; -import org.envirocar.app.view.dashboard.DashboardMainFragment; -import org.envirocar.app.view.dashboard.DashboardMapFragment; -import org.envirocar.app.view.dashboard.DashboardTempomatFragment; -import org.envirocar.app.view.dashboard.DashboardTrackDetailsFragment; -import org.envirocar.app.view.dashboard.DashboardTrackMapFragment; -import org.envirocar.app.view.dashboard.DashboardTrackSettingsFragment; -import org.envirocar.app.view.preferences.Tempomat; -import org.envirocar.app.view.tracklist.AbstractTrackListCardFragment; -import org.envirocar.app.view.tracklist.TrackListLocalCardFragment; -import org.envirocar.app.view.tracklist.TrackListPagerFragment; -import org.envirocar.app.view.tracklist.TrackListRemoteCardFragment; -import org.envirocar.app.views.ReactiveTermsOfUseDialog; -import org.envirocar.core.injection.InjectionActivityScope; +import org.envirocar.core.util.InjectionActivityScope; import dagger.Module; import dagger.Provides; @@ -48,31 +32,7 @@ * * @author dewall */ -@Module( - injects = { - BaseMainActivity.class, - TermsOfUseManager.class, - CarPreferenceHandler.class, - LogbookFragment.class, - StartStopButtonUtil.class, - Tempomat.class, - DashboardMainFragment.class, - LogbookFragment.class, - DashboardTrackDetailsFragment.class, - DashboardTempomatFragment.class, - DashboardTrackSettingsFragment.class, - DashboardMapFragment.class, - DashboardTrackMapFragment.class, - TrackListPagerFragment.class, - AbstractTrackListCardFragment.class, - TrackListLocalCardFragment.class, - TrackListRemoteCardFragment.class, - ReactiveTermsOfUseDialog.class - }, - addsTo = BaseApplicationModule.class, - library = true, - complete = false -) +@Module public class MainActivityModule { private Activity mActivity; diff --git a/org.envirocar.app/src/org/envirocar/app/activity/StartStopButtonUtil.java b/org.envirocar.app/src/org/envirocar/app/activity/StartStopButtonUtil.java index 033662dd8..1782af0c7 100644 --- a/org.envirocar.app/src/org/envirocar/app/activity/StartStopButtonUtil.java +++ b/org.envirocar.app/src/org/envirocar/app/activity/StartStopButtonUtil.java @@ -23,17 +23,17 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; +import org.envirocar.app.BaseApplication; import org.envirocar.app.BaseMainActivity; import org.envirocar.app.R; -import org.envirocar.app.handler.TrackRecordingHandler; import org.envirocar.app.activity.DialogUtil.DialogCallback; import org.envirocar.app.handler.CarPreferenceHandler; -import org.envirocar.obd.service.BluetoothServiceState; -import org.envirocar.app.services.OBDConnectionService; import org.envirocar.app.handler.PreferenceConstants; -import org.envirocar.core.injection.InjectionActivityScope; -import org.envirocar.core.injection.Injector; +import org.envirocar.app.handler.TrackRecordingHandler; +import org.envirocar.app.services.OBDConnectionService; import org.envirocar.core.logging.Logger; +import org.envirocar.core.util.InjectApplicationScope; +import org.envirocar.obd.service.BluetoothServiceState; import javax.inject.Inject; @@ -48,7 +48,7 @@ public class StartStopButtonUtil { private static final Logger LOG = Logger.getLogger(StartStopButtonUtil.class); @Inject - @InjectionActivityScope + @InjectApplicationScope protected Context mContext; @Inject protected CarPreferenceHandler mCarManager; @@ -68,8 +68,7 @@ public class StartStopButtonUtil { public StartStopButtonUtil(Context context, int trackMode, BluetoothServiceState serviceState, boolean deviceDiscoveryActive) { // Inject variables. - ((Injector) context).injectObjects(this); - + BaseApplication.get(context).getBaseApplicationComponent().inject(this); this.trackMode = trackMode; this.serviceState = serviceState; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/BluetoothHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/BluetoothHandler.java index ea9dc6e77..d47757bf2 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/BluetoothHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/BluetoothHandler.java @@ -36,7 +36,7 @@ import org.envirocar.core.events.bluetooth.BluetoothDeviceDiscoveredEvent; import org.envirocar.core.events.bluetooth.BluetoothDeviceSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.core.utils.BroadcastUtils; import org.envirocar.core.utils.ServiceUtils; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/CarPreferenceHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/CarPreferenceHandler.java index d2e9ee8c6..92f6e9b29 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/CarPreferenceHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/CarPreferenceHandler.java @@ -35,10 +35,9 @@ import org.envirocar.core.exception.DataCreationFailureException; import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.core.utils.CarUtils; -import org.envirocar.remote.DAOProvider; import org.envirocar.storage.EnviroCarDB; import java.util.ArrayList; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/CarRemoteListCache.java b/org.envirocar.app/src/org/envirocar/app/handler/CarRemoteListCache.java index 0e78a5b7f..62df2daf2 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/CarRemoteListCache.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/CarRemoteListCache.java @@ -3,7 +3,6 @@ import android.content.SharedPreferences; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/org.envirocar.remote/src/main/java/org/envirocar/remote/DAOProvider.java b/org.envirocar.app/src/org/envirocar/app/handler/DAOProvider.java similarity index 62% rename from org.envirocar.remote/src/main/java/org/envirocar/remote/DAOProvider.java rename to org.envirocar.app/src/org/envirocar/app/handler/DAOProvider.java index 8c6d24eed..0316ab9d9 100644 --- a/org.envirocar.remote/src/main/java/org/envirocar/remote/DAOProvider.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/DAOProvider.java @@ -16,10 +16,12 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.remote; +package org.envirocar.app.handler; import android.content.Context; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.core.CacheDirectoryProvider; import org.envirocar.core.InternetAccessProvider; import org.envirocar.core.dao.AnnouncementDAO; @@ -29,25 +31,10 @@ import org.envirocar.core.dao.TrackDAO; import org.envirocar.core.dao.UserDAO; import org.envirocar.core.dao.UserStatisticsDAO; -import org.envirocar.core.injection.Injector; -import org.envirocar.remote.dao.CacheAnnouncementsDAO; import org.envirocar.remote.dao.CacheCarDAO; -import org.envirocar.remote.dao.CacheFuelingDAO; -import org.envirocar.remote.dao.CacheTermsOfUseDAO; -import org.envirocar.remote.dao.CacheTrackDAO; -import org.envirocar.remote.dao.CacheUserDAO; -import org.envirocar.remote.dao.RemoteAnnouncementsDAO; -import org.envirocar.remote.dao.RemoteCarDAO; -import org.envirocar.remote.dao.RemoteFuelingDAO; -import org.envirocar.remote.dao.RemoteTermsOfUseDAO; -import org.envirocar.remote.dao.RemoteTrackDAO; -import org.envirocar.remote.dao.RemoteUserDAO; -import org.envirocar.remote.dao.RemoteUserStatisticsDAO; import javax.inject.Inject; -import dagger.ObjectGraph; - /** * TODO JavaDoc * @@ -64,8 +51,7 @@ public class DAOProvider { @Inject protected CacheDirectoryProvider mCacheDirectoryProvider; - // Graph for Dependency Injection. - private ObjectGraph mObjectGraph; + BaseApplicationComponent baseApplicationComponent; /** * Constructor. @@ -76,17 +62,18 @@ public DAOProvider(final Context context) { this.mAppContext = context; // Extend the object graph with the injection modules for DAOs - this.mObjectGraph = ((Injector) context).getObjectGraph(); - this.mObjectGraph.inject(this); + baseApplicationComponent = BaseApplication.get(context).getBaseApplicationComponent(); + baseApplicationComponent.inject(this); + } /** * @return the {@link CarDAO} */ public CarDAO getSensorDAO() { - CacheCarDAO cacheSensorDao = mObjectGraph.get(CacheCarDAO.class); + CacheCarDAO cacheSensorDao = baseApplicationComponent.getCacheCarDAO(); if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteCarDAO.class); + return baseApplicationComponent.getRemoteCarDAO(); } return cacheSensorDao; } @@ -96,9 +83,9 @@ public CarDAO getSensorDAO() { */ public TrackDAO getTrackDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteTrackDAO.class); + return baseApplicationComponent.getRemoteTrackDAO(); } - return mObjectGraph.get(CacheTrackDAO.class); + return baseApplicationComponent.getCacheTrackDAO(); } /** @@ -106,16 +93,16 @@ public TrackDAO getTrackDAO() { */ public UserDAO getUserDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteUserDAO.class); + return baseApplicationComponent.getRemoteUserDAO(); } - return mObjectGraph.get(CacheUserDAO.class); + return baseApplicationComponent.getCacheUserDAO(); } public UserStatisticsDAO getUserStatisticsDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteUserStatisticsDAO.class); + return baseApplicationComponent.getRemoteUserStatisticsDAO(); } - return mObjectGraph.get(RemoteUserStatisticsDAO.class); + return baseApplicationComponent.getRemoteUserStatisticsDAO(); } /** @@ -123,9 +110,9 @@ public UserStatisticsDAO getUserStatisticsDAO() { */ public FuelingDAO getFuelingDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteFuelingDAO.class); + return baseApplicationComponent.getRemoteFuelingDAO(); } - return mObjectGraph.get(CacheFuelingDAO.class); + return baseApplicationComponent.getCacheFuelingDAO(); } /** @@ -133,16 +120,16 @@ public FuelingDAO getFuelingDAO() { */ public TermsOfUseDAO getTermsOfUseDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteTermsOfUseDAO.class); + return baseApplicationComponent.getRemoteTermsOfUseDAO(); } - return mObjectGraph.get(CacheTermsOfUseDAO.class); + return baseApplicationComponent.getCacheTermsOfUseDAO(); } public AnnouncementDAO getAnnouncementsDAO() { if (this.mInternetAccessProvider.isConnected()) { - return mObjectGraph.get(RemoteAnnouncementsDAO.class); + return baseApplicationComponent.getRemoteAnnouncementsDAO(); } - return mObjectGraph.get(CacheAnnouncementsDAO.class); + return baseApplicationComponent.getCacheAnnouncementsDAO(); } } diff --git a/org.envirocar.app/src/org/envirocar/app/handler/HandlerModule.java b/org.envirocar.app/src/org/envirocar/app/handler/HandlerModule.java index fa13e6a5b..3832148eb 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/HandlerModule.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/HandlerModule.java @@ -10,21 +10,7 @@ * * @author dewall */ -@Module( - complete = false, - library = true, - injects = { - BluetoothHandler.class, - CarPreferenceHandler.class, - LocationHandler.class, - TemporaryFileManager.class, - TermsOfUseManager.class, - TrackDAOHandler.class, - TrackRecordingHandler.class, - TrackUploadHandler.class, - UserHandler.class - } -) +@Module public class HandlerModule { @Provides diff --git a/org.envirocar.app/src/org/envirocar/app/handler/LocationHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/LocationHandler.java index 83d80f232..1298096b4 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/LocationHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/LocationHandler.java @@ -36,7 +36,7 @@ import org.envirocar.core.events.gps.GpsSatelliteFix; import org.envirocar.core.events.gps.GpsSatelliteFixEvent; import org.envirocar.core.events.gps.GpsStateChangedEvent; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import javax.inject.Inject; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/TemporaryFileManager.java b/org.envirocar.app/src/org/envirocar/app/handler/TemporaryFileManager.java index 9cd43c160..49f5150f5 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/TemporaryFileManager.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/TemporaryFileManager.java @@ -20,7 +20,7 @@ import android.content.Context; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.core.util.Util; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/TermsOfUseManager.java b/org.envirocar.app/src/org/envirocar/app/handler/TermsOfUseManager.java index b4c477e9a..725bd7364 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/TermsOfUseManager.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/TermsOfUseManager.java @@ -35,9 +35,8 @@ import org.envirocar.core.exception.DataUpdateFailureException; import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; import java.util.List; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/TrackDAOHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/TrackDAOHandler.java index 9fa97cfe7..a6862b331 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/TrackDAOHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/TrackDAOHandler.java @@ -10,11 +10,10 @@ import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.TrackSerializationException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.core.util.TrackMetadata; import org.envirocar.core.util.Util; -import org.envirocar.remote.DAOProvider; import org.envirocar.storage.EnviroCarDB; import java.util.ArrayList; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/TrackRecordingHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/TrackRecordingHandler.java index 81be5f480..bac11ec2a 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/TrackRecordingHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/TrackRecordingHandler.java @@ -22,6 +22,7 @@ import com.squareup.otto.Bus; +import org.envirocar.app.BaseApplication; import org.envirocar.app.R; import org.envirocar.core.entity.Car; import org.envirocar.core.entity.Measurement; @@ -30,12 +31,10 @@ import org.envirocar.core.events.TrackFinishedEvent; import org.envirocar.core.exception.MeasurementSerializationException; import org.envirocar.core.exception.NoMeasurementsException; -import org.envirocar.core.injection.InjectApplicationScope; -import org.envirocar.core.injection.Injector; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.obd.events.BluetoothServiceStateChangedEvent; import org.envirocar.obd.service.BluetoothServiceState; -import org.envirocar.remote.DAOProvider; import org.envirocar.storage.EnviroCarDB; import java.text.DateFormat; @@ -93,7 +92,7 @@ public class TrackRecordingHandler { */ public TrackRecordingHandler(Context context) { // Inject all annotated fields. - ((Injector) context).injectObjects(this); + BaseApplication.get(context).getBaseApplicationComponent().inject(this); } public Subscription startNewTrack(PublishSubject publishSubject) { diff --git a/org.envirocar.app/src/org/envirocar/app/handler/TrackUploadHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/TrackUploadHandler.java index fd8fce570..d52d7e0fa 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/TrackUploadHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/TrackUploadHandler.java @@ -31,10 +31,9 @@ import org.envirocar.core.entity.Track; import org.envirocar.core.exception.NoMeasurementsException; import org.envirocar.core.exception.TrackWithNoValidCarException; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import org.envirocar.core.utils.TrackUtils; -import org.envirocar.remote.DAOProvider; import org.envirocar.storage.EnviroCarDB; import java.util.List; diff --git a/org.envirocar.app/src/org/envirocar/app/handler/UserHandler.java b/org.envirocar.app/src/org/envirocar/app/handler/UserHandler.java index ac2d2132d..70e6587a9 100644 --- a/org.envirocar.app/src/org/envirocar/app/handler/UserHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/handler/UserHandler.java @@ -32,9 +32,8 @@ import org.envirocar.core.entity.UserImpl; import org.envirocar.core.events.NewUserSettingsEvent; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; import org.envirocar.remote.gravatar.GravatarUtils; import java.io.IOException; diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorActivity.java b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorActivity.java similarity index 64% rename from org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorActivity.java rename to org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorActivity.java index a4102bdf6..2725c4f08 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorActivity.java @@ -16,28 +16,25 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.core.injection; +package org.envirocar.app.injection; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; -import com.google.common.base.Preconditions; import com.squareup.otto.Bus; -import java.util.ArrayList; -import java.util.List; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.BaseApplicationComponent; import javax.inject.Inject; -import dagger.ObjectGraph; /** * @author dewall */ -public abstract class BaseInjectorActivity extends AppCompatActivity implements Injector, - InjectionModuleProvider { - private ObjectGraph mObjectGraph; +public abstract class BaseInjectorActivity extends AppCompatActivity { + protected abstract void injectDependencies(BaseApplicationComponent baseApplicationComponent); // Injected variables. @Inject @@ -45,13 +42,8 @@ public abstract class BaseInjectorActivity extends AppCompatActivity implements @Override protected void onCreate(Bundle savedInstanceState) { - mObjectGraph = ((Injector) getApplicationContext()).getObjectGraph().plus - (getInjectionModules().toArray()); - super.onCreate(savedInstanceState); - - // Inject all variables in this object. - injectObjects(this); + injectDependencies(BaseApplication.get(this).getBaseApplicationComponent()); } @Override @@ -79,21 +71,4 @@ public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); return false; } - - @Override - public ObjectGraph getObjectGraph() { - return mObjectGraph; - } - - @Override - public List getInjectionModules() { - return new ArrayList<>(); - } - - @Override - public void injectObjects(Object instance) { - Preconditions.checkNotNull(instance, "Cannot inject into Null objects."); - Preconditions.checkNotNull(mObjectGraph, "The ObjectGraph must be initialized before use."); - mObjectGraph.inject(instance); - } } diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorFragment.java b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorFragment.java similarity index 60% rename from org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorFragment.java rename to org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorFragment.java index acefc0a4c..25792ba30 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorFragment.java @@ -16,29 +16,28 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.core.injection; +package org.envirocar.app.injection; -import android.app.Activity; +import android.content.Context; import android.support.v4.app.Fragment; import android.util.Log; import com.google.common.base.Preconditions; import com.squareup.otto.Bus; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.BaseApplicationComponent; + import java.lang.reflect.Field; -import java.util.List; import javax.inject.Inject; -import dagger.ObjectGraph; - /** * @author dewall */ -public abstract class BaseInjectorFragment extends Fragment implements Injector, - InjectionModuleProvider { +public abstract class BaseInjectorFragment extends Fragment { private static final String TAG = BaseInjectorFragment.class.getSimpleName(); private static final Field mChildFragmentManagerFieldOfFragment; @@ -62,12 +61,6 @@ public abstract class BaseInjectorFragment extends Fragment implements Injector, @Inject protected Bus mBus; - /** - * A graph of objects linked by their dependencies. This class is used for - * dependency injection. (see Dagger library) - */ - private ObjectGraph mObjectGraph; - /** * Flag that indicates that the fragment is already attached and the object * graph was initialized. @@ -75,24 +68,18 @@ public abstract class BaseInjectorFragment extends Fragment implements Injector, private boolean mAlreadyAttached; private boolean mIsRegistered; + protected abstract void injectDependencies(BaseApplicationComponent baseApplicationComponent); @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - + public void onAttach(Context context) { + super.onAttach(context); // Check if it is the first time where this fragment was attached to the // activity. If false, the ObjectGraph will be extended by fragment // specific modules and the dependencies will be injected. - if (!mAlreadyAttached || mObjectGraph == null) { - ObjectGraph objectGraph = ((Injector) getActivity()).getObjectGraph(); - List moduleList = getInjectionModules(); - if (moduleList != null) { - objectGraph = objectGraph.plus(moduleList.toArray()); - } - this.mObjectGraph = objectGraph; - - // Inject ourselves. - injectObjects(this); + if (!mAlreadyAttached) { + + injectDependencies(BaseApplication.get(context).getBaseApplicationComponent()); + mAlreadyAttached = true; Preconditions.checkState(mBus != null, "Bus has to be injected before " @@ -104,6 +91,7 @@ public void onAttach(Activity activity) { mBus.register(this); mIsRegistered = true; } + } @Override @@ -121,40 +109,4 @@ public void onDetach() { mIsRegistered = false; } } - - /** - * Gets the object graph of the implemented class. - * - * @return the object graph - */ - @Override - public final ObjectGraph getObjectGraph() { - return mObjectGraph; - } - - /** - * Injects a target object using this object's object graph. - * - * @param instance the target object - */ - @Override - public void injectObjects(Object instance) { - Preconditions.checkState(mObjectGraph != null, - "ObjectGraph must be initialized before injecting objects."); - mObjectGraph.inject(instance); - Log.d(TAG, "Objects successfully injected into " - + instance.getClass().getSimpleName()); - } - - /** - * Returns a list of modules to be added to the ObjectGraph. Originally this - * function returns null, but can be extended by subclasses by own modules. - * - * @return a list of modules - */ - @Override - public List getInjectionModules() { - return null; - } - } diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorService.java b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorService.java similarity index 56% rename from org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorService.java rename to org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorService.java index c5159dccd..627121a16 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/BaseInjectorService.java +++ b/org.envirocar.app/src/org/envirocar/app/injection/BaseInjectorService.java @@ -16,31 +16,29 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.core.injection; +package org.envirocar.app.injection; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.support.annotation.Nullable; -import com.google.common.base.Preconditions; import com.squareup.otto.Bus; -import java.util.ArrayList; -import java.util.List; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.BaseApplicationComponent; import javax.inject.Inject; -import dagger.ObjectGraph; /** * TODO JavaDoc * * @author dewall */ -public abstract class BaseInjectorService extends Service implements Injector, InjectionModuleProvider { +public abstract class BaseInjectorService extends Service { - private ObjectGraph objectGraph; + protected abstract void injectDependencies(BaseApplicationComponent baseApplicationComponent); // Injected variables. @Inject @@ -55,29 +53,6 @@ public IBinder onBind(Intent intent) { @Override public void onCreate() { super.onCreate(); - - // extend the object graph of the application scope - objectGraph = ((Injector) getApplicationContext()) - .getObjectGraph().plus(getInjectionModules().toArray()); - - // Inject objects - objectGraph.inject(this); - } - - @Override - public List getInjectionModules() { - return new ArrayList<>(); - } - - @Override - public ObjectGraph getObjectGraph() { - return objectGraph; - } - - @Override - public void injectObjects(Object instance) { - Preconditions.checkNotNull(objectGraph, - "Object graph has to be initialized before inejcting"); - objectGraph.inject(instance); + injectDependencies(BaseApplication.get(this).getBaseApplicationComponent()); } } diff --git a/org.envirocar.app/src/org/envirocar/app/services/NotificationHandler.java b/org.envirocar.app/src/org/envirocar/app/services/NotificationHandler.java index 606a636ff..c3fd458d1 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/NotificationHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/services/NotificationHandler.java @@ -36,8 +36,8 @@ //import org.envirocar.app.services.obd.OBDServiceState; //import org.envirocar.app.view.carselection.CarSelectionActivity; //import org.envirocar.app.view.obdselection.OBDSelectionActivity; -//import org.envirocar.core.injection.InjectApplicationScope; -//import org.envirocar.core.injection.Injector; +//import org.envirocar.core.util.InjectApplicationScope; +//import org.envirocar.app.injection.Injector; //import org.envirocar.core.logging.Logger; // //import java.util.Map; diff --git a/org.envirocar.app/src/org/envirocar/app/services/OBDConnectionService.java b/org.envirocar.app/src/org/envirocar/app/services/OBDConnectionService.java index d88203cca..cc9376df1 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/OBDConnectionService.java +++ b/org.envirocar.app/src/org/envirocar/app/services/OBDConnectionService.java @@ -18,25 +18,23 @@ */ package org.envirocar.app.services; -import android.app.Notification; -import android.app.NotificationManager; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.content.Intent; import android.os.PowerManager; import android.speech.tts.TextToSpeech; -import android.support.v4.app.NotificationCompat; import com.squareup.otto.Subscribe; import org.envirocar.algorithm.MeasurementProvider; -import org.envirocar.app.R; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.events.TrackDetailsProvider; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.handler.LocationHandler; import org.envirocar.app.handler.PreferencesHandler; import org.envirocar.app.handler.TrackRecordingHandler; +import org.envirocar.app.injection.BaseInjectorService; import org.envirocar.core.entity.Car; import org.envirocar.core.entity.Measurement; import org.envirocar.core.events.NewMeasurementEvent; @@ -46,7 +44,6 @@ import org.envirocar.core.exception.FuelConsumptionException; import org.envirocar.core.exception.NoMeasurementsException; import org.envirocar.core.exception.UnsupportedFuelTypeException; -import org.envirocar.core.injection.BaseInjectorService; import org.envirocar.core.logging.Logger; import org.envirocar.core.trackprocessing.AbstractCalculatedMAFAlgorithm; import org.envirocar.core.trackprocessing.CalculatedMAFWithStaticVolumetricEfficiency; @@ -62,8 +59,6 @@ import org.envirocar.storage.EnviroCarDB; import java.io.IOException; -import java.util.Arrays; -import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -76,8 +71,6 @@ import rx.schedulers.Schedulers; import rx.subjects.PublishSubject; -import static org.envirocar.app.services.obd.OBDServiceHandler.context; - /** * @author dewall */ @@ -143,6 +136,11 @@ public static void stopService(Context context){ private final Scheduler.Worker backgroundWorker = Schedulers.io().createWorker(); + @Override + protected void injectDependencies(BaseApplicationComponent appComponent) { + appComponent.inject(this); + } + @Override public void onCreate() { LOG.info("OBDConnectionService.onCreate()"); @@ -246,11 +244,6 @@ public void onDestroy() { LOG.info("OBDConnectionService successfully destroyed"); } - @Override - public List getInjectionModules() { - return Arrays.asList(new OBDServiceModule()); - } - @Subscribe public void onReceiveGpsSatelliteFixEvent(GpsSatelliteFixEvent event) { boolean isFix = event.mGpsSatelliteFix.isFix(); diff --git a/org.envirocar.app/src/org/envirocar/app/services/OBDServiceModule.java b/org.envirocar.app/src/org/envirocar/app/services/OBDServiceModule.java index f7ea63a91..de6d61eee 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/OBDServiceModule.java +++ b/org.envirocar.app/src/org/envirocar/app/services/OBDServiceModule.java @@ -21,12 +21,9 @@ import android.content.Context; import android.os.PowerManager; -import com.squareup.otto.Bus; - import org.envirocar.algorithm.InterpolationMeasurementProvider; import org.envirocar.algorithm.MeasurementProvider; -import org.envirocar.app.events.TrackDetailsProvider; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import javax.inject.Singleton; @@ -36,14 +33,7 @@ /** * @author dewall */ -@Module( - complete = false, - library = true, - injects = { - OBDConnectionService.class, - OBDConnectionHandler.class - } -) +@Module public class OBDServiceModule { @Singleton @@ -53,12 +43,6 @@ PowerManager.WakeLock provideWakeLock(@InjectApplicationScope Context context) { .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "wakelock"); } - @Singleton - @Provides - TrackDetailsProvider provideTrackDetails(Bus bus) { - return new TrackDetailsProvider(bus); - } - @Singleton @Provides MeasurementProvider provideMeasurementProvider() { diff --git a/org.envirocar.app/src/org/envirocar/app/services/SystemStartupService.java b/org.envirocar.app/src/org/envirocar/app/services/SystemStartupService.java index c1e886dcd..1bdd531eb 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/SystemStartupService.java +++ b/org.envirocar.app/src/org/envirocar/app/services/SystemStartupService.java @@ -18,7 +18,6 @@ */ package org.envirocar.app.services; -import android.app.Service; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; @@ -27,19 +26,19 @@ import android.os.IBinder; import android.widget.Toast; -import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.handler.PreferencesHandler; import org.envirocar.app.handler.TrackRecordingHandler; +import org.envirocar.app.injection.BaseInjectorService; import org.envirocar.app.services.obd.OBDServiceHandler; import org.envirocar.app.services.obd.OBDServiceState; import org.envirocar.core.events.NewCarTypeSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothDeviceSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; import org.envirocar.core.utils.ServiceUtils; import org.envirocar.obd.events.BluetoothServiceStateChangedEvent; @@ -64,7 +63,7 @@ * * @author dewall */ -public class SystemStartupService extends Service { +public class SystemStartupService extends BaseInjectorService { private static final Logger LOGGER = Logger.getLogger(SystemStartupService.class); public static final void startService(Context context) { @@ -85,8 +84,6 @@ public static final void stopService(Context context) { // Injected variables @Inject - protected Bus mBus; - @Inject protected BluetoothHandler mBluetoothHandler; @Inject protected TrackRecordingHandler mTrackRecordingHandler; @@ -165,11 +162,8 @@ public void onCreate() { LOGGER.info("onCreate()"); super.onCreate(); - // Inject ourselves. - ((Injector) getApplicationContext()).injectObjects(this); - // Register on the event bus. - this.mBus.register(this); + this.bus.register(this); // Get the required preference settings. this.mDiscoveryInterval = PreferencesHandler.getDiscoveryInterval(context); @@ -241,6 +235,11 @@ public void onCreate() { } + @Override + protected void injectDependencies(BaseApplicationComponent appComponent) { + appComponent.inject(this); + } + @Override public IBinder onBind(Intent intent) { return null; diff --git a/org.envirocar.app/src/org/envirocar/app/services/TrackUploadService.java b/org.envirocar.app/src/org/envirocar/app/services/TrackUploadService.java index 9018f55c1..37143da37 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/TrackUploadService.java +++ b/org.envirocar.app/src/org/envirocar/app/services/TrackUploadService.java @@ -32,12 +32,13 @@ import android.support.v4.app.TaskStackBuilder; import android.widget.RemoteViews; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.BaseMainActivity; import org.envirocar.app.R; import org.envirocar.app.handler.TrackRecordingHandler; import org.envirocar.app.handler.TrackUploadHandler; +import org.envirocar.app.injection.BaseInjectorService; import org.envirocar.core.entity.Track; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; import org.envirocar.storage.EnviroCarDB; @@ -55,7 +56,7 @@ * * @author dewall */ -public class TrackUploadService extends Service { +public class TrackUploadService extends BaseInjectorService { private static final Logger LOG = Logger.getLogger(TrackUploadService.class); private static final int NOTIFICATION_ID = 52; @@ -70,9 +71,6 @@ public class TrackUploadService extends Service { public void onCreate() { LOG.debug("onCreate()"); super.onCreate(); - - // Inject the OBDServiceHandler; - ((Injector) getApplicationContext()).injectObjects(this); } @Override @@ -106,6 +104,11 @@ public void onDestroy() { super.onDestroy(); } + @Override + protected void injectDependencies(BaseApplicationComponent appComponent) { + appComponent.inject(this); + } + @Nullable @Override public IBinder onBind(Intent intent) { diff --git a/org.envirocar.app/src/org/envirocar/app/services/obd/OBDServiceHandler.java b/org.envirocar.app/src/org/envirocar/app/services/obd/OBDServiceHandler.java index a9c11a9ac..b487076ce 100644 --- a/org.envirocar.app/src/org/envirocar/app/services/obd/OBDServiceHandler.java +++ b/org.envirocar.app/src/org/envirocar/app/services/obd/OBDServiceHandler.java @@ -7,7 +7,7 @@ import android.widget.RemoteViews; import org.envirocar.app.R; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.core.logging.Logger; import javax.inject.Inject; @@ -22,8 +22,7 @@ public class OBDServiceHandler { private static final Logger LOG = Logger.getLogger(OBDServiceHandler.class); - @Inject - @InjectApplicationScope + public static Context context; private static Notification foregroundNotification; @@ -33,7 +32,7 @@ public class OBDServiceHandler { @Inject public OBDServiceHandler(@InjectApplicationScope Context context) { - // this.context = context; + // OBDServiceHandler.context = context; // // this.notificationManager = (NotificationManager) context.getSystemService(Context // .NOTIFICATION_SERVICE); diff --git a/org.envirocar.app/src/org/envirocar/app/view/LogbookFragment.java b/org.envirocar.app/src/org/envirocar/app/view/LogbookFragment.java index 693a661d5..3c7d2b9cf 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/LogbookFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/LogbookFragment.java @@ -23,7 +23,10 @@ import android.view.View; import android.widget.Button; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; +import org.envirocar.app.injection.BaseInjectorFragment; public class LogbookFragment extends BaseInjectorFragment implements OnClickListener, android.view.View.OnClickListener { @@ -250,4 +253,9 @@ public void onClick(DialogInterface dialog, int which) { } -} + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } +} diff --git a/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java b/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java index 7ccba15a9..ba962840f 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/LoginActivity.java @@ -42,6 +42,7 @@ import com.afollestad.materialdialogs.MaterialDialog; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.TermsOfUseManager; import org.envirocar.app.handler.TrackDAOHandler; @@ -54,9 +55,9 @@ import org.envirocar.core.entity.UserImpl; import org.envirocar.core.exception.DataUpdateFailureException; import org.envirocar.core.exception.ResourceConflictException; -import org.envirocar.core.injection.BaseInjectorActivity; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.util.concurrent.TimeUnit; @@ -144,6 +145,11 @@ public class LoginActivity extends BaseInjectorActivity { private Subscription mTermsOfUseSubscription; private Subscription mStatisticsDownloadSubscription; + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java index 5b49f5a9c..da0c60606 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionActivity.java @@ -28,14 +28,15 @@ import android.widget.ArrayAdapter; import android.widget.ListView; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.handler.UserHandler; import org.envirocar.app.view.utils.ECAnimationUtils; import org.envirocar.core.entity.Car; -import org.envirocar.core.injection.BaseInjectorActivity; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.util.ArrayList; import java.util.HashSet; @@ -95,6 +96,11 @@ public class CarSelectionActivity extends BaseInjectorActivity implements CarSel private Subscription loadingCarsSubscription; + @Override + protected void injectDependencies(BaseApplicationComponent appComponent) { + appComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java index ad15b2120..bdad04a9a 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/carselection/CarSelectionAddCarFragment.java @@ -24,14 +24,15 @@ import com.jakewharton.rxbinding.support.v7.widget.RxToolbar; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.view.utils.ECAnimationUtils; import org.envirocar.core.entity.Car; import org.envirocar.core.entity.CarImpl; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.util.ArrayList; import java.util.Calendar; @@ -715,4 +716,9 @@ public void hideKeyboard(View view) { InputMethodManager inputMethodManager =(InputMethodManager)getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } + + @Override + protected void injectDependencies(BaseApplicationComponent appComponent) { + appComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java index d4f16926a..7c0c86933 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMainFragment.java @@ -37,6 +37,9 @@ import com.afollestad.materialdialogs.MaterialDialog; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.handler.CarPreferenceHandler; @@ -47,7 +50,7 @@ import org.envirocar.core.events.NewCarTypeSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; import org.envirocar.core.events.gps.GpsStateChangedEvent; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import org.envirocar.obd.events.BluetoothServiceStateChangedEvent; import org.envirocar.obd.service.BluetoothServiceState; @@ -626,4 +629,9 @@ private void updateStartToStopButton() { } } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java index f5c9b3d1d..5a2c648ca 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardMapFragment.java @@ -27,9 +27,12 @@ import com.mapbox.mapboxsdk.overlay.UserLocationOverlay; import com.mapbox.mapboxsdk.views.MapView; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.app.view.utils.MapUtils; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; @@ -80,4 +83,10 @@ public void onPause() { mMapView.setUserLocationEnabled(false); mMapView.setUserLocationTrackingMode(UserLocationOverlay.TrackingMode.NONE); } + + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java index e0d4b7c8f..fe5971b40 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTempomatFragment.java @@ -28,10 +28,13 @@ import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.obd.events.SpeedUpdateEvent; import org.envirocar.app.view.preferences.Tempomat; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; @@ -107,4 +110,9 @@ public void onReceiveSpeedUpdateEvent(SpeedUpdateEvent event) { } } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java index eb45179ab..2b6382381 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackDetailsFragment.java @@ -30,6 +30,9 @@ import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.obd.service.BluetoothServiceState; import org.envirocar.core.events.gps.GpsSatelliteFixEvent; @@ -38,7 +41,7 @@ import org.envirocar.app.events.AvrgSpeedUpdateEvent; import org.envirocar.app.events.DistanceValueUpdateEvent; import org.envirocar.app.events.StartingTimeEvent; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import java.text.DecimalFormat; @@ -169,6 +172,11 @@ private void updateLocationViews(boolean isFix) { } } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java index 1d372e5fd..e97725b8e 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackMapFragment.java @@ -34,10 +34,13 @@ import com.mapbox.mapboxsdk.views.MapView; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.app.events.TrackPathOverlayEvent; import org.envirocar.app.view.utils.MapUtils; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; @@ -188,4 +191,9 @@ public void onReceivePathOverlayEvent(TrackPathOverlayEvent event) { }); } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } \ No newline at end of file diff --git a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java index f6d9cd505..ec3f37a7b 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/dashboard/DashboardTrackSettingsFragment.java @@ -30,6 +30,9 @@ import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.handler.CarPreferenceHandler; @@ -39,7 +42,7 @@ import org.envirocar.core.events.NewCarTypeSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothDeviceSelectedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import javax.inject.Inject; @@ -179,4 +182,10 @@ private void setCarTypeText(Car car) { mCarTypeSubTextView.setVisibility(View.VISIBLE); } } + + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = baseApplicationComponent.plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java index 3c36343f9..9f3548642 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookActivity.java @@ -29,6 +29,7 @@ import com.afollestad.materialdialogs.MaterialDialog; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.view.utils.ECAnimationUtils; @@ -36,9 +37,9 @@ import org.envirocar.core.entity.Fueling; import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.BaseInjectorActivity; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.util.ArrayList; import java.util.Collections; @@ -101,6 +102,11 @@ public class LogbookActivity extends BaseInjectorActivity implements LogbookUiLi private LogbookAddFuelingFragment addFuelingFragment; private final CompositeSubscription subscription = new CompositeSubscription(); + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { LOG.info("onCreate()"); diff --git a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java index 94064d276..473ff8682 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/logbook/LogbookAddFuelingFragment.java @@ -37,6 +37,7 @@ import com.afollestad.materialdialogs.MaterialDialog; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.CarPreferenceHandler; import org.envirocar.app.view.utils.ECAnimationUtils; @@ -47,9 +48,9 @@ import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.ResourceConflictException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; +import org.envirocar.app.handler.DAOProvider; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -574,6 +575,11 @@ private void showSnackbarInfo(int resourceID) { Snackbar.make(addFuelingToolbar, resourceID, Snackbar.LENGTH_LONG).show(); } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + private class DigitsInputFilter implements InputFilter { private final Pattern pattern; private final EditText editText; diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java index 9633b16a0..d88822ad1 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionActivity.java @@ -28,21 +28,20 @@ import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; import javax.inject.Inject; -import butterknife.ButterKnife; import butterknife.BindView; +import butterknife.ButterKnife; /** * @dewall @@ -64,6 +63,11 @@ public class OBDSelectionActivity extends BaseInjectorActivity implements protected Fragment mOBDSelectionFragment; + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -158,8 +162,4 @@ private void setSwitchState(float value) { } } - @Override - public List getInjectionModules() { - return Arrays.asList(new OBDSelectionModule()); - } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java index 4999d6fd9..73b11d5bb 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionFragment.java @@ -35,11 +35,12 @@ import com.afollestad.materialdialogs.MaterialDialog; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.core.events.bluetooth.BluetoothPairingChangedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import java.util.Set; @@ -62,6 +63,11 @@ public class OBDSelectionFragment extends BaseInjectorFragment { private static final Logger LOGGER = Logger.getLogger(OBDSelectionFragment.class); + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + /** * */ diff --git a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionModule.java b/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionModule.java deleted file mode 100644 index 7b9e6cfc5..000000000 --- a/org.envirocar.app/src/org/envirocar/app/view/obdselection/OBDSelectionModule.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.envirocar.app.view.obdselection; - - -import org.envirocar.app.BaseApplicationModule; - -import dagger.Module; - - -/** - * TODO JavaDoc - * - * @author dewall - */ -@Module( - injects = {OBDSelectionFragment.class}, - addsTo = BaseApplicationModule.class, - library = true, - complete = false -) -public class OBDSelectionModule { -} diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java index fc6739058..a23ec8ada 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothDiscoveryIntervalPreference.java @@ -27,9 +27,9 @@ import android.widget.NumberPicker; import android.widget.TextView; +import org.envirocar.app.BaseApplication; import org.envirocar.app.R; import org.envirocar.core.logging.Logger; -import org.envirocar.core.injection.Injector; import org.envirocar.app.handler.PreferenceConstants; import butterknife.ButterKnife; @@ -85,7 +85,7 @@ public BluetoothDiscoveryIntervalPreference(Context context, AttributeSet attrs) super(context, attrs); // Inject ourselves. - ((Injector) context).injectObjects(this); + BaseApplication.get(context).getBaseApplicationComponent().inject(this); // Set the layout of the dialog to show. setDialogLayoutResource(R.layout.bluetooth_discovery_interval_preference); diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java index e8dc780bf..3914c776d 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/BluetoothPairingPreference.java @@ -36,12 +36,12 @@ import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplication; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.view.preferences.bluetooth.BluetoothDeviceListAdapter; import org.envirocar.core.events.bluetooth.BluetoothPairingChangedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; import java.util.Set; @@ -103,7 +103,7 @@ public BluetoothPairingPreference(Context context, AttributeSet attrs) { super(context, attrs); // Inject fields. - ((Injector) context.getApplicationContext()).injectObjects(this); + BaseApplication.get(context).getBaseApplicationComponent().inject(this); // Set the layout of the dialog to show. setDialogLayoutResource(R.layout.bluetooth_pairing_preference); diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/SelectBluetoothPreference.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/SelectBluetoothPreference.java index fba6173e2..0bc959100 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/SelectBluetoothPreference.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/SelectBluetoothPreference.java @@ -26,10 +26,10 @@ import android.view.View; import android.widget.ListView; +import org.envirocar.app.BaseApplication; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.view.preferences.bluetooth.SelectBluetoothAdapter; -import org.envirocar.core.injection.Injector; import org.envirocar.app.handler.PreferenceConstants; import java.util.ArrayList; @@ -59,7 +59,7 @@ public SelectBluetoothPreference(Context context, AttributeSet attrs) { super(context, attrs); // Inject the required dependencies. - ((Injector) context.getApplicationContext()).injectObjects(this); + BaseApplication.get(context).getBaseApplicationComponent().inject(this); // Set the layout resource. setDialogLayoutResource(R.layout.bluetooth_selection_preference); diff --git a/org.envirocar.app/src/org/envirocar/app/view/preferences/Tempomat.java b/org.envirocar.app/src/org/envirocar/app/view/preferences/Tempomat.java index d16b3994a..7ee7bd56f 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/preferences/Tempomat.java +++ b/org.envirocar.app/src/org/envirocar/app/view/preferences/Tempomat.java @@ -44,6 +44,8 @@ import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.obd.events.SpeedUpdateEvent; import org.envirocar.core.logging.Logger; @@ -163,6 +165,7 @@ public Tempomat(Context context, AttributeSet attrs, int defStyleAttr) { } private void init(Context context) { + BaseApplication.get(context).getBaseApplicationComponent().inject(this); // This FrameLayout view draws something on its own. Therefore, this flag has // to be set to true. diff --git a/org.envirocar.app/src/org/envirocar/app/view/settings/OBDSettingsFragment.java b/org.envirocar.app/src/org/envirocar/app/view/settings/OBDSettingsFragment.java index 72314ce61..d6a95ad9b 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/settings/OBDSettingsFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/settings/OBDSettingsFragment.java @@ -32,12 +32,12 @@ import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplication; import org.envirocar.app.R; import org.envirocar.app.handler.BluetoothHandler; import org.envirocar.app.handler.PreferenceConstants; import org.envirocar.core.events.bluetooth.BluetoothPairingChangedEvent; import org.envirocar.core.events.bluetooth.BluetoothStateChangedEvent; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; import javax.inject.Inject; @@ -70,7 +70,7 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Inject all required dependencies. - ((Injector) getActivity()).injectObjects(this); + BaseApplication.get(getActivity()).getBaseApplicationComponent().inject(this); // Set the preference resource. addPreferencesFromResource(R.xml.preferences_obd); diff --git a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java index 831ed0445..626336df4 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsActivity.java @@ -25,14 +25,12 @@ import android.view.MenuItem; import android.view.View; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; -import org.envirocar.core.injection.BaseInjectorActivity; +import org.envirocar.app.injection.BaseInjectorActivity; -import java.util.Arrays; -import java.util.List; - -import butterknife.ButterKnife; import butterknife.BindView; +import butterknife.ButterKnife; import butterknife.OnClick; /** @@ -58,6 +56,11 @@ public class SettingsActivity extends BaseInjectorActivity { private Fragment mCurrentVisibleFragment; + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -156,9 +159,4 @@ private void showFragment(Fragment fragment) { .commit(); mCurrentVisibleFragment = fragment; } - - @Override - public List getInjectionModules() { - return Arrays.asList(new SettingsModule()); - } } diff --git a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsModule.java b/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsModule.java deleted file mode 100644 index f189cc9b9..000000000 --- a/org.envirocar.app/src/org/envirocar/app/view/settings/SettingsModule.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.envirocar.app.view.settings; - -import org.envirocar.app.BaseApplicationModule; - -import dagger.Module; - -/** - * TODO JavaDoc - * - * @author dewall - */ -@Module( - injects = { - GeneralSettingsFragment.class, - OBDSettingsFragment.class, - OtherSettingsFragment.class - }, - addsTo = BaseApplicationModule.class, - library = true, - complete = false -) -public class SettingsModule { -} diff --git a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java index 95bc43ef9..ab4be0a74 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackDetailsActivity.java @@ -39,15 +39,16 @@ import com.mapbox.mapboxsdk.tileprovider.tilesource.WebSourceTileLayer; import com.mapbox.mapboxsdk.views.MapView; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.app.handler.PreferencesHandler; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.app.view.utils.MapUtils; import org.envirocar.core.entity.Car; import org.envirocar.core.entity.Track; import org.envirocar.core.exception.FuelConsumptionException; import org.envirocar.core.exception.NoMeasurementsException; import org.envirocar.core.exception.UnsupportedFuelTypeException; -import org.envirocar.core.injection.BaseInjectorActivity; import org.envirocar.core.logging.Logger; import org.envirocar.core.trackprocessing.TrackStatisticsProvider; import org.envirocar.core.utils.CarUtils; @@ -56,16 +57,14 @@ import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import java.util.Locale; import java.util.TimeZone; import javax.inject.Inject; -import butterknife.ButterKnife; import butterknife.BindView; +import butterknife.ButterKnife; import rx.schedulers.Schedulers; /** @@ -123,6 +122,11 @@ public static void navigate(Activity activity, View transition, int trackID) { protected TextView mConsumptionText; + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -296,10 +300,4 @@ private void initViewValues(Track track) { e.printStackTrace(); } } - - @Override - public List getInjectionModules() { - return new ArrayList<>(); - } - } diff --git a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java index 812ad81a3..a34657fa5 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java +++ b/org.envirocar.app/src/org/envirocar/app/view/trackdetails/TrackStatisticsActivity.java @@ -32,10 +32,11 @@ import android.view.View; import android.view.ViewGroup; +import org.envirocar.app.BaseApplicationComponent; import org.envirocar.app.R; import org.envirocar.core.entity.Measurement; import org.envirocar.core.entity.Track; -import org.envirocar.core.injection.BaseInjectorActivity; +import org.envirocar.app.injection.BaseInjectorActivity; import org.envirocar.storage.EnviroCarDB; import java.util.ArrayList; @@ -83,6 +84,11 @@ public static void createInstance(Activity activity, int trackID) { private Track mTrack; private PlaceholderFragment mPlaceholderFragment; + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + baseApplicationComponent.inject(this); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java index 0df45ac3a..4f2ff22ce 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/tracklist/AbstractTrackListCardFragment.java @@ -18,13 +18,13 @@ */ package org.envirocar.app.view.tracklist; -import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; +import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -35,6 +35,7 @@ import android.widget.TextView; import org.envirocar.app.R; +import org.envirocar.app.handler.DAOProvider; import org.envirocar.app.handler.TermsOfUseManager; import org.envirocar.app.handler.TrackDAOHandler; import org.envirocar.app.handler.TrackUploadHandler; @@ -44,10 +45,7 @@ import org.envirocar.core.entity.Track; import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.BaseInjectorFragment; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; -import org.envirocar.remote.DAOProvider; import org.envirocar.remote.serializer.TrackSerializer; import org.envirocar.storage.EnviroCarDB; @@ -58,8 +56,8 @@ import javax.inject.Inject; -import butterknife.ButterKnife; import butterknife.BindView; +import butterknife.ButterKnife; import rx.Observable; import rx.Scheduler; import rx.Subscriber; @@ -73,7 +71,7 @@ * @author dewall */ public abstract class AbstractTrackListCardFragment - extends BaseInjectorFragment { + extends Fragment { private static final Logger LOG = Logger.getLogger(AbstractTrackListCardFragment.class); @Inject @@ -122,11 +120,6 @@ public abstract class AbstractTrackListCardFragment DialogUtils.createDefaultDialogBuilder(getContext(), + mFAB.setOnClickListener(v -> DialogUtils.createDefaultDialogBuilder(getActivity(), R.string.track_list_upload_all_tracks_title, R.drawable.ic_cloud_upload_white_24dp, R.string.track_list_upload_all_tracks_content) @@ -248,7 +259,7 @@ public void onStart() { // Create the dialog to show. AndroidSchedulers.mainThread().createWorker().schedule(() -> { - dialog = DialogUtils.createDefaultDialogBuilder(getContext(), + dialog = DialogUtils.createDefaultDialogBuilder(getActivity(), R.string.track_list_upload_track_uploading, R.drawable.ic_cloud_upload_white_24dp, contentView) @@ -331,7 +342,7 @@ public void onStart() { updateProgressView(0); dialog = DialogUtils.createDefaultDialogBuilder( - getContext(), "Uploading Tracks...", + getActivity(), "Uploading Tracks...", R.drawable.ic_cloud_upload_white_24dp, contentView) .cancelable(false) .negativeText(R.string.cancel) @@ -464,7 +475,7 @@ public void onNext(List tracks) { infoView.setVisibility(View.GONE); mRecyclerViewAdapter.notifyDataSetChanged(); - ECAnimationUtils.animateShowView(getContext(), mFAB, + ECAnimationUtils.animateShowView(getActivity(), mFAB, R.anim.translate_slide_in_bottom_fragment); } else if (mTrackList.isEmpty()) { showNoLocalTracksInfo(); diff --git a/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListPagerFragment.java b/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListPagerFragment.java index 8b8e6e7a7..f66374e4d 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListPagerFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListPagerFragment.java @@ -29,8 +29,12 @@ import android.view.View; import android.view.ViewGroup; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.BaseApplicationComponent; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; -import org.envirocar.core.injection.BaseInjectorFragment; +import org.envirocar.app.injection.BaseInjectorFragment; import org.envirocar.core.logging.Logger; import butterknife.ButterKnife; @@ -110,6 +114,12 @@ public void onDestroyView() { trackListPageAdapter.remoteCardFragment.onDestroyView(); } + @Override + protected void injectDependencies(BaseApplicationComponent baseApplicationComponent) { + MainActivityComponent mainActivityComponent = BaseApplication.get(getActivity()).getBaseApplicationComponent().plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); + } + /** * @author dewall */ diff --git a/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListRemoteCardFragment.java b/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListRemoteCardFragment.java index f9727dcdf..c8c8d2024 100644 --- a/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListRemoteCardFragment.java +++ b/org.envirocar.app/src/org/envirocar/app/view/tracklist/TrackListRemoteCardFragment.java @@ -18,12 +18,16 @@ */ package org.envirocar.app.view.tracklist; -import android.app.Activity; import android.os.AsyncTask; +import android.os.Bundle; +import android.support.annotation.Nullable; import android.view.View; import com.squareup.otto.Subscribe; +import org.envirocar.app.BaseApplication; +import org.envirocar.app.MainActivityComponent; +import org.envirocar.app.MainActivityModule; import org.envirocar.app.R; import org.envirocar.app.view.trackdetails.TrackDetailsActivity; import org.envirocar.app.view.utils.ECAnimationUtils; @@ -31,7 +35,6 @@ import org.envirocar.core.events.NewUserSettingsEvent; import org.envirocar.core.exception.NotConnectedException; import org.envirocar.core.exception.UnauthorizedException; -import org.envirocar.core.injection.Injector; import org.envirocar.core.logging.Logger; import java.util.Collections; @@ -56,10 +59,12 @@ public class TrackListRemoteCardFragment extends AbstractTrackListCardFragment< private boolean hasLoadedStored = false; private boolean isSorted = false; + @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - ((Injector) activity).injectObjects(this); + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + MainActivityComponent mainActivityComponent = BaseApplication.get(getActivity()).getBaseApplicationComponent().plus(new MainActivityModule(getActivity())); + mainActivityComponent.inject(this); } @Override @@ -93,7 +98,7 @@ public void onDestroyView() { @Override public TrackListRemoteCardAdapter getRecyclerViewAdapter() { - return new TrackListRemoteCardAdapter(getContext(), mTrackList, + return new TrackListRemoteCardAdapter(getActivity(), mTrackList, new OnTrackInteractionCallback() { /** @@ -165,7 +170,7 @@ private void onDownloadTrackClickedInner(final Track track, AbstractTrackListCar (AbstractTrackListCardAdapter.RemoteTrackCardViewHolder) viewHolder; // Show the downloading text notification. - ECAnimationUtils.animateShowView(getContext(), holder.mDownloadNotification, + ECAnimationUtils.animateShowView(getActivity(), holder.mDownloadNotification, R.anim.fade_in); holder.mProgressCircle.show(); track.setDownloadState(Track.DownloadState.DOWNLOADING); @@ -184,10 +189,10 @@ public void onCompleted() { mRecyclerViewAdapter.bindLocalTrackViewHolder(holder, track); // and hide the download button - ECAnimationUtils.animateHideView(getContext(), R.anim.fade_out, + ECAnimationUtils.animateHideView(getActivity(), R.anim.fade_out, holder.mProgressCircle, holder.mDownloadButton, holder .mDownloadNotification); - ECAnimationUtils.animateShowView(getContext(), holder.mContentView, R + ECAnimationUtils.animateShowView(getActivity(), holder.mContentView, R .anim.fade_in); }); } @@ -306,7 +311,7 @@ public void onError(Throwable e) { } } - ECAnimationUtils.animateHideView(getContext(), mProgressView, + ECAnimationUtils.animateHideView(getActivity(), mProgressView, R.anim.fade_out); } @@ -349,7 +354,7 @@ private void updateView() { isSorted = true; Collections.sort(mTrackList); } - ECAnimationUtils.animateHideView(getContext(), mProgressView, R.anim.fade_out); + ECAnimationUtils.animateHideView(getActivity(), mProgressView, R.anim.fade_out); if (mTrackList.isEmpty()) { showText(R.drawable.img_tracks, diff --git a/org.envirocar.core/build.gradle b/org.envirocar.core/build.gradle index d3b1b36c7..6aebe27f0 100644 --- a/org.envirocar.core/build.gradle +++ b/org.envirocar.core/build.gradle @@ -23,6 +23,7 @@ dependencies { implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler + implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.acra api rootProject.ext.otto diff --git a/org.envirocar.core/src/main/AndroidManifest.xml b/org.envirocar.core/src/main/AndroidManifest.xml index b4bf4c0f0..f07a39c9d 100644 --- a/org.envirocar.core/src/main/AndroidManifest.xml +++ b/org.envirocar.core/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ package="org.envirocar.core" xmlns:android="http://schemas.android.com/apk/res/android"> + diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionModuleProvider.java b/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionModuleProvider.java deleted file mode 100644 index a551eda05..000000000 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionModuleProvider.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (C) 2013 - 2015 the enviroCar community - * - * This file is part of the enviroCar app. - * - * The enviroCar app 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 3 of the License, or - * (at your option) any later version. - * - * The enviroCar app 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 the enviroCar app. If not, see http://www.gnu.org/licenses/. - */ -package org.envirocar.core.injection; - -import java.util.List; - -/** - * @author dewall - */ -public interface InjectionModuleProvider { - /** - * Returns a list of modules to be added to the ObjectGraph. - * - * @return a list of modules - */ - List getInjectionModules(); -} diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/Injector.java b/org.envirocar.core/src/main/java/org/envirocar/core/injection/Injector.java deleted file mode 100644 index 8a387cea5..000000000 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/Injector.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2013 - 2015 the enviroCar community - * - * This file is part of the enviroCar app. - * - * The enviroCar app 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 3 of the License, or - * (at your option) any later version. - * - * The enviroCar app 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 the enviroCar app. If not, see http://www.gnu.org/licenses/. - */ -package org.envirocar.core.injection; - -import dagger.ObjectGraph; - -/** - * @author dewall - */ -public interface Injector { - /** - * Gets the objectgraph of the implemented class. - * - * @return the objectgraph - */ - public ObjectGraph getObjectGraph(); - - /** - * Injects a target object using this object's object graph. - * - * @param instance - * the target object - */ - public void injectObjects(Object instance); -} diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectApplicationScope.java b/org.envirocar.core/src/main/java/org/envirocar/core/util/InjectApplicationScope.java similarity index 96% rename from org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectApplicationScope.java rename to org.envirocar.core/src/main/java/org/envirocar/core/util/InjectApplicationScope.java index ae34e6c8c..df343e901 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectApplicationScope.java +++ b/org.envirocar.core/src/main/java/org/envirocar/core/util/InjectApplicationScope.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.core.injection; +package org.envirocar.core.util; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionActivityScope.java b/org.envirocar.core/src/main/java/org/envirocar/core/util/InjectionActivityScope.java similarity index 96% rename from org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionActivityScope.java rename to org.envirocar.core/src/main/java/org/envirocar/core/util/InjectionActivityScope.java index 69782a634..01a848724 100644 --- a/org.envirocar.core/src/main/java/org/envirocar/core/injection/InjectionActivityScope.java +++ b/org.envirocar.core/src/main/java/org/envirocar/core/util/InjectionActivityScope.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License along * with the enviroCar app. If not, see http://www.gnu.org/licenses/. */ -package org.envirocar.core.injection; +package org.envirocar.core.util; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/org.envirocar.obd/build.gradle b/org.envirocar.obd/build.gradle index 11bcdb265..e1d0061fb 100644 --- a/org.envirocar.obd/build.gradle +++ b/org.envirocar.obd/build.gradle @@ -31,6 +31,7 @@ dependencies { implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler + implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.rxAndroid implementation rootProject.ext.rxJava diff --git a/org.envirocar.remote/build.gradle b/org.envirocar.remote/build.gradle index 6bc63576c..f86acd56c 100644 --- a/org.envirocar.remote/build.gradle +++ b/org.envirocar.remote/build.gradle @@ -29,15 +29,16 @@ dependencies { implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler + implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.rxAndroid implementation rootProject.ext.rxJava // Everything realted to retrofit... - implementation rootProject.ext.retrofit - implementation rootProject.ext.retrofitGson - implementation rootProject.ext.retrofitAdapters - implementation rootProject.ext.retrofitRxJava + api rootProject.ext.retrofit + api rootProject.ext.retrofitGson + api rootProject.ext.retrofitAdapters + api rootProject.ext.retrofitRxJava api project(path : ':org.envirocar.core') } diff --git a/org.envirocar.remote/src/main/java/org/envirocar/remote/CacheModule.java b/org.envirocar.remote/src/main/java/org/envirocar/remote/CacheModule.java deleted file mode 100644 index f28fcc52f..000000000 --- a/org.envirocar.remote/src/main/java/org/envirocar/remote/CacheModule.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (C) 2013 - 2015 the enviroCar community - * - * This file is part of the enviroCar app. - * - * The enviroCar app 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 3 of the License, or - * (at your option) any later version. - * - * The enviroCar app 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 the enviroCar app. If not, see http://www.gnu.org/licenses/. - */ -package org.envirocar.remote; - -import android.content.Context; - -import org.envirocar.core.CacheDirectoryProvider; -import org.envirocar.core.injection.InjectApplicationScope; -import org.envirocar.core.util.Util; -import org.envirocar.remote.dao.CacheAnnouncementsDAO; -import org.envirocar.remote.dao.CacheCarDAO; -import org.envirocar.remote.dao.CacheFuelingDAO; -import org.envirocar.remote.dao.CacheTermsOfUseDAO; -import org.envirocar.remote.dao.CacheTrackDAO; -import org.envirocar.remote.dao.CacheUserDAO; -import org.envirocar.remote.dao.RemoteAnnouncementsDAO; -import org.envirocar.remote.dao.RemoteCarDAO; -import org.envirocar.remote.dao.RemoteFuelingDAO; -import org.envirocar.remote.dao.RemoteTermsOfUseDAO; -import org.envirocar.remote.dao.RemoteTrackDAO; -import org.envirocar.remote.dao.RemoteUserDAO; -import org.envirocar.remote.dao.RemoteUserStatisticsDAO; -import org.envirocar.remote.service.EnviroCarService; - -import java.io.File; - -import javax.inject.Singleton; - -import dagger.Module; -import dagger.Provides; - -/** - * TODO JavaDoc - * - * @author dewall - */ -@Module( - complete = false, - library = true, - injects = { - DAOProvider.class, - CacheUserDAO.class, - CacheCarDAO.class, - CacheFuelingDAO.class, - CacheTermsOfUseDAO.class, - CacheTrackDAO.class, - CacheAnnouncementsDAO.class, - RemoteAnnouncementsDAO.class, - RemoteFuelingDAO.class, - RemoteCarDAO.class, - RemoteTermsOfUseDAO.class, - RemoteTrackDAO.class, - RemoteUserDAO.class, - RemoteUserStatisticsDAO.class, - DAOProvider.class - }, - staticInjections = EnviroCarService.class -) -public class CacheModule { - - /** - * Provides the CacheDirectoryProvider. - * - * @return the provider for cache access. - */ - @Provides - @Singleton - public CacheDirectoryProvider provideCacheDirectoryProvider( - @InjectApplicationScope Context context) { - return new CacheDirectoryProvider() { - @Override - public File getBaseFolder() { - return Util.resolveCacheFolder(context); - } - }; - } - -} diff --git a/org.envirocar.remote/src/main/java/org/envirocar/remote/RemoteModule.java b/org.envirocar.remote/src/main/java/org/envirocar/remote/RemoteModule.java index 107e3f7ea..9338f03ba 100644 --- a/org.envirocar.remote/src/main/java/org/envirocar/remote/RemoteModule.java +++ b/org.envirocar.remote/src/main/java/org/envirocar/remote/RemoteModule.java @@ -36,20 +36,7 @@ import org.envirocar.core.entity.Track; import org.envirocar.core.entity.User; import org.envirocar.core.entity.UserStatistics; -import org.envirocar.core.injection.InjectApplicationScope; -import org.envirocar.remote.dao.CacheAnnouncementsDAO; -import org.envirocar.remote.dao.CacheCarDAO; -import org.envirocar.remote.dao.CacheFuelingDAO; -import org.envirocar.remote.dao.CacheTermsOfUseDAO; -import org.envirocar.remote.dao.CacheTrackDAO; -import org.envirocar.remote.dao.CacheUserDAO; -import org.envirocar.remote.dao.RemoteAnnouncementsDAO; -import org.envirocar.remote.dao.RemoteCarDAO; -import org.envirocar.remote.dao.RemoteFuelingDAO; -import org.envirocar.remote.dao.RemoteTermsOfUseDAO; -import org.envirocar.remote.dao.RemoteTrackDAO; -import org.envirocar.remote.dao.RemoteUserDAO; -import org.envirocar.remote.dao.RemoteUserStatisticsDAO; +import org.envirocar.core.util.InjectApplicationScope; import org.envirocar.remote.serializer.AnnouncementSerializer; import org.envirocar.remote.serializer.CarListDeserializer; import org.envirocar.remote.serializer.CarSerializer; @@ -88,28 +75,7 @@ * * @author dewall */ -@Module( - complete = false, - library = true, - injects = { - DAOProvider.class, - CacheUserDAO.class, - CacheCarDAO.class, - CacheFuelingDAO.class, - CacheTermsOfUseDAO.class, - CacheTrackDAO.class, - CacheAnnouncementsDAO.class, - RemoteAnnouncementsDAO.class, - RemoteFuelingDAO.class, - RemoteCarDAO.class, - RemoteTermsOfUseDAO.class, - RemoteTrackDAO.class, - RemoteUserDAO.class, - RemoteUserStatisticsDAO.class, - DAOProvider.class - }, - staticInjections = EnviroCarService.class -) +@Module public class RemoteModule { public static HttpUrl URL_ENVIROCAR_BASE = HttpUrl.parse(EnviroCarService.BASE_URL); @@ -137,7 +103,7 @@ protected OkHttpClient provideOkHttpClient(AuthenticationInterceptor authInterce JsonContentTypeInterceptor jsonInterceptor) { OkHttpClient client = new OkHttpClient(); client.interceptors().add(authInterceptor); - client.interceptors().add(new JsonContentTypeInterceptor()); + client.interceptors().add(jsonInterceptor); client.setConnectTimeout(300, TimeUnit.SECONDS); // connect timeout client.setReadTimeout(300, TimeUnit.SECONDS); // socket timeout client.setWriteTimeout(300, TimeUnit.SECONDS); // write timeout @@ -146,24 +112,114 @@ protected OkHttpClient provideOkHttpClient(AuthenticationInterceptor authInterce @Provides @Singleton - protected Gson provideGson() { + protected UserSerializer provideUserSerializer(){ + return new UserSerializer(); + } + + @Provides + @Singleton + protected UserStatisticDeserializer provideUserStatisticDeserializer(){ + return new UserStatisticDeserializer(); + } + + @Provides + @Singleton + protected TypeToken> provideCarListTypeToken(){ + return new TypeToken>(){}; + } + + @Provides + @Singleton + protected CarListDeserializer provideCarListDeserializer(){ + return new CarListDeserializer(); + } + + @Provides + @Singleton + protected TrackSerializer provideTrackSerializer(){ + return new TrackSerializer(); + } + + @Provides + @Singleton + protected MeasurementSerializer provideMeasurementSerializer(){ + return new MeasurementSerializer(); + } + + @Provides + @Singleton + protected TypeToken> provideTrackListTypeToken(){ + return new TypeToken>(){}; + } + + @Provides + @Singleton + protected RemoteTrackListDeserializer provideRemoteTrackListDeserializer(){ + return new RemoteTrackListDeserializer(); + } + + @Provides + @Singleton + protected TermsOfUseSerializer provideTermsOfUseSerializer(){ + return new TermsOfUseSerializer(); + } + + @Provides + @Singleton + protected TypeToken> provideTermsOfUseListTypeToken(){ + return new TypeToken>(){}; + } + + @Provides + @Singleton + protected TermsOfUseListSerializer provideTermsOfUseListSerializer(){ + return new TermsOfUseListSerializer(); + } + + @Provides + @Singleton + protected AnnouncementSerializer provideAnnouncementSerializer(){ + return new AnnouncementSerializer(); + } + + @Provides + @Singleton + protected FuelingSerializer provideFuelingSerializer(){ + return new FuelingSerializer(); + } + + @Provides + @Singleton + protected TypeToken> provideFuelingListTypeToken(){ + return new TypeToken>(){}; + } + + @Provides + @Singleton + protected FuelingListSerializer provideFuelingListSerializer(){ + return new FuelingListSerializer(); + } + + @Provides + @Singleton + protected Gson provideGson(UserSerializer userSerializer,UserStatisticDeserializer userStatisticDeserializer,TypeToken> carListTypeToken, + CarListDeserializer carListDeserializer, TrackSerializer trackSerializer, MeasurementSerializer measurementSerializer, + TypeToken> trackListTypeToken, RemoteTrackListDeserializer remoteTrackListDeserializer, TermsOfUseSerializer termsOfUseSerializer, + TypeToken> termsOfUseListTypeToken, TermsOfUseListSerializer termsOfUseListSerializer, AnnouncementSerializer announcementSerializer, + FuelingSerializer fuelingSerializer, TypeToken> fuelingListTypeToken, FuelingListSerializer fuelingListSerializer) { return new GsonBuilder() - .registerTypeAdapter(User.class, new UserSerializer()) - .registerTypeAdapter(UserStatistics.class, new UserStatisticDeserializer()) + .registerTypeAdapter(User.class, userSerializer) + .registerTypeAdapter(UserStatistics.class, userStatisticDeserializer) .registerTypeAdapter(Car.class, new CarSerializer()) - .registerTypeAdapter(new TypeToken>() { - }.getType(), new CarListDeserializer()) - .registerTypeAdapter(Track.class, new TrackSerializer()) - .registerTypeAdapter(Measurement.class, new MeasurementSerializer()) - .registerTypeAdapter(new TypeToken>() { - }.getType(), new RemoteTrackListDeserializer()) - .registerTypeAdapter(TermsOfUse.class, new TermsOfUseSerializer()) - .registerTypeAdapter(new TypeToken>() { - }.getType(), new TermsOfUseListSerializer()) - .registerTypeAdapter(Announcement.class, new AnnouncementSerializer()) - .registerTypeAdapter(Fueling.class, new FuelingSerializer()) - .registerTypeAdapter(new TypeToken>() { - }.getType(), new FuelingListSerializer()) + .registerTypeAdapter(carListTypeToken.getType(), carListDeserializer) + .registerTypeAdapter(Track.class, trackSerializer) + .registerTypeAdapter(Measurement.class, measurementSerializer) + .registerTypeAdapter(trackListTypeToken.getType(), remoteTrackListDeserializer) + .registerTypeAdapter(TermsOfUse.class, termsOfUseSerializer) + .registerTypeAdapter(termsOfUseListTypeToken.getType(), termsOfUseListSerializer) + .registerTypeAdapter(Announcement.class, announcementSerializer) + .registerTypeAdapter(Fueling.class, fuelingSerializer) + .registerTypeAdapter(fuelingListTypeToken.getType(), fuelingListSerializer) .create(); } diff --git a/org.envirocar.remote/src/main/java/org/envirocar/remote/service/EnviroCarService.java b/org.envirocar.remote/src/main/java/org/envirocar/remote/service/EnviroCarService.java index ee057a687..3c6bd6085 100644 --- a/org.envirocar.remote/src/main/java/org/envirocar/remote/service/EnviroCarService.java +++ b/org.envirocar.remote/src/main/java/org/envirocar/remote/service/EnviroCarService.java @@ -19,25 +19,22 @@ package org.envirocar.remote.service; -import javax.inject.Inject; - /** * @author dewall */ public class EnviroCarService { public static final String BASE_URL = "https://envirocar.org/api/stable/"; - @Inject protected static UserService userService; - @Inject + protected static CarService carService; - @Inject + protected static TrackService trackService; - @Inject + protected static TermsOfUseService termsOfUseService; - @Inject + protected static FuelingService fuelingService; - @Inject + protected static AnnouncementsService announcementsService; @Deprecated @@ -69,4 +66,28 @@ public static FuelingService getFuelingService() { public static AnnouncementsService getAnnouncementService() { return announcementsService; } + + public static void setUserService(UserService userService) { + EnviroCarService.userService = userService; + } + + public static void setCarService(CarService carService) { + EnviroCarService.carService = carService; + } + + public static void setTrackService(TrackService trackService) { + EnviroCarService.trackService = trackService; + } + + public static void setTermsOfUseService(TermsOfUseService termsOfUseService) { + EnviroCarService.termsOfUseService = termsOfUseService; + } + + public static void setFuelingService(FuelingService fuelingService) { + EnviroCarService.fuelingService = fuelingService; + } + + public static void setAnnouncementsService(AnnouncementsService announcementsService) { + EnviroCarService.announcementsService = announcementsService; + } } diff --git a/org.envirocar.storage/build.gradle b/org.envirocar.storage/build.gradle index f5f3ade75..06572d199 100644 --- a/org.envirocar.storage/build.gradle +++ b/org.envirocar.storage/build.gradle @@ -21,7 +21,8 @@ dependencies { implementation rootProject.ext.supportV7 implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler - implementation rootProject.ext.sqlBrite + implementation 'org.glassfish:javax.annotation:10.0-b28' + api rootProject.ext.sqlBrite implementation rootProject.ext.rxJava implementation rootProject.ext.rxAndroid diff --git a/org.envirocar.storage/src/main/java/org/envirocar/storage/DatabaseModule.java b/org.envirocar.storage/src/main/java/org/envirocar/storage/DatabaseModule.java index eaaa33e33..b0b2090cb 100644 --- a/org.envirocar.storage/src/main/java/org/envirocar/storage/DatabaseModule.java +++ b/org.envirocar.storage/src/main/java/org/envirocar/storage/DatabaseModule.java @@ -24,7 +24,7 @@ import com.squareup.sqlbrite.BriteDatabase; import com.squareup.sqlbrite.SqlBrite; -import org.envirocar.core.injection.InjectApplicationScope; +import org.envirocar.core.util.InjectApplicationScope; import javax.inject.Singleton; @@ -36,14 +36,7 @@ * * @author dewall */ -@Module( - complete = false, - library = true, - injects = { - EnviroCarDBImpl.class, - EnviroCarDBOpenHelper.class - } -) +@Module public final class DatabaseModule { @Provides diff --git a/org.envirocar.storage/src/main/java/org/envirocar/storage/EnviroCarDBOpenHelper.java b/org.envirocar.storage/src/main/java/org/envirocar/storage/EnviroCarDBOpenHelper.java index 3d046d441..2f3e2bc00 100644 --- a/org.envirocar.storage/src/main/java/org/envirocar/storage/EnviroCarDBOpenHelper.java +++ b/org.envirocar.storage/src/main/java/org/envirocar/storage/EnviroCarDBOpenHelper.java @@ -22,8 +22,8 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import org.envirocar.core.injection.InjectApplicationScope; import org.envirocar.core.logging.Logger; +import org.envirocar.core.util.InjectApplicationScope; import javax.inject.Inject; import javax.inject.Singleton; From dd1bc716367e097550bc867889138a3173b5bc6b Mon Sep 17 00:00:00 2001 From: SaiKrishna Date: Wed, 20 Jun 2018 00:43:07 +0530 Subject: [PATCH 020/389] New design and GPS only recording service were implemented. --- build.gradle | 3 +- .../InterpolationMeasurementProvider.java | 3 +- org.envirocar.app/AndroidManifest.xml | 61 +- org.envirocar.app/build.gradle | 4 + .../res/drawable/dash_board_new.png | Bin 0 -> 1895 bytes .../res/drawable/dash_board_others_new.png | Bin 0 -> 401 bytes org.envirocar.app/res/drawable/img_car.png | Bin 5827 -> 1249 bytes org.envirocar.app/res/drawable/others_bug.png | Bin 0 -> 1485 bytes .../res/drawable/others_close.png | Bin 0 -> 1767 bytes .../res/drawable/others_help.png | Bin 0 -> 1998 bytes .../res/drawable/others_logbook.png | Bin 0 -> 635 bytes .../res/drawable/others_logout.png | Bin 0 -> 891 bytes .../res/drawable/others_rateus.png | Bin 0 -> 879 bytes .../res/drawable/others_settings.png | Bin 0 -> 2260 bytes .../recording_screen_switch_meters.png | Bin 0 -> 799 bytes .../recording_screen_switch_views.png | Bin 0 -> 1545 bytes .../res/drawable/roundedredbutton.xml | 5 + .../res/drawable/roundedwhitebutton.xml | 5 + org.envirocar.app/res/drawable/tick_mark.png | Bin 0 -> 721 bytes .../layout/activity_account_register_card.xml | 28 + .../layout/activity_base_main_bottom_bar.xml | 26 + .../res/layout/activity_login.xml | 188 ---- ...vity_obdplus_gpstrack_recording_screen.xml | 306 ++++++ .../res/layout/fragment_dashboard.xml | 12 +- .../layout/fragment_dashboard_frag_map.xml | 5 +- .../res/layout/fragment_dashboard_view.xml | 722 +++++++++++++ .../layout/fragment_multiple_meters_view.xml | 16 + .../res/layout/fragment_others.xml | 275 +++++ .../res/layout/fragment_speedo_meter_view.xml | 16 + .../res/layout/fragment_tracklist_layout.xml | 50 +- .../res/layout/send_log_layout.xml | 15 +- org.envirocar.app/res/menu/navigation.xml | 22 + org.envirocar.app/res/values/colors_cario.xml | 1 + org.envirocar.app/res/values/dimens.xml | 3 +- org.envirocar.app/res/values/strings.xml | 44 +- .../res/values/strings_dashboard.xml | 5 + org.envirocar.app/res/values/strings_menu.xml | 6 + .../res/values/strings_notification.xml | 12 +- org.envirocar.app/res/values/styles_cario.xml | 2 +- org.envirocar.app/res/xml/preferences_obd.xml | 4 - .../org/envirocar/app/BaseApplication.java | 22 + .../app/BaseApplicationComponent.java | 4 + .../org/envirocar/app/BaseMainActivity.java | 45 +- .../app/BaseMainActivityBottomBar.java | 268 +++++ .../envirocar/app/MainActivityComponent.java | 7 + .../org/envirocar/app/MainActivityModule.java | 18 + .../app/events/GPSSpeedChangeEvent.java | 45 + .../app/events/TrackDetailsProvider.java | 49 +- .../app/handler/LocationHandler.java | 70 +- .../app/handler/PreferenceConstants.java | 10 + .../app/handler/PreferencesHandler.java | 59 ++ .../app/handler/TrackRecordingHandler.java | 41 +- .../services/GPSOnlyConnectionService.java | 431 ++++++++ .../app/services/OBDConnectionService.java | 141 ++- .../app/services/SystemStartupReceiver.java | 2 + .../app/services/SystemStartupService.java | 60 +- .../obd/OBDNotificationActionHolder.java | 8 +- .../app/services/obd/OBDServiceHandler.java | 86 +- .../app/services/obd/OBDServiceState.java | 6 +- .../org/envirocar/app/view/LoginActivity.java | 156 +-- .../envirocar/app/view/OthersFragment.java | 314 ++++++ ...Fragment.java => SendLogFileActivity.java} | 74 +- .../app/view/dashboard/DashBoardFragment.java | 966 ++++++++++++++++++ .../view/dashboard/DashboardMainFragment.java | 10 +- .../dashboard/DashboardTempomatFragment.java | 22 +- .../DashboardTrackDetailsFragment.java | 6 +- .../dashboard/DashboardTrackMapFragment.java | 14 +- .../GPSOnlyTrackRecordingScreen.java | 258 +++++ .../MultipleMetersViewFragment.java | 24 + .../OBDPlusGPSTrackRecordingScreen.java | 304 ++++++ .../SpeedoMeterViewFragment.java | 24 + .../view/settings/OBDSettingsFragment.java | 35 - .../trackdetails/TrackDetailsActivity.java | 12 +- .../tracklist/TrackListPagerFragment.java | 43 +- ...ackRecordingServiceStateChangedEvent.java} | 4 +- 75 files changed, 4818 insertions(+), 659 deletions(-) create mode 100644 org.envirocar.app/res/drawable/dash_board_new.png create mode 100644 org.envirocar.app/res/drawable/dash_board_others_new.png create mode 100644 org.envirocar.app/res/drawable/others_bug.png create mode 100644 org.envirocar.app/res/drawable/others_close.png create mode 100644 org.envirocar.app/res/drawable/others_help.png create mode 100644 org.envirocar.app/res/drawable/others_logbook.png create mode 100644 org.envirocar.app/res/drawable/others_logout.png create mode 100644 org.envirocar.app/res/drawable/others_rateus.png create mode 100644 org.envirocar.app/res/drawable/others_settings.png create mode 100644 org.envirocar.app/res/drawable/recording_screen_switch_meters.png create mode 100644 org.envirocar.app/res/drawable/recording_screen_switch_views.png create mode 100644 org.envirocar.app/res/drawable/roundedredbutton.xml create mode 100644 org.envirocar.app/res/drawable/roundedwhitebutton.xml create mode 100644 org.envirocar.app/res/drawable/tick_mark.png create mode 100644 org.envirocar.app/res/layout/activity_base_main_bottom_bar.xml create mode 100644 org.envirocar.app/res/layout/activity_obdplus_gpstrack_recording_screen.xml create mode 100644 org.envirocar.app/res/layout/fragment_dashboard_view.xml create mode 100644 org.envirocar.app/res/layout/fragment_multiple_meters_view.xml create mode 100644 org.envirocar.app/res/layout/fragment_others.xml create mode 100644 org.envirocar.app/res/layout/fragment_speedo_meter_view.xml create mode 100644 org.envirocar.app/res/menu/navigation.xml create mode 100644 org.envirocar.app/src/org/envirocar/app/BaseMainActivityBottomBar.java create mode 100644 org.envirocar.app/src/org/envirocar/app/events/GPSSpeedChangeEvent.java create mode 100644 org.envirocar.app/src/org/envirocar/app/services/GPSOnlyConnectionService.java create mode 100644 org.envirocar.app/src/org/envirocar/app/view/OthersFragment.java rename org.envirocar.app/src/org/envirocar/app/view/{SendLogFileFragment.java => SendLogFileActivity.java} (79%) create mode 100644 org.envirocar.app/src/org/envirocar/app/view/dashboard/DashBoardFragment.java create mode 100644 org.envirocar.app/src/org/envirocar/app/view/recordingscreen/GPSOnlyTrackRecordingScreen.java create mode 100644 org.envirocar.app/src/org/envirocar/app/view/recordingscreen/MultipleMetersViewFragment.java create mode 100644 org.envirocar.app/src/org/envirocar/app/view/recordingscreen/OBDPlusGPSTrackRecordingScreen.java create mode 100644 org.envirocar.app/src/org/envirocar/app/view/recordingscreen/SpeedoMeterViewFragment.java rename org.envirocar.obd/src/main/java/org/envirocar/obd/events/{BluetoothServiceStateChangedEvent.java => TrackRecordingServiceStateChangedEvent.java} (90%) diff --git a/build.gradle b/build.gradle index 0e4b2c8b0..16f8b67ed 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.1.3' classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1" } } @@ -84,5 +84,6 @@ ext { helloCharts = 'com.github.lecho:hellocharts-library:1.5.8@aar' fabProgressCircle = 'com.github.jorgecastilloprz:fabprogresscircle:1.01' mapbox = 'com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4@aar' + segmentedUIController = 'info.hoang8f:android-segmented:1.0.6' } diff --git a/org.envirocar.algorithm/src/main/java/org/envirocar/algorithm/InterpolationMeasurementProvider.java b/org.envirocar.algorithm/src/main/java/org/envirocar/algorithm/InterpolationMeasurementProvider.java index 6581692d7..82b005cbc 100644 --- a/org.envirocar.algorithm/src/main/java/org/envirocar/algorithm/InterpolationMeasurementProvider.java +++ b/org.envirocar.algorithm/src/main/java/org/envirocar/algorithm/InterpolationMeasurementProvider.java @@ -56,8 +56,7 @@ public void call(Subscriber subscriber) { Measurement m = createMeasurement(); - if (m != null && m.getLatitude() != null && m.getLongitude() != null - && m.hasProperty(Measurement.PropertyKey.SPEED)) { + if (m != null && m.getLatitude() != null && m.getLongitude() != null) { subscriber.onNext(m); } } diff --git a/org.envirocar.app/AndroidManifest.xml b/org.envirocar.app/AndroidManifest.xml index d00070faa..21eec4838 100644 --- a/org.envirocar.app/AndroidManifest.xml +++ b/org.envirocar.app/AndroidManifest.xml @@ -1,6 +1,5 @@ - + android:targetSdkVersion="27" /> + + - - - - - - - - + android:theme="@style/Theme.Cario" /> + @@ -81,7 +77,7 @@ android:screenOrientation="portrait" /> + - + - @@ -104,6 +102,23 @@ + + + + + + + + + - + \ No newline at end of file diff --git a/org.envirocar.app/build.gradle b/org.envirocar.app/build.gradle index 37d49c22f..0e30359d3 100644 --- a/org.envirocar.app/build.gradle +++ b/org.envirocar.app/build.gradle @@ -8,6 +8,9 @@ dependencies { implementation rootProject.ext.supportCardview implementation rootProject.ext.supportRecyclerview implementation rootProject.ext.dagger + implementation 'com.android.support:design:27.0.2' + implementation 'com.android.support:support-v4:27.0.2' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' annotationProcessor rootProject.ext.daggerCompiler implementation 'org.glassfish:javax.annotation:10.0-b28' implementation rootProject.ext.otto @@ -16,6 +19,7 @@ dependencies { implementation rootProject.ext.acra implementation rootProject.ext.helloCharts implementation rootProject.ext.fabProgressCircle + implementation rootProject.ext.segmentedUIController implementation rootProject.ext.gson //implementation rootProject.ext.guava implementation(materialDialogs) { diff --git a/org.envirocar.app/res/drawable/dash_board_new.png b/org.envirocar.app/res/drawable/dash_board_new.png new file mode 100644 index 0000000000000000000000000000000000000000..8499494a10ed1cf65cd82d9f47c7a2afcbb09956 GIT binary patch literal 1895 zcmV-t2blPYP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D2K-4xK~#8N?VMG} zd_@?CKf41lK?Uo^#zOQ)MNm;J#Jn>Q8x_O`vA}K=EEK#j&n|$zSK?|2)Ru9+o_pYj%>9QE150a&LL1d`12h!9OKsT_N|9)KTzQQ0^#i zmETFL6JtspH%scI?wMstd8~X-S{;?ccjYmXw#*C+0jJ7OrPV2ukhYvGr+#?aSAHn1 zPUwRl$bID0v95ejT0!^G2jtpvDmX~y_;QWyx01FG7QWbSkXCSQ{9ZmTFOY}JUFAkH zd>)VSH=e_DpO9P|KCi9U$tC2VVDa<3v;u14>+(FgrCeBAgx6SbEoD#^Wro)@^*K41 z1s!AOTha=o%AX{km`!C9!t0wr+0;Q@;q`SA(^|6EY$!jLRsdD9mC*Jb7M9Tl>Y~oD zj5I$!KD${6U?G-D@Hp9-_^3mWi-d$}LLjJYb6zZTZ z|61BYoBYSBBvxYX1$oKWCKJ%89~4#cEh6LGLa@7MJYfyXUcO%zQo- zlx6ujaXz@6*<|wT1|$q`L)Tv|LrZCOETqtmc+upBx@}oM?tK08+O*-*Vr%)T9r82 zPahHtGpy#HlztrHkW7Ge&|@};fr_ zR@u&RK3V^RfULru=gQR3`LS|K#~pGkNcghqa9%At!)-xU;m)?{B;!yw3v23|vT5R1 z6AqPDJx<;-$bUUv9QXolfLWB zZ_+Bf&RBGL0k}36R{3?(cb)l0T7}mci!MVDJF&5_%CD2Y>x{K;;+uN6v&)z8#WE#z zU&3UMbmm2A74Ff+M6= zw=+t{9D!JcJ97lub}NGC=E%lih_mWfVr26CJeKkAawojkJ4S6#s9b*URXvA?tQVrzJU;w$f%R zmL}&T$!3Mzcwtpo*&q|DCVOWD^ozS*udZX}CdywiCmsPlF{p2T37q+p5_2 zPB~4tC=m-WS+V+lB9s4oK~<(4IXBE0vfM408SZ-Fi@EBAF56_o`V`zNd-pRg30PfP zTlDYCYkp-?Ck3WY+UP$(1%g+ifF hC=?2XLPF-|{st%en%t+-u1Wv^002ovPDHLkV1hbopaK8@ literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/dash_board_others_new.png b/org.envirocar.app/res/drawable/dash_board_others_new.png new file mode 100644 index 0000000000000000000000000000000000000000..4385197b3be28d3cb8d381078626f455c9b29b15 GIT binary patch literal 401 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4Qie)jv*CsZ*N3<9S#s^cxd-BZck3=p37T1 z);Znn__5*z&zFxXDVKs${@DFkXfnleikjt1kcCL#$8^2LuV2{yy7P5g^?N0&E$=>y zS@+56j*pHHoIS^UuZ)cG)=@U_3(mf!Xm zO<(Y`uZZ)M`T?MtwL3k55^2&_?=o&*_#)9OW_UdpWOnM$8*}^bFK+Fr>iYIKd%@>D zp+yP*1Wn6#Jd>CJVhKpj)78&qol`;+07bj45C8xG literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/img_car.png b/org.envirocar.app/res/drawable/img_car.png index d72d6557cadf37b9af84dda302595429e06ca020..09071b34f7188583514541377dc3bda524ae3ef0 100644 GIT binary patch literal 1249 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucHD#VIjv*CsZ|~Z6hlYzB`)HV-lqjWqboI)QlCl19H0SNKpbc&JXimy*%kH1O2b$pqx#zjTj z$7igT_y3(@wyTbY^pY;n}~ue%Oz%F0!!`)_h4 zF)jPT=Bj@j-#O3j^UHp<-Brgp_3vc^^O@R8Z#vuU`up&9Z%Gs4u>KdP=B&WSNk5^37D^)X&SG?Kkpnp7(a)nyRkk zeCPh4O>^clf`rRwC@=o4Um|(*_Ia&TtI3z1zTwfBsc(Ak5D#zFH}=%U3w^9Rt|z2B z-u$!TW&W4>Y33lI>?uFzi|D6AL}P!Ym;B$UcR#>P>r|Q5(la+B1B~Rec1*p;TUFM$ z>0;nE`OcdO=}t54O@Ghb2Q-vBb@AegZ)RW0y=HATUU+8yEZYV7Zr|s>`ed5AcuCLl zpj&h1a;omTk{z9ObBW@)V6&)GJLc}VoU`~$KbwW)W;WZ~t~WC@m+j^C{kuBcTKd$V z6(?f-f$>BIb!^+idX*WU}vJ)F1w(_MROrTr&!|Jd{1E9HNQWS+QYFTCp3>73WT zP(!3H{cHT}cd9$&^X99Y)|vy=?UesjGmWiw<<=w9*bec$;@-IKS!%cZuQN*;?`Oqc zJl!9EEBmInarhRt@ALIG%*-*{`)5(5C83b<*LVO7NOd9t^4g6s-J~tY%^z@XL1WMVQu{=&+NDKrWt$%E8}(P;Ek`1jZ^PQC|J(P#vp={Xcya5{p=wRr Wi90JE8Gi&8OAMZ_elF{r5}E+XN?_pt literal 5827 zcmbW52T)UMw}yj)QUnAJpkTxU0wMvdAl-`6dr0VrfD(Gg5F!H7;T&nwf;1@!A#@B< z6e-d?AcWpQI-v!m-;Zsc#IN9!>wGaoYq0%28s z@=y-~p@SVCjHf`v7ZdFXzD_+=fBX<~bo_Z=lN$>nOfFB5?hpu%@bN*Xs&{!61W$XY zYCbwW#=^mVMYyp2jukkkqx$fkfzROb2-d-ncF?@GT@!c6GiZA^qA@&Mr~U@w1-D7~ z37+Z7MU^)XuC1N6PJ!ve^5Qs4CxY^HAKd)2T}~$V74w-tLmwcFq)DYZ^tz~wvN*bm zU}H7Z(B97BTBD7VC2V=tU1@fBR>)UWL}c52C1k^wb|AYw?2b_rql3t--eiCL6Oa=u$5DEoe?`IRe?&nt#CI)eGoLBOzisYBka&vQg_Om@HsJ{}Yn3LDmQ*7PblldsZ zz{jVG?31Y*mk=HkW5mF~un-|tYq^YhaGfbJkJsGi9&MpFBKV=KUf?NKJ(CItUBaUi zi~OkG0z=rj)`FKa@kWfqqbuopSLZ4l<-L}4WMySd1zyDq3JOlw2b_GHntEZgkNo~sIrn7L;U@!~sv(@p>ZnJ6Lr!d|eWl;E|N5N`ZTDG_A&7g0_q&hk}YDuJPas0n(e7O=sw4i2`zsKKUXd+--X(Z=tHFJ1X+X%jDUvB%`)r^fNli`701oG|lUBfI zWLW8FXlMur%(w;Iz58-=?sJDNaN6gLZo7`H1&hSpo+wv1SRga)j<~y?7k1^E?X~#_om0Es}U(i25Yv z&?n~RxLGnx+Y?b(Sm?I4vj|b>xA9#ta=++1&GES5s+gGS?$)w+Mn=Y$Sku6i@3XN| zb^Cf+X>!8NF#_I8cPgC6h$7m!rKG>s4MJu%b|Pz&f`aIg#ZQCV)8vf=g@lkfRfMJ{ z72o-s#LLRc78;}NsW_bE-qx}Z$zfv@P0e4MYUbxJDl0SS?(Rl}&6U;d&q&>HoqSjk zY*c@fcO+5D!s%J+(vpL&8V9`UDVK=G*_^mD=Wl#%@rhB~dS_Rmi<>8DIGoPaND_3e zq49{bjo41N{OLAcPe&$LE|73OlT6E2@$cR}L1YXqkJVXd?7#ndTEK5Stn(`u6#o2q zo;?cndDu)S)>#asU@akR!}*QCul^Wc}=n*gJWh^)(mgm zuVBjcPbKm$n2`9C6#S^q6f0T03VVHbQ~GXjaBzvs#C;=gB#}z;2DHXq3i-3Po=6cc9~hR=EJ?HXj5 zlo!ITGgWMPsIrJsEmP?@BvLuz#gAufav1%DwCzaFLHFGanYrtoa{zb$!u+8lRaSrR z9KVc{$Fe6|-zmz*cjY1)ZMHqBVIe@s_B*bSMq^=S?&nP2oK-$TcD%d(VDVfC8}zMJ z!<*ulmcyR|PuqMAjm0eR*XI7zz`2F7QXd6c+Ce3Ms?kCDkdf=K|w(z`|)=XF?$rbrj?Ou zVR`u>!}N1xNs@=MiioiABcDbL?=HYYD1P(ug4eUlD}fUg^aV z9Zp+yIo(HxG$!a|sm6-rdyo1)UOeZ=eL7+JN?GmULNDHCZL*O#Ut-FQAXf(7v~B;R zBSofE%`)o6j}I>}w={qcnO3=cz8x@=EHP2~U8&9M?7hd^vIE`Sf{&vwxN7!ICbQwa zsiOtO#eXhe>gVw)6*ycCDe*seY2<+<&XKN)i`_IIoSJd@BDMx8lC}Yi&x;!U8J*h4TuF zii)Rs?}fV*Ls#DKP3~!9clD8_wo$!i3B6FbzJBZ+8=i?vgv2?{EHma;O6ik=!OHyE z2yBG?eZS?xm=)*7lTHIX;h_#g6&(x9Z+cDcgWU|Uy>^`FJ9fHJ>=6c48B76YQoBdo zx{R!H`CS}BEV2B2qOi!q*x26Na%j-%nXPSsB6{mNbn0suS9cv23#T*9`tU*J)R}Yd zJtMir;ZN?}3y3#MC=bX%%b(-t7pKu^1W1*ZhDKznytmfkxr)Qz-o=}Ii5EAr*VdKV zcaV7<8|GeFR@T$1)zr!+e);l4PY;i|LzXW|?0wysHB4)q*g6mdvd;$DXBD5Ah+@a{ zJAeA~=0#!x4o9TXfFx{Z_9{R+9R(#aZkvBT&=`&_x9#9ttoWVc$nl-Ox69?5VP0mwo@m#v! zde~)AQTK`lTJ!~3!3QC1y>dPRIhLVFxR-8=ZWu(u39COjQx#|~c z4(@@3dmvJz9lLRt^YimlM^-P?jY&0xu=mL|{VDW#`b#j215=%zj?R0`nU$K?MoD)n zkDak`>+70?75KN!rGePxOMk@&Fa4;qE}fXHo`S-`o7lSit)pWm@=flD|K9RobAJuG zatcd>Qb`)74pQRcvEbHj@P<;QU*jiL)zyE~$?T1oRfg%3F!6Nl}h|N=ZpTm9Mu*k@1hc~ln z%2;#YmF3Z{YeRz3p2%oVgtqcQ*%pcKj>{#h;P)Kd+`_7=s=#U-9pht^c3X-in~Upj zti_+W7#L}3J-KKnA~}O77bfK8>4@Oo)i-+43rSh{d1p7==-Sc1DJ0$Gy(cCr`grf$ zqeqXTJx)e@AVef9czJo%k1Ma#Yb{sT;%9btD5%i&>$(Mae3Un`NuHp*Kf$iT`IdB_ z#3%1X*t%|SZ=X#huE^lnVO+dRD|JWyoyPR#fCgpi3M@LHXp0S*Z>L{Z1&w-u8cCL zm+7`DudGx@B9o3ww8jaAV@4@)ol;TN)V%%Ug;-8m&qPB=Z_V~79sokd!=TJ7F-GZ1 zn4az&bwe|=5e(TaXUM{3d9eH{3>JyK8_qll2t&`L(#eo=isFpjGdaw-625C392Au2 zI8@)P_D2GsXR#qUZ;wyDE4UM?K)9h^FVPW}8t&1M>`d{Q%svfWkD5a84 ztVV$caame=tCV>7u94dl!JA&)AQM67VSNAo>mCZlyel_6ZH44T9W7)OhZrqPe~X>m z*fB6PG|Y9+)(|tLAYo!qNlyVd)fuGsTTaaub*zZ&AwW51M?iN24kxc==HxW;^6+>K z934dk*i3$V4_V~~vVcONi8V75CFz{ee7D0%CoByvo&95Yc(~2(d(Ku^QSI(kw0(Hy z1$+&9yTBR48c}!&l54i`;=@s?aH=v^$%>)gHF0-zqEC(h@Q+uZ>NJGniL_WG0fK#i zpd&S%WLJ1EIb`L!%>1guj8Z300B*$zhY(7gM&xM9Q22M8q9GbBUwX3s>e0?VtSW8tD2}bE^cG?dqn7y(9jl8d#T|k1wfufUXay$`}XZ+5fPPr|GHZMeYno}S**gS{&-m;t-u z<{#Q|dN(ZVA>vdoRu&fhxl(hU!C(^wm4`bHmgVcCeu5Xa zFp1HIQ$R-a)Covg4}BKCd^xY~=zv;)H#RZpW%pk_srB^gm4%gRDtyGMIT~uAcxt3T zPc7_%g3n(CfiI_`WDLCJL48~3D-saBJ@buE+Tk5D{fUuUCkoLF)w`$gax?EOuZ3S% zc;NY4&;RINK6VNETm?e_M1y^rpa5`FY2|(9`iJZ5Zp~789XLgkt5>g<#gw|us11B{ z7d3i1!IbX5n-4Rs(%HMi%F6mSDQW)Ko`kqKSCX`2a#p_Ycg5{1KOBZm=^NMqu>Smu z{O#K}*G~T zT-^Es=+&A|hjl;K-0Pt+Mn}9_;G+-M?;Z4deRsX=dsj*Vin9 zq|t2E*k=G+qXnA3#fs)&j}DufqoSjEjuI{WU-*qT3t)%CNxKVQgvU=w2gSD>VJn?K zzh-D^c6{-I!!@(Kw8PAMq|qy|giIkItw+eN&n4U0s=StsZG?CjY}^N)H->YMvcpU? z)8yiV?;(-ma01C|#7B;_QZ>bf5eSTMq4{rvQxe(hwG|8_P5?xW&eF2I3r5Khu@HbYAeGlFFdsQd0bJU;A2~r?23HjnTwN4B>@T(^aK4WPv{l24IL&^s z%zx6+r&e(_9oQ2=xv8Y&29<#_cDN-2t}VhIh=ctPl%o=9%{~D4sSF9BPXGt?avl9l zaW1)U84noH1mg!96`A8F0+Oxd;)>eDCF zT0rzKz16P>-oPIEEsFThcBTb!6AXc7XE2d~R&&>`M|mRz1py6l^7ErQzCKn_A^#Ln zq|c3vJTp-3U39y71L#E!F!q`&bf-|_hvT%2@6RMVMsb8Qs3*tj?^w&u$&r<=5aQ)b zf4LymEOoA;tjt9>adKxR&Ex1`TYl>hI>70lQ&OULitWN2LT`I%;Kv-VOaPG&=+VHy z;EuHaKSfbqx;9I>&TquCPZbclkacc$_F1?~+IOWr4bVBRwDgykmq)*ep9&BbsONN53(BtS^ zCAMBm{Z>ErDrN;Nzr7V66v0qOYf`7T0b^+|l z7K>^3Ee(`bdv<)<=#;OhHIhG~J7&uYr;(S9T;_&`Id1OmvPt>x3w$?z=IiHbnXQqL zb^bNLNlSMW2ajT|x&PFlf#x1RI5^m*<$*%sUv7_h_kv+WB=+~%Ob7gE4H^&nKOInR z(FKKt%O#5+0KbCPBVSDaL)9ck_N4&a=;5PBVPn+94T)vD zPXhoX`mqyPVUT<0$QpG2k68?u+x#=Y`A=h=|2e?jJVJvAysDcx--`$~>q zDxZs=Yl+t!2_ln+$M3P0f=mAGxaj{lWBL?i;a^MdzjIy-1t4y9)rGuZ#59b_GD6xtQbj6)oSr*QO-=$lj6UuNjmgkk6sxdM zg`MeGxb`pcqEBC1U&XI)YycbaT%;tiIO{_bISV|_i_qR!vLh%~r4{{w?WA}gS=*}1v=X7VbP zK^5hd58j*spdNh|Zi(tw<>27x9v*h^TfW1IP!n6*JBZfu1H~2en`hyd%7_lE@+DsT zY?@U<^BRcHEC3?1W{I(5r(Bol{K3-9xOKqG=bP661-LUVuB7w5&Cs{4DC*53h^ev)j`m3sjsi~_kCVa!) zw2Lk%DoSrr)ns^p*`3e5Dk_?5Lg}n>oigzC{pg9ED@@x5bOt<$0H}Gc=b?6rv}VoD z&lC>>1D!r9_6U93>PwJTVH$w|D+gSL?~4|yylol=W=*mlbAJ@%<^2JEzHo9%Ft2&3 z>fk^)1C=w-)7Sqf&0u;TG)!@ciFj?Lorj$`MR5ziwcv-3AFCIc*Ze&`JfQXM4X>kg xiA*raxHl8sKeG6@s`>9B>wnVdVe=84u5GLME2l3|Fm8sZKGJ$fyl?sXzW~XNFVX-2 diff --git a/org.envirocar.app/res/drawable/others_bug.png b/org.envirocar.app/res/drawable/others_bug.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f7d8f9eeafbf8f907e4ebf592961df2a54f75b GIT binary patch literal 1485 zcmbtU`!^E`9G`cd?IsgVM)ef8d_;{eC~6&-a|~_xt(jo9W_oL0Lgl0RR9fBQM&x ziqU^B_sNRu`vM$H3=&w^3kX0x3%n#2(m`-XH~`R?t+*W^Bi8bf7rn6nfJ)C^O7ut2 zuL1xv7^Dr{J=X7IY49S{4cxzbOJ2_*AE-T0RDHjx6{t6GIP*kVYXjv}s|(_}dXuiU z&a}2|{($b`)Y+LnUT7)=f|R zv3);6@Je=bUs==olSCM>y#M3KKWf|A2CFlum2SsI2UgdN%T|))XpcXoauxE}DLGzi zqu2W#_-H3PVbH-CfRZZ@XiJ{o4|AYAgS3;vXOd>MTex)1SOv5M*$0Ju$*;R(Pf6r+y?8j@NbM)cBF$_=RC{L%0RcnYD~2j1rDs$(aq>BOMr^G#q#uT0AS- zG-Tclbn56@b_v$c?TLC6vs+3euWCdS&N%a&AA8Po8qWCL!zM8rbrMsUL{?w$S!&u# z$wPSi%S6?+1n#e`MNEuolPU%6sF6)?n%;82D6@NE%6A zc_+0znH9dJecK?bLMXbntvaN6rKp%a(W7ZUQotxe+%iEei>snF7jRJ!Dj5dv#N|cIkIWeB4g$d8G_Hur97vZG8ucgNpqj?^-_fngx=4sZ94)j+Qy0GctieVREG z9U%5f$j0R9XbAA(p5*E%jm6jEQG@1^aS0e~$?bkJQIVgA z%hakBD1~ao1y(H~9rzemVY4-7fmaI4&hXQTC1HOMHy(S71mt zx)@a4?yDkc7|B22<+*=BC zA|IpQ(fc{F$gKS&O&~qGK~t>^!R62uBfh+5f1F%j-u^_FLyI_W6g|5ajCdL6{+j)c zq6}Wprc&bc7>}MuooFGc`-B9d(;}z}$81q9abuzBf&iGJd9Y8r-4^$Lb=O9&UP^+Y zYR8PQBhQ7lj2mDYokCeK5B>M*zLQhg6v{4Ol~3wwHw~BPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D27F0GK~#8N?VVZ3 zZc`Y?KlAJ$WF9()GKb7lTySB?>6{Gb+@cPdk{cJ26iSjY5t&2Wm<}PipiE^}2nop; znaBS>J@vHx-?P?!-~H_AtY7`=>-hG1p0&UC-NRbXTILFcLZMJ76bgkxVF3J-un>$o z>E1#x>ZE%M!Kjn&Ed--Zy0;LFI_cg*FzTdx3&E(9?k!}pH@x7#A8Vmby0;ETz^5Q{ zS!vh|-U0uDf54q#9n?wp*5PT$WB!J>!A;<(ISGCV{Rz7V*1;dE%;gYRJ(jsGf}>+? zcr&banDU#j3(Q5e;mzdl*_d>H1Sj`gNsUcBk5W0hY+9y2KTY5oqX z4o&h|xH?Rsj`gP40j}u!uVi0xzoDJ84a~Xhn4iO?a21$?YQvk$vG9GU+EB7j+rnP6 z0el0h4k-BuIuF)Cwd1YBTJTn=+EKm<*M+_10jLtM`X{^)PJ?RCI}NA9U!iKR>V2@6 zoB>tBRlkSFz-du!dZ*<8n0wzk4fcv1;g3)y>-`BH4rf8N>zxJu5%>X7?RtNJyqWig zJ&b=zXw%v z-dkW(sP?^0aRXHCd*6Yp!p`9HyGqQ#%-`XB*fc7Z zw`sPAsh70YU(Pm!siba%5vW++2(E=HmdVG~^pxL3 zy^)*`RZR0i7|u&j1vmMI9EpnQjpS&kVwx|)aCo;@!OiGGR~6G6$-Yp#M>wfV zP~AG8A+ZrueKuKD5zZ%21vh(NJvIZ|LDgrI=O&!Dp$cyDNnxz)4^^K{R?da%i1}@S$*Q@Z_q#n!mu-7WO>{RT3ue6JvubCskj~XJBhw3{?{5SCC)X zvB18h*1KHgRTojrD@;D{kB161Nw--UhH42d}~7nNgG_O16L zz006VUdb0ZPVjVbUtr90ARi@FZc6rT5Tq)ot8(>8o9_w-!dIcnWs9HK1C*gRw0Iq1hng5N;gie50LjECh9}226XO8%e0`4lp-3L`i>&meu4sEaq ziuL%EKl9&GV>h`n*UooBX&RRGy#Q5*`{eVGo6U|AULv?-dd}`zZOfc^xg29j&Hv!m zmbn}JMayeF_q`bWHpSDxLSF8en_6=aA!BmE;Y#)Y4wwY@Vqo1(ovn_il`*)H2xAs1 za3fXj-_OevYm3wgoJO|A%MAB|V~j!u9IM$2^2T^OPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D2V+S@K~#8N?VU%6 zbVU?}e{)`#BgT~rF)J<=BZ4ax44^C1N-%;8b55Y3;zCdqMGT0FaitqkjG!Xs0AkL9 zU^*XISPZAT-ps42uI|4Md@#)Pt9z?@rr&+{-l|#E)z#J2)z#J2)z#J2m^KrKinGM6 z;#u*g_)vT&{`e2R=6n2%*YH}d;abM%8mRTeQQ`*is`yL%GZMyNEXHJPY;-NrLE;X< zZ?ap&oM7X2fz8!g>xfgu+rlkW4X}+5__Eq)U2&%PShz)*1^9wb__okGM7%59BD4U$ z;p4(-8*#62lWq}w#pi|4;o@uICfYLijPG-+wZ&y(Y$*ASct~6-P7wQuUBsq>ng71vAmY6GTEO;PtlN!Ps;ykgZSVOE-YYN6-tha=-HH4=HbD9fn zDP9(CBGdR)+#>c6rNr3S_)Rz;roo(;ThrQEyeHfQCh?=VQq-K>R^lr0i*P|4;e2&4*NsFIB0_jx zI7b~%h|NW7!Y6!lK0BCm6VcHX!a3-;Sd58kN(^jQAL#WhNP4q7ddaZdkgY1PYUY4-;2KmPtaeA7X?qbM~j>V7UqCW zH^&&(q)I(u$e$%~ey&iHn;bP=XJ-<;A?Ju(3$lgyOgLLHXNaOA!#SjqmE$3c82d)S zZ@IHE1m3uvL=N$b;B3UOHmp%GQ9pHtV{+Y)ZWC_&6T%b|CK8$Uo~G)Z?0cTM0Pkwd)M zZu}V5ESs(u&PafpTrQ>lyr(6HVV}M8~muPuOMP97kXtB}34IX${v?4N+&c^`#MmhC}aCQQ$-Dssk zE;`m)Q7Tv>KkygaQ?)Q zxFc^$!~7C(YWbfrp_p z6*Y9AaP|XP!q8`g8$58LsHr=J^CR$qsC67cl?SobQW38R=SSddQA?@L@GMor){=3l z(&+A@mL3((hd`EO+>mrMF?lVe!s6WNhDoZHj;>vhnHNh7@_ezn=|bVwB9N^l ziBfs?+=Y&LP}QP*&9;PHp)PxYe; z(4rsKalB~yunt7DlS)+s6Pc&uYAB=(S$yVRGU6Mg5@#&QHdZZcZ>=tZTu zb!-R=jKNrpd8DYdduAa-d{2)(`FWmT$yU+`Jn7%r@-tq;Yq^GNv$cqKb#--hb#--h gb#--(*Q!h($07*qoM6N<$f{rrBfdBvi literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/others_logbook.png b/org.envirocar.app/res/drawable/others_logbook.png new file mode 100644 index 0000000000000000000000000000000000000000..09d6fc5eb1762c2efac5d00142d08cf83f7fc421 GIT binary patch literal 635 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qt-3`_!^E{-7;ac}P$W{DPxxP1)I6n?!RyW@6; z@10iH0@Em!9TOsUbqcVCCvuc&RW0Y>DUz62dHARCecKPO?ceR$v*eV_u63^=sPDq* zPwQ&*?w@`?S9;mp*GnUt(=d*S&rB;&z7-iz%{kA+^$ow{ZHT+6-RTicdi*sX1% z(|XT&VWQ@jj1VDPsi`jgZmJg-2YO;~uSk_`$?TNtjXKS^I}wHrjV5R>#$eSk*Ks?$R^SJ18)BT7E0rySoN+r_XP7dv`NnuVyBH;*Pkf zznzl5XPj7epYw9Jt?)l9sa@hvH{F?{pW6Rk1{!<2*8T41YqvMw#BuwJggQGg!7zBb L`njxgN@xNA61^G~ literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/others_logout.png b/org.envirocar.app/res/drawable/others_logout.png new file mode 100644 index 0000000000000000000000000000000000000000..a87d926df600a81661f7ca8f152ee1143349ad7a GIT binary patch literal 891 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qt-49o(aE{-7;ac}4P=1q1KaM|3*>dwe_wDrgN zdDR8H7Mx9@3Nzv&w6@L@I{ItPt9k3^f4R0!>UQe!$TN2hcn(7lCaD}KfRyS_2$9*)RLNQI<7MRuB*1*yZAzC?&*U4OBPuF&WvmdKW*>L zwR7{uok!B0YAgZ|82`x2RNtokFpRP~Z)e1Cv7xVh*A8*&6tP}CN+bVuq|8&vcq6KgA zo_KCr-0mBu9(VQQt2!<#&$3UA>8ph$9~(Rln13jB(wisD=fj>)GEP%{wp6z2MoMYX zy==9UUV0PO@}=%eo0Jp4xYcTkWsb3@NE}ck?6kj7YuIY%nVXlYcQUQMy6{ZOP0vLe zvPv~RJ5QUf!nHE2-N-&|rRSoCR~IiNTj&6_`PoWU@ht!5xhMc6v}3EE5Nl9>o8022 zZJvt^Ktdq}^B5KzJGwo0zVRe;f14a{YTcRO|B7WMQ+_HwU*6HY@XV7x66MMo#btGU z`xK`{&aFRjN8*&sw7GM5TEl@(@%Hy?<63d`WaVjpKQ-|aK+kMG`y}PdhLf*cj%BN< z-&6gVw{bGRP4rwKXWp8MOI}}2v(LNRJ7eXH)kc4T%3^o;`0cE-3@BqSDLVCaF)(gE zJxO^Rpt05Zisx46g;(AMs9)u44chHIH^f@R>n&et5ap7_;ubSzYWtj-^HXU4c5mzS zy~niju4)%=eRy28_0CQH(?(}P+gLle^&T%eU6CF1LbfOG<0<{}nahQCOPHTIYThEd sZ;@O33!%AQ@#)skgzU`z?%hA;Y{~A1_HMsVzzoCS>FVdQ&MBb@0RL&AR{#J2 literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/others_rateus.png b/org.envirocar.app/res/drawable/others_rateus.png new file mode 100644 index 0000000000000000000000000000000000000000..4218cce661fb6dc468a9b68cdac62c338e02873f GIT binary patch literal 879 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qt-49qN^E{-7;ac}3G?z-k6;8q{IBdq+h+#)^K zBZ7f0F_o1f7c0f|z2zNUMAmow5Xw8kUa&Mik*hu8ulmap^{Z3gA4ojJKdI!Z0=t^A zwG)S8i+~eHW>5Fr6xDeplSC~V_FFxjrE@0v$L`>DC!6Lp-CwBZuf{oo;!7Y(r5MapQ3dl@z|@wd08F?EYYR4R^=;n`qDAcyr ztftl5Bf9nn*YpqjyLo{^|91ZPAgY&m^r3ci+@V*8!?*2VF$a=cSjvIq2A1uI!TiJ8Zn zd%ZDG!4sY>d~YsJ(A3gj9o7Cd5dktQONXukD(nt+bYFv{!&>NY}mAYl_c*NX5OXxmp``DL^yI$npMx(;NI> zy0&;-6srIITz3ysyT;az08J}($EWw>T7zfq26BEeN44Ks&ht;;oNBpXVo*s|)2Z@% zrV+E|xVCs)EWThBbKn1i)ta+YK-`5ae|ho`ES22cA)xt7AgcX0Q~n|00^e`CN-kaB zguiI-VZAO_BcCm(7!)G>MS2hKUfzA@KY}z)|G@Xf?uXr`4)J>Z+s{(IPX(q_U~+xb cc=sK@Za~@7*!ezrz)Zs6>FVdQ&MBb@0F%Ro_5c6? literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/others_settings.png b/org.envirocar.app/res/drawable/others_settings.png new file mode 100644 index 0000000000000000000000000000000000000000..4a7af9bf756b30291e1633814d7badcd0e332b64 GIT binary patch literal 2260 zcmV;_2rKuAP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D2x&<~K~#8N?VW3= z6;&99y(AW!sQCO0aia)|G1X`9zNEd%3r2R;#s36p| zz>4}~lwDOq%F4`pQHGbibn5xeyj#xkoU_kd*37JPW*&H%z4xs3e&2k{vuDq3*`}nV zq@<*zwNq15a~scy*%cEC&=;Mnx3Mt~3VNDlBJj9Oma)O69l8{?*GK+CvR&Euk62m}_Mk~x6$|!x@~BPnumryPst(?_`D&@(9ov`S}%(Ru+GmxA-Af7QGqtc z(L7#;-oeuT?Vxuu@YycQP|$unYWCb2ZTuP(atbvVb)o%67QJNAD73i}Ekb_=y^?{? zDYO_}r4Wt6`i|&16#7&RP5l@Ya)~?`73g;W)!X6o-p*OgMYTK6w7~ycG#_Tnv3QfcyoBql4TLPH%EswDYCGAor=Az}MJXVF3B$R85wjO_cf zaIoD+&_I>KA4qC6N_?rcrNK7OR0;fp)FIXp78j}nenE1N25F{;6&tNb z51^h3T@OC*Ow*|>SEFM=&-5V1B8Bz~5=(S8`j0}9p1z6#-Zv?fACS=V%FQWOM0B0PBm$p4=xbR!1>Y44 zlRX6QL=M-myqDz?miC=)J2$7`c@#Mrj0*VmM7tHj8Oqh_uoT^ou0{3kXh{r)jTL?; z%H%kMFw>NZQ}7**Qs3Dd#My;DK+Dh!G@6gQDV1>0=@w+SeP;Ia@ob2_LFuFd{<$76 z5#R1inWc29L&Lr5mkY$VpSF>HO+^L&F6fX#<^u8U`bi(9)HG_J8zlLjQb`r!EKG%|sI04o$XFTDQ?*{3uzfp~e}#qa%q z*uj$9b3j!f)^>%?3-74$wP8f)9 zr?Pu1om3#qImFlzM9c@`+sWI$N~vjRXmcC>9CXVE;-`8`KmNHsNtwqnEJJDc1&gTYfg0BwJatppTfk4$6 zAHsrXX+5kzRK)w##ec3cg3tg>rkv2u;V~1yZ-Or!#Wj6u27G*vAvNe zMavZX*P>ht0o$AZQ@7P1!8yvc5U{;3Yt#LMHeuaeX|CogzlPi#Ooh~EvW_rGDRgz7h>6E+|*BNw`8b~Jp|kQ9VM`B=~@#&t=U{oM@>_MTQ-4HjMmuKdi z;{9Nh`Wz+Zk6uUh9xi3oI6jN@mrp;NaU#FLs6Y~N24xExB#Q>%XHUsaM|MTf*(`N< z*{nhL@v_Nl^Q`ZV-VAz#gZ6$5Mg@|wnXa216x!GgaCWmo==+suzbWXQ49icJp`iUV zy8RXOZW`M8H5e60s_LMy&Q2@bpyr{W&x^811U?&O85;W7eFC4zq5-V4!MIh;{e$Fe zQ1&R_Gw|6e6zjPU`puM0BJf!%%Sh1G4ul^;CjzGc-upcm6-d$s!!k z=9LukxJQ<;z+xC4+vH_O;{Fdt1(LOUXh)(>`Y1MdbhjcnAn}Bic-TSl2+K(y6%z`O zX#N%Y+yBtkQFbLsp_qw&Y0-b1tV&!!K@ce*(lPpjMg5_lSPSZsBvEkJeK9SkSf2b iN=iyfN(w@oHva>q6-30k_QXB_0000 zJWqYP7L~nr>$NEFUuq|Bmb@!6o4b3C?{mHM%R5gabAwmioSgM-$t+vV^dZ4Sb3Ph( zNO%Fsk!a3G<02^>5==Dbqj2*;X%UzpFI3x$xPN#Q)%EovFi|sjy85}Sb4q9e0PoU} A`Tzg` literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/drawable/recording_screen_switch_views.png b/org.envirocar.app/res/drawable/recording_screen_switch_views.png new file mode 100644 index 0000000000000000000000000000000000000000..88aca42de87af1ff9ecd3630b883253d82d8e5c6 GIT binary patch literal 1545 zcmV+k2KM=hP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1)fPnK~#8N?VU%c zEkzK9uW@VI7*H`_03#}*U=E<7?i3Vt;WHwFD_5c}3}8gJ>OxlvqJoNI+~`Kkpdw~* zVa{OI|GT_~p{X-Hse5{`KKOX=UJiF^>YSPBo~f?0<~WYyIF92uj^j9v<2aSDnLJot zDsPjI%D3gG@;mvb{9S%4Ka{V_hvkj(e0hM}M3&;(jsGs1?d28nDfyH9ccfp*2jxX_ zTbT=z&-ND0UGi@kCvhr&lMl($BuCd&gyiF*Au-K_<@9}df!thp!*gytH;Mw_GExlBto?s^nvp>?B{1 z1jy(n#St>zv64O_x0V)d$;awATrw1F26>E3@q`Soe@EUcFOet6-Q+fs3+NUb|IhD^ zmJBydju7a0f1g*L_h@=CeO`cK2)jo|{zn>pmo_(t*p zf-cF&YGB9zkXDd*hAhdB@&@^%wBlJMAE5iA-?dovE(aJqa;5)|`+n$Gz#Qzaj(f>Fk~a>M#hbuwl0(dog|$w#LnIg*b~ z2XZAJi*dK)8Sc`^nS3k)r6Zww;U&pE`X!J%`B((%cH#{`E02`5QX=_Sgti&)QE zsH(FPAEdO!$p}RSR^o#UP@IgMB(1~;-;hp5Qnz7P$LwU}K4~RBc#Cv0@}9I3A7llO zlZjoWmGq_u$?RAg&gFHo7I?^H#TfiSPPzJiCDz7sSX1(W$E-YVwPM95Wf826Pi<|< zZ$jY#1qgA>m&+o=8=l&lli!5f?v&&ZGbK8d>J%YP*px0M`AsNJqe!h7R^p~`iOHV@ zD|ut}xX~7e^XU&Qg+*qlnxmo6HExZbjK$=HcaRrI*L|Fw^fR+zPt6yB3th~8N z(s!sNv`@3*L6U!#tOhH{*f2`qkfrgR^_n)hKG0~7ndo+MC_F~wNfr$NQ&)n)h_JjqJI zNT|78F1Uxu>SzWTyJ~#Qr?~BLUI}Rin}VjYyq3 + + + \ No newline at end of file diff --git a/org.envirocar.app/res/drawable/roundedwhitebutton.xml b/org.envirocar.app/res/drawable/roundedwhitebutton.xml new file mode 100644 index 000000000..a6f3dfaa6 --- /dev/null +++ b/org.envirocar.app/res/drawable/roundedwhitebutton.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/org.envirocar.app/res/drawable/tick_mark.png b/org.envirocar.app/res/drawable/tick_mark.png new file mode 100644 index 0000000000000000000000000000000000000000..5221e14ccabec8bbc5a0474fb01a76a39c6f06df GIT binary patch literal 721 zcmV;?0xtcDP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0%l1>K~!i%?U~I^ z6hRb)CkiawiMUc9LnH5@@$W%2u2_j{AVJ^-ObjMO@I6#`0Q}jAx)wKbzQj&Com*2? zUAM|jpX5tsdb)0%n(nE4`_63Aq)9HiEbfZuVqctyU*gX{czrDRjB_~mlKAhsC0>ee z;%_Ej1!HfD=2{WE;#^qfav;XGAZ8Oi7C(h$ri3#=>}pyPd%~LBlUHI z5?La{dL*e-UJJ^RwcfElc)1~xMT)lq)u1!qDYS@nktB*N>J%%8H$(G?_n*Y@+|MGZ z09+Nr!8Hh(=eTt~+!0Yx?plLA8Dk!viKyNRYp@q%&BGfJ)x7PjloIp6ZzC$6o~*%r z#w@bbJdjwUitYbwbGZ|Hm;8*@YlU@vUDK%|*th>^K#cxp^>#@*q3I)(}M& zO(*&`)a*QX@IM+?2zdQL@EIjBRb_HvHfhqNkY=+B&6Qgh;#bJ100000NkvXXu0mjf D08Bis literal 0 HcmV?d00001 diff --git a/org.envirocar.app/res/layout/activity_account_register_card.xml b/org.envirocar.app/res/layout/activity_account_register_card.xml index 66dc58998..fa98d5b24 100644 --- a/org.envirocar.app/res/layout/activity_account_register_card.xml +++ b/org.envirocar.app/res/layout/activity_account_register_card.xml @@ -141,6 +141,34 @@ android:layout_marginBottom="@dimen/spacing_large" android:text="@string/action_sign_in_register"/> + + + + + + + + + + + \ No newline at end of file diff --git a/org.envirocar.app/res/layout/activity_base_main_bottom_bar.xml b/org.envirocar.app/res/layout/activity_base_main_bottom_bar.xml new file mode 100644 index 000000000..173adb359 --- /dev/null +++ b/org.envirocar.app/res/layout/activity_base_main_bottom_bar.xml @@ -0,0 +1,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/org.envirocar.app/res/layout/activity_login.xml b/org.envirocar.app/res/layout/activity_login.xml index 4276c711a..cbfb608d7 100644 --- a/org.envirocar.app/res/layout/activity_login.xml +++ b/org.envirocar.app/res/layout/activity_login.xml @@ -48,197 +48,9 @@ android:visibility="gone" app:elevation="6dp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.envirocar.app/res/layout/activity_obdplus_gpstrack_recording_screen.xml b/org.envirocar.app/res/layout/activity_obdplus_gpstrack_recording_screen.xml new file mode 100644 index 000000000..cf4ef2261 --- /dev/null +++ b/org.envirocar.app/res/layout/activity_obdplus_gpstrack_recording_screen.xml @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.envirocar.app/res/layout/fragment_dashboard.xml b/org.envirocar.app/res/layout/fragment_dashboard.xml index 22581956d..79134c766 100644 --- a/org.envirocar.app/res/layout/fragment_dashboard.xml +++ b/org.envirocar.app/res/layout/fragment_dashboard.xml @@ -18,16 +18,18 @@ You should have received a copy of the GNU General Public License along with the enviroCar app. If not, see http://www.gnu.org/licenses/. + --> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:background="#102226" + android:orientation="vertical"> \ No newline at end of file diff --git a/org.envirocar.app/res/layout/fragment_dashboard_frag_map.xml b/org.envirocar.app/res/layout/fragment_dashboard_frag_map.xml index 2e852528e..ff728cf56 100644 --- a/org.envirocar.app/res/layout/fragment_dashboard_frag_map.xml +++ b/org.envirocar.app/res/layout/fragment_dashboard_frag_map.xml @@ -33,12 +33,13 @@ diff --git a/org.envirocar.app/res/layout/fragment_dashboard_view.xml b/org.envirocar.app/res/layout/fragment_dashboard_view.xml new file mode 100644 index 000000000..0358d09a2 --- /dev/null +++ b/org.envirocar.app/res/layout/fragment_dashboard_view.xml @@ -0,0 +1,722 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +