mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Merge pull request #745 from mcginty/logcat_submit
activity to submit logcat to pastebin
This commit is contained in:
commit
a8c23413ba
@ -183,6 +183,11 @@
|
|||||||
<activity android:name=".RegistrationProgressActivity"
|
<activity android:name=".RegistrationProgressActivity"
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".LogSubmitActivity"
|
||||||
|
android:label="@string/AndroidManifest__log_submit"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
|
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
|
||||||
<service android:enabled="true" android:name=".service.KeyCachingService"/>
|
<service android:enabled="true" android:name=".service.KeyCachingService"/>
|
||||||
<service android:enabled="true" android:name=".service.SendReceiveService"/>
|
<service android:enabled="true" android:name=".service.SendReceiveService"/>
|
||||||
|
51
res/layout/log_submit_activity.xml
Normal file
51
res/layout/log_submit_activity.xml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/log_submit_confirmation"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="@string/log_submit_activity__confirmation"
|
||||||
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp" />
|
||||||
|
|
||||||
|
<ScrollView android:id="@+id/log_preview_container"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="2">
|
||||||
|
<EditText android:id="@+id/log_preview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?android:attr/textViewStyle"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:hint=""
|
||||||
|
android:inputType="textImeMultiLine|textNoSuggestions|textMultiLine"
|
||||||
|
android:textSize="10sp" />
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<Button android:id="@+id/cancel"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/log_submit_activity__button_cancel"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<Button android:id="@+id/ok"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/log_submit_activity__button_ok"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
7
res/menu/log_submit.xml
Normal file
7
res/menu/log_submit.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:title="@string/text_secure_normal__submit_debug_log"
|
||||||
|
android:id="@+id/menu_submit_debug_logs"
|
||||||
|
android:icon="@android:drawable/ic_menu_upload" />
|
||||||
|
</menu>
|
@ -442,6 +442,18 @@
|
|||||||
<string name="create_passphrase_activity__continue">Continue</string>
|
<string name="create_passphrase_activity__continue">Continue</string>
|
||||||
<string name="create_passphrase_activity__generating_secrets">GENERATING SECRETS</string>
|
<string name="create_passphrase_activity__generating_secrets">GENERATING SECRETS</string>
|
||||||
|
|
||||||
|
<!-- log_submit_activity -->
|
||||||
|
<string name="log_submit_activity__confirmation">This log will be posted publicly online for TextSecure contributors to view. Feel free to examine or edit the logs below before hitting submit.</string>
|
||||||
|
<string name="log_submit_activity__button_cancel">Don\'t submit</string>
|
||||||
|
<string name="log_submit_activity__button_ok">Submit</string>
|
||||||
|
<string name="log_submit_activity__log_fetch_failed">Could not grab logs from your device. You can still use ADB to get debug logs instead.</string>
|
||||||
|
<string name="log_submit_activity__log_submit_success_title">Success!</string>
|
||||||
|
<string name="log_submit_activity__log_got_it">Got it</string>
|
||||||
|
<string name="log_submit_activity__your_pastebin_url">Please copy this URL and add it to your issue (long press to put in clipboard):\n\n<b>%1$s</b></string>
|
||||||
|
<string name="log_submit_activity__copied_to_clipboard">Copied to clipboard</string>
|
||||||
|
<string name="log_submit_activity__loading_logcat">Loading logcat…</string>
|
||||||
|
<string name="log_submit_activity__thanks">Thanks for your help!</string>
|
||||||
|
|
||||||
<!-- database_migration_activity -->
|
<!-- database_migration_activity -->
|
||||||
<string name="database_migration_activity__would_you_like_to_import_your_existing_text_messages">Would you like to import your existing text messages into TextSecure\'s encrypted database?</string>
|
<string name="database_migration_activity__would_you_like_to_import_your_existing_text_messages">Would you like to import your existing text messages into TextSecure\'s encrypted database?</string>
|
||||||
<string name="database_migration_activity__the_default_system_database_will_not_be_modified">The default system database will not be modified or altered in any way.</string>
|
<string name="database_migration_activity__the_default_system_database_will_not_be_modified">The default system database will not be modified or altered in any way.</string>
|
||||||
@ -608,6 +620,7 @@
|
|||||||
<string name="AndroidManifest__verify_identity">Verify Identity</string>
|
<string name="AndroidManifest__verify_identity">Verify Identity</string>
|
||||||
<string name="AndroidManifest__manage_identity_keys">Manage Identity Keys</string>
|
<string name="AndroidManifest__manage_identity_keys">Manage Identity Keys</string>
|
||||||
<string name="AndroidManifest__complete_key_exchange">Complete Key Exchange</string>
|
<string name="AndroidManifest__complete_key_exchange">Complete Key Exchange</string>
|
||||||
|
<string name="AndroidManifest__log_submit">Submit Debug Logs</string>
|
||||||
|
|
||||||
<!-- arrays.xml -->
|
<!-- arrays.xml -->
|
||||||
<string name="arrays__import_export">Import / Export</string>
|
<string name="arrays__import_export">Import / Export</string>
|
||||||
@ -770,6 +783,7 @@
|
|||||||
<string name="text_secure_normal__menu_settings">Settings</string>
|
<string name="text_secure_normal__menu_settings">Settings</string>
|
||||||
<string name="text_secure_normal__menu_clear_passphrase">Lock</string>
|
<string name="text_secure_normal__menu_clear_passphrase">Lock</string>
|
||||||
<string name="text_secure_normal__mark_all_as_read">Mark All Read</string>
|
<string name="text_secure_normal__mark_all_as_read">Mark All Read</string>
|
||||||
|
<string name="text_secure_normal__submit_debug_log">Submit debug log</string>
|
||||||
|
|
||||||
<!-- verify_keys -->
|
<!-- verify_keys -->
|
||||||
<string name="verify_keys__menu_verified">Verified</string>
|
<string name="verify_keys__menu_verified">Verified</string>
|
||||||
|
@ -109,6 +109,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
|||||||
menu.clear();
|
menu.clear();
|
||||||
|
|
||||||
inflater.inflate(R.menu.text_secure_normal, menu);
|
inflater.inflate(R.menu.text_secure_normal, menu);
|
||||||
|
inflater.inflate(R.menu.log_submit, menu);
|
||||||
|
|
||||||
menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this));
|
menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this));
|
||||||
|
|
||||||
@ -152,6 +153,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
|||||||
case R.id.menu_settings: handleDisplaySettings(); return true;
|
case R.id.menu_settings: handleDisplaySettings(); return true;
|
||||||
case R.id.menu_clear_passphrase: handleClearPassphrase(); return true;
|
case R.id.menu_clear_passphrase: handleClearPassphrase(); return true;
|
||||||
case R.id.menu_mark_all_read: handleMarkAllRead(); return true;
|
case R.id.menu_mark_all_read: handleMarkAllRead(); return true;
|
||||||
|
case R.id.menu_submit_debug_logs: handleLogSubmit(); return true;
|
||||||
case android.R.id.home: handleNavigationDrawerToggle(); return true;
|
case android.R.id.home: handleNavigationDrawerToggle(); return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +187,11 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleLogSubmit() {
|
||||||
|
Intent intent = new Intent(this, LogSubmitActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void handleNavigationDrawerToggle() {
|
private void handleNavigationDrawerToggle() {
|
||||||
if (drawerLayout.isDrawerOpen(drawerList)) {
|
if (drawerLayout.isDrawerOpen(drawerList)) {
|
||||||
drawerLayout.closeDrawer(drawerList);
|
drawerLayout.closeDrawer(drawerList);
|
||||||
|
266
src/org/thoughtcrime/securesms/LogSubmitActivity.java
Normal file
266
src/org/thoughtcrime/securesms/LogSubmitActivity.java
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.text.ClipboardManager;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.app.SherlockActivity;
|
||||||
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import com.google.thoughtcrimegson.Gson;
|
||||||
|
import com.google.thoughtcrimegson.JsonIOException;
|
||||||
|
import com.google.thoughtcrimegson.JsonParseException;
|
||||||
|
import com.google.thoughtcrimegson.JsonSyntaxException;
|
||||||
|
import com.google.thoughtcrimegson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.ClientProtocolException;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.thoughtcrime.securesms.util.ActionBarUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity for submitting logcat logs to a pastebin service.
|
||||||
|
*/
|
||||||
|
public class LogSubmitActivity extends SherlockActivity {
|
||||||
|
private static final String TAG = LogSubmitActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
private static final String HASTEBIN_ENDPOINT = "http://hastebin.com/documents";
|
||||||
|
private static final String HASTEBIN_PREFIX = "http://hastebin.com/";
|
||||||
|
|
||||||
|
private EditText logPreview;
|
||||||
|
private Button okButton;
|
||||||
|
private Button cancelButton;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.log_submit_activity);
|
||||||
|
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
initializeResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
new PopulateLogcatAsyncTask().execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
super.onOptionsItemSelected(item);
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeResources() {
|
||||||
|
logPreview = (EditText) findViewById(R.id.log_preview);
|
||||||
|
okButton = (Button) findViewById(R.id.ok);
|
||||||
|
cancelButton = (Button) findViewById(R.id.cancel);
|
||||||
|
|
||||||
|
okButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
new SubmitToPastebinAsyncTask(logPreview.getText().toString()).execute();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String grabLogcat() {
|
||||||
|
try {
|
||||||
|
Process process = Runtime.getRuntime().exec("logcat -d");
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(
|
||||||
|
new InputStreamReader(process.getInputStream()));
|
||||||
|
|
||||||
|
StringBuilder log = new StringBuilder();
|
||||||
|
String separator = System.getProperty("line.separator");
|
||||||
|
String line;
|
||||||
|
while ((line = bufferedReader.readLine()) != null) {
|
||||||
|
log.append(line);
|
||||||
|
log.append(separator);
|
||||||
|
}
|
||||||
|
return log.toString();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
Log.w(TAG, "IOException when trying to read logcat.", ioe);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PopulateLogcatAsyncTask extends AsyncTask<Void,Void,String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(Void... voids) {
|
||||||
|
return grabLogcat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
logPreview.setText(R.string.log_submit_activity__loading_logcat);
|
||||||
|
okButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String logcat) {
|
||||||
|
super.onPostExecute(logcat);
|
||||||
|
if (TextUtils.isEmpty(logcat)) {
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__log_fetch_failed, Toast.LENGTH_LONG).show();
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logPreview.setText(logcat);
|
||||||
|
okButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SubmitToPastebinAsyncTask extends AsyncTask<Void,Void,String> {
|
||||||
|
private ProgressDialog progressDialog;
|
||||||
|
private final String paste;
|
||||||
|
|
||||||
|
public SubmitToPastebinAsyncTask(String paste) {
|
||||||
|
this.paste = paste;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(Void... voids) {
|
||||||
|
HttpURLConnection urlConnection = null;
|
||||||
|
try {
|
||||||
|
URL url = new URL(HASTEBIN_ENDPOINT);
|
||||||
|
urlConnection = (HttpURLConnection) url.openConnection();
|
||||||
|
urlConnection.setDoOutput(true);
|
||||||
|
urlConnection.setFixedLengthStreamingMode(paste.length());
|
||||||
|
urlConnection.setReadTimeout(10000);
|
||||||
|
urlConnection.connect();
|
||||||
|
|
||||||
|
OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());
|
||||||
|
out.write(paste.getBytes());
|
||||||
|
out.flush();
|
||||||
|
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
|
||||||
|
|
||||||
|
Type type = new TypeToken<Map<String, String>>(){}.getType();
|
||||||
|
Map<String, String> responseMap = new Gson().fromJson(new InputStreamReader(in), type);
|
||||||
|
|
||||||
|
if (responseMap.containsKey("key"))
|
||||||
|
return HASTEBIN_PREFIX + responseMap.get("key");
|
||||||
|
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
Log.w(TAG, "Failed to execute POST request to pastebin", ioe);
|
||||||
|
} catch (JsonSyntaxException jpe) {
|
||||||
|
Log.w(TAG, "JSON returned wasn't a valid expected map", jpe);
|
||||||
|
} catch (JsonIOException jioe) {
|
||||||
|
Log.w(TAG, "JSON IOException when trying to read the stream from connection", jioe);
|
||||||
|
} finally {
|
||||||
|
if (urlConnection != null) urlConnection.disconnect();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
progressDialog = new ProgressDialog(LogSubmitActivity.this);
|
||||||
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||||
|
progressDialog.setCancelable(false);
|
||||||
|
progressDialog.setIndeterminate(true);
|
||||||
|
progressDialog.setTitle("Submitting");
|
||||||
|
progressDialog.setMessage("Posting logs to pastebin...");
|
||||||
|
progressDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(final String response) {
|
||||||
|
super.onPostExecute(response);
|
||||||
|
progressDialog.dismiss();
|
||||||
|
|
||||||
|
if (response != null && !response.startsWith("Bad API request")) {
|
||||||
|
TextView showText = new TextView(LogSubmitActivity.this);
|
||||||
|
showText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
|
||||||
|
showText.setPadding(15, 30, 15, 30);
|
||||||
|
showText.setText(getString(R.string.log_submit_activity__your_pastebin_url, response));
|
||||||
|
showText.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
// Copy the Text to the clipboard
|
||||||
|
ClipboardManager manager =
|
||||||
|
(ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
manager.setText(response);
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__copied_to_clipboard,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(LogSubmitActivity.this);
|
||||||
|
builder.setTitle(R.string.log_submit_activity__log_submit_success_title)
|
||||||
|
.setView(showText)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setNeutralButton(R.string.log_submit_activity__log_got_it, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
dialogInterface.dismiss();
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__thanks, Toast.LENGTH_LONG).show();
|
||||||
|
LogSubmitActivity.this.setResult(RESULT_OK);
|
||||||
|
LogSubmitActivity.this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
} else {
|
||||||
|
if (response == null) {
|
||||||
|
Log.w(TAG, "Response was null from Pastebin API.");
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Response seemed like an error: " + response);
|
||||||
|
}
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.log_submit_activity__log_fetch_failed, Toast.LENGTH_LONG).show();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -24,7 +25,13 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
||||||
|
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
@ -46,6 +53,31 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
initializeResources();
|
initializeResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = this.getSupportMenuInflater();
|
||||||
|
menu.clear();
|
||||||
|
|
||||||
|
inflater.inflate(R.menu.log_submit, menu);
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
super.onOptionsItemSelected(item);
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.menu_submit_debug_logs: handleLogSubmit(); return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleLogSubmit() {
|
||||||
|
Intent intent = new Intent(this, LogSubmitActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
Button okButton = (Button) findViewById(R.id.ok_button);
|
Button okButton = (Button) findViewById(R.id.ok_button);
|
||||||
passphraseText = (EditText)findViewById(R.id.passphrase_edit);
|
passphraseText = (EditText)findViewById(R.id.passphrase_edit);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user