mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Move send action from FAB into toolbar
This commit is contained in:
@@ -118,19 +118,5 @@
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/share_dev_report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="@dimen/margin_large"
|
||||
android:layout_marginEnd="@dimen/margin_large"
|
||||
android:layout_marginRight="@dimen/margin_large"
|
||||
android:background="@color/briar_accent"
|
||||
android:src="@drawable/social_share"
|
||||
android:tint="@color/action_bar_text"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
12
briar-android/res/menu/dev_report_actions.xml
Normal file
12
briar-android/res/menu/dev_report_actions.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_send_report"
|
||||
android:icon="@drawable/social_send_now_white"
|
||||
android:title="@string/send_report"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
||||
@@ -11,6 +11,7 @@
|
||||
<string name="debug_report">Debug report:</string>
|
||||
<string name="include_debug_report">Include debug report?</string>
|
||||
<string name="could_not_load_report_data">Could not load report data.</string>
|
||||
<string name="send_report">Send report</string>
|
||||
<string name="dev_report_saved">Report saved. It will be sent the next time you log into Briar.</string>
|
||||
<string name="ongoing_notification_title">Signed into Briar</string>
|
||||
<string name="ongoing_notification_text">Touch to open Briar.</string>
|
||||
|
||||
@@ -10,8 +10,10 @@ import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
@@ -78,7 +80,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
private View chevron = null;
|
||||
private LinearLayout report = null;
|
||||
private View progress = null;
|
||||
private View share = null;
|
||||
private MenuItem sendReport = null;
|
||||
private boolean reviewing = false;
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
@@ -118,7 +120,6 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
chevron = findViewById(R.id.chevron);
|
||||
report = (LinearLayout) findViewById(R.id.report_content);
|
||||
progress = findViewById(R.id.progress_wheel);
|
||||
share = findViewById(R.id.share_dev_report);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
getDelegate().getSupportActionBar().setTitle(
|
||||
@@ -140,12 +141,6 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
report.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
share.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
processReport();
|
||||
}
|
||||
});
|
||||
|
||||
String userEmail = prefs.getString(ACRA.PREF_USER_EMAIL_ADDRESS, "");
|
||||
userEmailView.setText(userEmail);
|
||||
@@ -173,6 +168,31 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu items for use in the action bar
|
||||
MenuInflater inflater = getDelegate().getMenuInflater();
|
||||
inflater.inflate(R.menu.dev_report_actions, menu);
|
||||
sendReport = menu.findItem(R.id.action_send_report);
|
||||
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
case R.id.action_send_report:
|
||||
processReport();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
@@ -305,7 +325,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
private void processReport() {
|
||||
userCommentView.setEnabled(false);
|
||||
userEmailView.setEnabled(false);
|
||||
share.setEnabled(false);
|
||||
sendReport.setEnabled(false);
|
||||
progress.setVisibility(VISIBLE);
|
||||
final boolean includeReport =
|
||||
!isFeedback() || includeDebugReport.isChecked();
|
||||
|
||||
Reference in New Issue
Block a user