mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Add Categorization EventLogging
This commit is contained in:
parent
5e45cb2bd4
commit
1d1e7f9245
4 changed files with 64 additions and 5 deletions
|
|
@ -201,6 +201,16 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
}
|
||||
}
|
||||
|
||||
public int getCurrentSelectedCount() {
|
||||
int count = 0;
|
||||
for(CategoryItem item: categoriesAdapter.getItems()) {
|
||||
if(item.selected) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_categorization, null);
|
||||
|
|
@ -212,6 +222,7 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
|
||||
categoriesSkip.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
getActivity().onBackPressed();
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class CommonsApplication extends Application {
|
|||
public static final Object[] EVENT_UPLOAD_ATTEMPT = {"MobileAppUploadAttempts", 5334329L};
|
||||
public static final Object[] EVENT_LOGIN_ATTEMPT = {"MobileAppLoginAttempts", 5257721L};
|
||||
public static final Object[] EVENT_SHARE_ATTEMPT = {"MobileAppShareAttempts", 5346170L};
|
||||
public static final Object[] EVENT_CATEGORIZATION_ATTEMPT = {"MobileAppCategorizationAttempts", 5359208L};
|
||||
|
||||
public static final String DEFAULT_EDIT_SUMMARY = "Uploaded using Android Commons app";
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,13 @@ public class MultipleShareActivity
|
|||
categoriesSequence.setContentProviderClient(client);
|
||||
categoriesSequence.save();
|
||||
}
|
||||
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("categories-count", categories.size())
|
||||
.param("files-count", photosList.size())
|
||||
.param("source", Contribution.SOURCE_EXTERNAL)
|
||||
.param("result", "queued")
|
||||
.log();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
@ -261,6 +268,27 @@ public class MultipleShareActivity
|
|||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
if(categorizationFragment != null && categorizationFragment.isVisible()) {
|
||||
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("categories-count", categorizationFragment.getCurrentSelectedCount())
|
||||
.param("files-count", photosList.size())
|
||||
.param("source", Contribution.SOURCE_EXTERNAL)
|
||||
.param("result", "cancelled")
|
||||
.log();
|
||||
} else {
|
||||
EventLog.schema(CommonsApplication.EVENT_UPLOAD_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("source", getIntent().getStringExtra(UploadService.EXTRA_SOURCE))
|
||||
.param("multiple", true)
|
||||
.param("result", "cancelled")
|
||||
.log();
|
||||
}
|
||||
}
|
||||
|
||||
public void onBackStackChanged() {
|
||||
if(mediaDetails != null && mediaDetails.isVisible()) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.app.*;
|
|||
import android.content.*;
|
||||
import android.os.*;
|
||||
import android.text.*;
|
||||
import android.util.Log;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import android.net.*;
|
||||
import android.support.v4.app.NavUtils;
|
||||
|
|
@ -77,6 +78,13 @@ public class ShareActivity
|
|||
categoriesSequence.queueModifier(new CategoryModifier(categories.toArray(new String[]{})));
|
||||
categoriesSequence.setContentProviderClient(getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY));
|
||||
categoriesSequence.save();
|
||||
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("categories-count", categories.size())
|
||||
.param("files-count", 1)
|
||||
.param("source", contribution.getSource())
|
||||
.param("result", "queued")
|
||||
.log();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
@ -111,12 +119,23 @@ public class ShareActivity
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
if(categorizationFragment != null && categorizationFragment.isVisible()) {
|
||||
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("categories-count", categorizationFragment.getCurrentSelectedCount())
|
||||
.param("files-count", 1)
|
||||
.param("source", contribution.getSource())
|
||||
.param("result", "cancelled")
|
||||
.log();
|
||||
} else {
|
||||
EventLog.schema(CommonsApplication.EVENT_UPLOAD_ATTEMPT)
|
||||
.param("username", app.getCurrentAccount().name)
|
||||
.param("source", getIntent().getStringExtra(UploadService.EXTRA_SOURCE))
|
||||
.param("multiple", true)
|
||||
.param("result", "cancelled")
|
||||
.log();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAuthCookieAcquired(String authCookie) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue