Skip to content

Commit

Permalink
share added for network log
Browse files Browse the repository at this point in the history
  • Loading branch information
isacan committed Dec 6, 2017
1 parent 2296f1c commit 4117b68
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.canakkoca.andzu.activities;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
Expand All @@ -12,6 +13,7 @@

import com.canakkoca.andzu.R;
import com.canakkoca.andzu.base.NetworkLog;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down Expand Up @@ -68,7 +70,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

Button btn = findViewById(R.id.shareInfo);
btn.setOnClickListener(view -> {

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, networkLog.toString());
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent,"Share with"));
});

}
Expand Down
4 changes: 2 additions & 2 deletions Andzu/src/main/java/com/canakkoca/andzu/base/AndzuApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private static class ActiveActivitiesTracker {

public static void activityStarted()
{
if( sActiveActivities == 0 )
if( sActiveActivities == 0 || sActiveActivities == 1)
{
if(isAndzuEnabled)
bubbleView.setVisibility(View.VISIBLE);
Expand All @@ -157,7 +157,7 @@ public static void activityStopped()
{
try {
if(isAndzuEnabled)
bubblesManager.recycle();
bubbleView.setVisibility(View.GONE);
}catch (Exception ignored){

}
Expand Down
17 changes: 17 additions & 0 deletions Andzu/src/main/java/com/canakkoca/andzu/base/NetworkLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import java.io.Serializable;
import java.util.List;
import java.util.Locale;

import org.greenrobot.greendao.annotation.Generated;

/**
Expand Down Expand Up @@ -127,4 +129,19 @@ public String getPostData() {
public void setPostData(String postData) {
this.postData = postData;
}

@Override
public String toString() {
return String.format(Locale.getDefault(),
"Request Type : %s \n" +
"Request Url : %s\n" +
"Request Date : %d\n" +
"Request Headers : %s\n" +
"Response Code : %s\n" +
"Response Data : %s\n" +
"Duration : %d\n" +
"Error Client Desc : %s\n" +
"Post Data : %s",requestType,url,date,headers,responseCode,responseData,
(long)duration.doubleValue(),errorClientDesc,postData);
}
}

0 comments on commit 4117b68

Please sign in to comment.