use of com.crashlytics.android.Crashlytics in project Awful.apk by Awful.
the class ThreadDisplayFragment method showUrlMenu.
private void showUrlMenu(final String url) {
if (url == null) {
Timber.w("Passed null URL to #showUrlMenu!");
return;
}
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager == null) {
Timber.w("showUrlMenu called but can't get FragmentManager!");
return;
}
boolean isImage = false;
boolean isGif = false;
// TODO: parsing fails on magic webdev urls like http://tpm2016.zoffix.com/#/40
// it thinks the # is the start of the ref section of the url, so the Path for that url is '/'
Uri path = Uri.parse(url);
String lastSegment = path.getLastPathSegment();
// null-safe path checking (there may be no path segments, e.g. a link to a domain name)
if (lastSegment != null) {
lastSegment = lastSegment.toLowerCase();
// using 'contains' instead of 'ends with' in case of any url suffix shenanigans, like twitter's ".jpg:large"
isImage = (StringUtils.indexOfAny(lastSegment, ".jpg", ".jpeg", ".png", ".gif") != -1 && !StringUtils.contains(lastSegment, ".gifv")) || (lastSegment.equals("attachment.php") && path.getHost().equals("forums.somethingawful.com"));
isGif = StringUtils.contains(lastSegment, ".gif") && !StringUtils.contains(lastSegment, ".gifv");
}
// TODO: 28/04/2017 remove all this when Crashlytics #717 is fixed
if (AwfulApplication.crashlyticsEnabled()) {
Crashlytics.setString("Menu for URL:", url);
Crashlytics.setInt("Thread ID", getThreadId());
Crashlytics.setInt("Page", getPageNumber());
FragmentActivity activity = getActivity();
Crashlytics.setBool("Activity exists", activity != null);
if (activity != null) {
String state = "Activity:";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
state += (activity.isDestroyed()) ? "IS_DESTROYED " : "";
}
state += (activity.isFinishing()) ? "IS_FINISHING" : "";
state += (activity.isChangingConfigurations()) ? "IS_CHANGING_CONFIGURATIONS" : "";
Crashlytics.setString("Activity state:", state);
}
Crashlytics.setBool("Thread display fragment resumed", isResumed());
Crashlytics.setBool("Thread display fragment attached", isAdded());
Crashlytics.setBool("Thread display fragment removing", isRemoving());
}
// //////////////////////////////////////////////////////////////////////
UrlContextMenu linkActions = UrlContextMenu.newInstance(url, isImage, isGif, isGif ? "Getting file size" : null);
if (isGif) {
queueRequest(new ImageSizeRequest(url, result -> {
if (linkActions == null) {
return;
}
String size = result == null ? "unknown" : Formatter.formatShortFileSize(getContext(), result);
linkActions.setSubheading(String.format("Size: %s", size));
}));
}
linkActions.setTargetFragment(ThreadDisplayFragment.this, -1);
linkActions.show(fragmentManager, "Link Actions");
}
use of com.crashlytics.android.Crashlytics in project AndResGuard by shwenzhang.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
use of com.crashlytics.android.Crashlytics in project Just-Another-Android-App by athkalia.
the class App method initFabric.
/**
* Setup Fabric. We also set the build time and sha key so that we can easily reproduce bug reports.
*
* Note 1: To send an exception to crashlytics use {@link Crashlytics#logException(Throwable)}. It will send a non-fatal exception.
* This is reported separately in the crashlytics dashboard. See
* https://docs.fabric.io/android/crashlytics/caught-exceptions.html?caught%20exceptions#caught-exceptions for more details.
*
* Note 2: To log a statement in Crashlytics use {@link Crashlytics#log(String)}. This log statement will appear when clicking on a
* specific crash report. For example if you have a crash that occurred 10 times, one would need to click through all 10 instances of
* that crash to see the individual log statements for every instance of this crash.
* See https://docs.fabric.io/android/crashlytics/enhanced-reports.html for more info.
*
* Note 3: To log a key-value pair in Crashlytics use {@link Crashlytics#setString(String, String)}. Same concept as logging a
* statement described in Note 2.
*/
private void initFabric() {
CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(// 'debug' builds not using fabric, 'qa' and 'release' do.
"debug".equals(BuildConfig.BUILD_TYPE)).build();
Crashlytics crashlytics = new Crashlytics.Builder().core(crashlyticsCore).build();
Answers answers = new Answers();
final Fabric fabric = new Fabric.Builder(getApplicationContext()).kits(crashlytics, answers).debuggable(// 'debug' and 'qa' build types have extra log statements, 'release' build type doesn't.
BuildConfig.DEBUG).build();
Fabric.with(fabric);
Crashlytics.setString("GIT_SHA_KEY", BuildConfig.GIT_SHA);
Crashlytics.setString("BUILD_TIME", BuildConfig.BUILD_TIME);
}
use of com.crashlytics.android.Crashlytics in project jianshi by wingjay.
the class JianShiApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
appComponent = DaggerAppComponent.builder().appModule(new AppModule(JianShiApplication.this)).build();
final Fabric fabric = new Fabric.Builder(this).kits(new Crashlytics()).debuggable(true).build();
Fabric.with(fabric);
Stetho.initializeWithDefaults(this);
instance = this;
FlowManager.init(new FlowConfig.Builder(this).openDatabasesOnInit(true).build());
initLog();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/jianshi_default.otf").setFontAttrId(R.attr.fontPath).build());
}
use of com.crashlytics.android.Crashlytics in project MusicDNA by harjot-oberai.
the class MusicDNAApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
refWatcher = LeakCanary.install(this);
}
Aggregations