2014-02-26 03:53:12 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
2016-08-14 10:23:51 +00:00
|
|
|
import android.content.ActivityNotFoundException;
|
|
|
|
import android.content.Intent;
|
2014-02-26 03:53:12 +00:00
|
|
|
import android.os.Bundle;
|
2014-06-27 21:34:51 +00:00
|
|
|
import android.support.v4.app.FragmentTransaction;
|
2018-08-01 15:09:24 +00:00
|
|
|
import org.thoughtcrime.securesms.logging.Log;
|
2014-06-29 03:40:57 +00:00
|
|
|
import android.view.MenuItem;
|
2014-02-26 03:53:12 +00:00
|
|
|
import android.widget.Toast;
|
|
|
|
|
2018-07-30 20:13:37 +00:00
|
|
|
import org.thoughtcrime.securesms.logsubmit.SubmitLogFragment;
|
2016-09-04 13:00:35 +00:00
|
|
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
2014-02-26 03:53:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Activity for submitting logcat logs to a pastebin service.
|
|
|
|
*/
|
2015-02-08 21:53:12 +00:00
|
|
|
public class LogSubmitActivity extends BaseActionBarActivity implements SubmitLogFragment.OnLogSubmittedListener {
|
2016-09-04 13:00:35 +00:00
|
|
|
|
2014-02-26 03:53:12 +00:00
|
|
|
private static final String TAG = LogSubmitActivity.class.getSimpleName();
|
2016-09-04 13:00:35 +00:00
|
|
|
private DynamicTheme dynamicTheme = new DynamicTheme();
|
2014-02-26 03:53:12 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle icicle) {
|
2016-09-04 13:00:35 +00:00
|
|
|
dynamicTheme.onCreate(this);
|
2014-02-26 03:53:12 +00:00
|
|
|
super.onCreate(icicle);
|
|
|
|
setContentView(R.layout.log_submit_activity);
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
2014-06-27 21:34:51 +00:00
|
|
|
SubmitLogFragment fragment = SubmitLogFragment.newInstance();
|
|
|
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
|
|
|
transaction.replace(R.id.fragment_container, fragment);
|
|
|
|
transaction.commit();
|
2014-02-26 03:53:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
2016-09-04 13:00:35 +00:00
|
|
|
dynamicTheme.onResume(this);
|
2014-02-26 03:53:12 +00:00
|
|
|
super.onResume();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
super.onOptionsItemSelected(item);
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case android.R.id.home:
|
|
|
|
finish();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-06-27 21:34:51 +00:00
|
|
|
@Override
|
|
|
|
public void onSuccess() {
|
|
|
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__thanks, Toast.LENGTH_LONG).show();
|
|
|
|
finish();
|
2014-02-26 03:53:12 +00:00
|
|
|
}
|
|
|
|
|
2014-06-27 21:34:51 +00:00
|
|
|
@Override
|
|
|
|
public void onFailure() {
|
|
|
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__log_fetch_failed, Toast.LENGTH_LONG).show();
|
|
|
|
finish();
|
2014-02-26 03:53:12 +00:00
|
|
|
}
|
|
|
|
|
2014-06-27 21:34:51 +00:00
|
|
|
@Override
|
|
|
|
public void onCancel() {
|
|
|
|
finish();
|
2014-02-26 03:53:12 +00:00
|
|
|
}
|
2016-08-14 10:23:51 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void startActivity(Intent intent) {
|
|
|
|
try {
|
|
|
|
super.startActivity(intent);
|
|
|
|
} catch (ActivityNotFoundException e) {
|
|
|
|
Log.w(TAG, e);
|
|
|
|
Toast.makeText(this, R.string.log_submit_activity__no_browser_installed, Toast.LENGTH_LONG).show();
|
|
|
|
}
|
|
|
|
}
|
2014-02-26 03:53:12 +00:00
|
|
|
}
|