com.gianlu.commonutils.logs.LogsHelper Java Examples

The following examples show how to use com.gianlu.commonutils.logs.LogsHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UncaughtExceptionActivity.java    From CommonUtils with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_unchaught_exception);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    Button email = findViewById(R.id.uncaughtException_email);
    email.setOnClickListener(v -> LogsHelper.sendEmail(this, (Throwable) getIntent().getSerializableExtra("exception")));
}
 
Example #2
Source File: MainActivity.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onDrawerMenuItemSelected(@NonNull BaseDrawerItem<DrawerItem> item) {
    switch (item.id) {
        case HOME:
            return true;
        case STARRED_CARDS:
            StarredCardsActivity.startActivity(this);
            return true;
        case USER_METRICS:
            MetricsActivity.startActivity(this);
            return true;
        case PREFERENCES:
            startActivity(new Intent(this, PreferenceActivity.class));
            return true;
        case REPORT:
            LogsHelper.sendEmail(this, null);
            return true;
    }

    return false;
}
 
Example #3
Source File: OfflineActivity.java    From CommonUtils with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_offline);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.hide();

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

    Button email = findViewById(R.id.offline_email);
    email.setOnClickListener(v -> LogsHelper.sendEmail(this, null));

    Button offline = findViewById(R.id.offline_retry);
    final Class<?> retryClass = (Class) getIntent().getSerializableExtra("retry");
    if (retryClass == null) {
        offline.setVisibility(View.GONE);
    } else {
        offline.setVisibility(View.VISIBLE);
        offline.setOnClickListener(v -> startActivity(new Intent(OfflineActivity.this, retryClass)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)));
    }
}
 
Example #4
Source File: MainActivity.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onDrawerMenuItemSelected(@NonNull BaseDrawerItem<DrawerItem> which) {
    switch (which.id) {
        case HOME:
            refresh(MAIN_WANTS, this);
            return true;
        case DIRECT_DOWNLOAD:
            startActivity(new Intent(this, DirectDownloadActivity.class));
            return false;
        case QUICK_OPTIONS:
            showDialog(OptionsDialog.getGlobal(true));
            return true;
        case GLOBAL_OPTIONS:
            showDialog(OptionsDialog.getGlobal(false));
            return true;
        case PREFERENCES:
            startActivity(new Intent(this, PreferenceActivity.class));
            return false;
        case SUPPORT:
            LogsHelper.sendEmail(this, null);
            return true;
        case ABOUT_ARIA2:
            AboutAria2Dialog.get().show(getSupportFragmentManager(), null);
            return true;
        case ADD_PROFILE:
            EditProfileActivity.start(this, false);
            return true;
        default:
            return true;
    }
}
 
Example #5
Source File: LoadingActivity.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
private void showErrorDialog(@NonNull final Throwable ex) {
    AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this);
    builder.setTitle(R.string.failedConnecting)
            .setPositiveButton(android.R.string.ok, null)
            .setNeutralButton(R.string.contactMe, (dialog, which) -> LogsHelper.sendEmail(LoadingActivity.this, ex))
            .setMessage(ex.toString());

    showDialog(builder);
}