Skip to content

Commit

Permalink
update 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gunaonian committed Jan 13, 2021
1 parent 477f0fe commit c7e7727
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 15 deletions.
68 changes: 68 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
</div>
<br>

# 效果展示

![http_logo](./img/img1.jpg)

![http_logo](./img/img2.jpg)


# 依赖

```gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ public void run() {
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Application app = (Application) getApplicationContext();
app.registerActivityLifecycleCallbacks(new LifecycleCallbacksUtils());
app.registerActivityLifecycleCallbacks(lifecycleCallbacks);
}
}

private final Application.ActivityLifecycleCallbacks lifecycleCallbacks = new LifecycleCallbacksUtils();

public void notifyHarChange() {
if (previewAdapter != null) {
previewAdapter.notifyHarChange();
Expand All @@ -85,6 +87,10 @@ public void notifyHarChange() {
@Override
protected void onDestroy() {
super.onDestroy();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Application app = (Application) getApplicationContext();
app.unregisterActivityLifecycleCallbacks(lifecycleCallbacks);
}
new Thread(new Runnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.name.setText(harEntry.getPort2PackageName().getAppName());
holder.iconView.setImageDrawable(harEntry.getPort2PackageName().getIcon());
} else {
holder.name.setText("Unknown");
holder.name.setText("Unknown APP");
holder.iconView.setImageDrawable(mContext.getResources().getDrawable(R.drawable.http_canary_ic_error_black_24dp));
}
if (harEntry.getResponse().getContent().getMimeType().contains("image")) {
if (harEntry.getResponse().getStatus() > 400) {
holder.imageViewTitle.setImageDrawable(mContext.getResources().getDrawable(R.drawable.http_canary_ic_error_black_24dp));
} else if (harEntry.getResponse().getStatus() > 300) {
holder.imageViewTitle.setImageDrawable(mContext.getResources().getDrawable(R.drawable.http_canary_ic_directions_black_24dp));
} else if (harEntry.getResponse().getContent().getMimeType().contains("image")) {
holder.imageViewTitle.setImageDrawable(mContext.getResources().getDrawable(R.drawable.http_canary_ic_photo_black_24dp));
} else {
holder.imageViewTitle.setImageDrawable(mContext.getResources().getDrawable(R.drawable.http_canary_ic_description_black_24dp));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public void run() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), PreviewActivity.class));
finish();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public static boolean buildSystemCerts(Context context) {
// if (!copy) {
// return false;
// }
// Log.e("SSSS","copy success");
return prepareRoot(context);
}

Expand Down Expand Up @@ -79,7 +78,6 @@ private static boolean prepareRoot(Context context) {
cmd = "mount " + fakeCertDir + " /system/etc/security/cacerts/;exit";
}
// "mount /storage/emulated/0/fairyhttpcanary/cacerts/ /system/etc/security/cacerts/"
Log.e("SSSSSSS", cmd);
CommandUtils.getSingleInstance().exec(cmd, true);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
android:id="@+id/http_canary_tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textColor="#FF0505"
android:textSize="16sp" />

<ImageView
android:id="@+id/http_canary_iv_title"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_marginRight="8dp" />
</RelativeLayout>
Expand Down

0 comments on commit c7e7727

Please sign in to comment.