-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add device info and crash report share option
- Loading branch information
1 parent
f459600
commit 5cfdaa9
Showing
35 changed files
with
1,190 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
|
||
package="com.balsikandar.crashreporter"> | ||
|
||
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true"> | ||
|
||
<provider | ||
android:name=".CrashReporterInitProvider" | ||
android:authorities="${applicationId}.CrashReporterInitProvider" | ||
android:enabled="true" | ||
android:exported="false" /> | ||
|
||
<activity | ||
android:name=".ui.CrashReporterActivity" | ||
android:launchMode="singleTask" | ||
android:taskAffinity="com.balsikandar.android.task" | ||
android:theme="@style/CrashReporter.Theme" /> | ||
|
||
<activity | ||
android:name=".ui.LogMessageActivity" | ||
android:parentActivityName=".ui.CrashReporterActivity" | ||
android:theme="@style/CrashReporter.Theme" /> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
crashreporter/src/main/java/com/balsikandar/crashreporter/adapter/CrashLogAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.balsikandar.crashreporter.adapter; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.balsikandar.crashreporter.R; | ||
import com.balsikandar.crashreporter.ui.LogMessageActivity; | ||
import com.balsikandar.crashreporter.utils.CrashUtil; | ||
import com.balsikandar.crashreporter.utils.FileUtils; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
|
||
/** | ||
* Created by bali on 10/08/17. | ||
*/ | ||
|
||
public class CrashLogAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | ||
|
||
private Context context; | ||
private ArrayList<File> crashFileList; | ||
|
||
public CrashLogAdapter(Context context, ArrayList<File> allCrashLogs) { | ||
this.context = context; | ||
crashFileList = allCrashLogs; | ||
} | ||
|
||
@Override | ||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
View view = LayoutInflater.from(context).inflate(R.layout.custom_item, null); | ||
return new CrashLogViewHolder(view); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | ||
((CrashLogViewHolder) holder).setUpViewHolder(context, crashFileList.get(position)); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return crashFileList.size(); | ||
} | ||
|
||
|
||
public void updateList(ArrayList<File> allCrashLogs) { | ||
crashFileList = allCrashLogs; | ||
notifyDataSetChanged(); | ||
} | ||
|
||
|
||
private class CrashLogViewHolder extends RecyclerView.ViewHolder { | ||
private TextView textViewMsg, messageLogTime; | ||
|
||
CrashLogViewHolder(View itemView) { | ||
super(itemView); | ||
messageLogTime = (TextView) itemView.findViewById(R.id.messageLogTime); | ||
textViewMsg = (TextView) itemView.findViewById(R.id.textViewMsg); | ||
} | ||
|
||
void setUpViewHolder(final Context context, final File file) { | ||
final String filePath = file.getAbsolutePath(); | ||
messageLogTime.setText(file.getName().replaceAll("[a-zA-Z_.]", "")); | ||
textViewMsg.setText(FileUtils.readFirstLineFromFile(new File(filePath))); | ||
|
||
textViewMsg.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(context, LogMessageActivity.class); | ||
intent.putExtra("LogMessage", filePath); | ||
context.startActivity(intent); | ||
} | ||
}); | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
crashreporter/src/main/java/com/balsikandar/crashreporter/adapter/MainPagerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.balsikandar.crashreporter.adapter; | ||
|
||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
|
||
import com.balsikandar.crashreporter.ui.CrashLogFragment; | ||
import com.balsikandar.crashreporter.ui.ExceptionLogFragment; | ||
|
||
/** | ||
* Created by bali on 11/08/17. | ||
*/ | ||
|
||
public class MainPagerAdapter extends FragmentPagerAdapter { | ||
|
||
private CrashLogFragment crashLogFragment; | ||
private ExceptionLogFragment exceptionLogFragment; | ||
private String[] titles; | ||
|
||
public MainPagerAdapter(FragmentManager fm, String[] titles) { | ||
super(fm); | ||
this.titles = titles; | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
if (position == 0) { | ||
return crashLogFragment = new CrashLogFragment(); | ||
} else if (position == 1) { | ||
return exceptionLogFragment = new ExceptionLogFragment(); | ||
} else { | ||
return new CrashLogFragment(); | ||
} | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return 2; | ||
} | ||
|
||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return titles[position]; | ||
} | ||
|
||
public void clearLogs() { | ||
crashLogFragment.clearLog(); | ||
exceptionLogFragment.clearLog(); | ||
} | ||
} |
Oops, something went wrong.