From 882a447c5c02b851bcd9f36cda3a74e9e3131aed Mon Sep 17 00:00:00 2001 From: Mattia Date: Wed, 2 May 2018 22:14:58 +0200 Subject: [PATCH] =?UTF-8?q?implementato=20event=20track=20con=20verifica?= =?UTF-8?q?=20di=20funzionalit=C3=A0=20caching=20di=20messaggi=20e=20re-in?= =?UTF-8?q?vio=20non=20appena=20ritorna=20la=20connessione?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../it/icarusandroid/MainActivity.java | 36 +++++++++++++++++ .../app/src/main/res/layout/activity_main.xml | 40 +++++++++++++++++++ .../it/icarus/Icarus.java | 6 ++- .../it/icarus/UserSettingsResource.java | 2 +- 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java b/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java index f5248ea..9bf1795 100644 --- a/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java +++ b/IcarusAndroid/app/src/main/java/framework/everywaretechnologies/it/icarusandroid/MainActivity.java @@ -8,6 +8,7 @@ import android.view.View; import android.widget.EditText; import android.widget.Switch; +import framework.everywaretechnologies.it.icarus.EventTrackResource; import framework.everywaretechnologies.it.icarus.Icarus; import framework.everywaretechnologies.it.icarus.UserSettingsResource; @@ -27,6 +28,11 @@ public class MainActivity extends AppCompatActivity { private Switch intPrefSwitch; private Icarus instance; + private EditText eventNameEditText; + private EditText eventCategoryEditText; + private EditText eventLabelEditText; + private EditText mostProbableActivityEditText; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -50,6 +56,11 @@ public class MainActivity extends AppCompatActivity { if(lastIntPref==1)intPrefSwitch.setChecked(false); else intPrefSwitch.setChecked(true); + + eventNameEditText=findViewById(R.id.editText_eventName); + eventCategoryEditText=findViewById(R.id.editText_eventCategory); + eventLabelEditText=findViewById(R.id.editText_eventLabel); + mostProbableActivityEditText=findViewById(R.id.editText_mostProbableActivity); } //------------------------- UI EVENT ----------------------- @@ -87,4 +98,29 @@ public class MainActivity extends AppCompatActivity { instance.logUserSettings(userSettingsResource,true); } + + public void onBtnEventTrack(View view){ + + Log.d(CLASS_NAME,"on btn track event"); + + String eventName,eventCategory,eventLabel,mostProbableActivity; + + if(eventNameEditText.getText().length() == 0) eventName="eventoProva"; + else eventName=eventNameEditText.getText().toString(); + + if(eventCategoryEditText.getText().length()==0) eventCategory=Icarus.EventCategories.APPLICATION.toString(); + else eventCategory=eventCategoryEditText.getText().toString(); + + if(eventLabelEditText.getText().length()==0) eventLabel = "labelProva"; + else eventLabel=eventLabelEditText.getText().toString(); + + if(mostProbableActivityEditText.getText().length()==0) mostProbableActivity="activityProva"; + else mostProbableActivity=mostProbableActivityEditText.getText().toString(); + + EventTrackResource eventTrackResource=new EventTrackResource(eventName,eventCategory,eventLabel,90,90,5, + mostProbableActivity,90,false); + + instance.logEvent(eventTrackResource,true); + + } } diff --git a/IcarusAndroid/app/src/main/res/layout/activity_main.xml b/IcarusAndroid/app/src/main/res/layout/activity_main.xml index 873f17b..4224fa3 100644 --- a/IcarusAndroid/app/src/main/res/layout/activity_main.xml +++ b/IcarusAndroid/app/src/main/res/layout/activity_main.xml @@ -74,4 +74,44 @@ android:onClick="onBtnUserPrefChanges" android:text="Invia pref changes" /> + + + + + + + + + +