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 f5248eaa1280056d8588eaabf482d1426874a049..9bf1795999d8bd8cc09962481578ef5f8c274745 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 873f17b6841d845281107943329f949b18599e98..4224fa3a485cbc500bd8deb7c455d5c04ecc62bc 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" /> + + + + + + + + + +