diff --git a/briar-android/AndroidManifest.xml b/briar-android/AndroidManifest.xml index 702e7e6976c6f524859ff2561788bfb2b2ef643d..7c7be67ccf058750432d5fcc45783b43e073ac03 100644 --- a/briar-android/AndroidManifest.xml +++ b/briar-android/AndroidManifest.xml @@ -51,7 +51,8 @@ android:finishOnTaskLaunch="true" android:label="@string/crash_report_title" android:launchMode="singleInstance" - android:process=":briar_error_handler"> + android:process=":briar_error_handler" + android:theme="@style/BriarThemeNoActionBar.Default"> </activity> <activity diff --git a/briar-android/res/layout/activity_dev_report.xml b/briar-android/res/layout/activity_dev_report.xml index b8bb74b12cca3dd3863da8c7c7ce6329a9c17cab..37fac97b85a428f35d03bb07a45fa069d1c9a427 100644 --- a/briar-android/res/layout/activity_dev_report.xml +++ b/briar-android/res/layout/activity_dev_report.xml @@ -4,20 +4,14 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + tools:context=".android.report.DevReportActivity"> <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" style="@style/BriarToolbar" android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/title" - style="@style/TextAppearance.AppCompat.Large.Inverse" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:text="@string/crash_report_title"/> - </android.support.v7.widget.Toolbar> + android:layout_height="wrap_content"/> <RelativeLayout android:layout_width="match_parent" diff --git a/briar-android/src/org/briarproject/android/report/DevReportActivity.java b/briar-android/src/org/briarproject/android/report/DevReportActivity.java index 3419920a82931c00214a159ee85342bdbd777a2b..26dcaafae081bc91e2da028901aec739d0e58726 100644 --- a/briar-android/src/org/briarproject/android/report/DevReportActivity.java +++ b/briar-android/src/org/briarproject/android/report/DevReportActivity.java @@ -2,10 +2,13 @@ package org.briarproject.android.report; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; 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.View; import android.view.View.OnClickListener; @@ -66,6 +69,7 @@ public class DevReportActivity extends BaseCrashReportDialog requiredFields.add(STACK_TRACE); } + private AppCompatDelegate delegate; private SharedPreferencesFactory sharedPreferencesFactory; private Set<ReportField> excludedFields; private EditText userCommentView = null; @@ -77,11 +81,20 @@ public class DevReportActivity extends BaseCrashReportDialog private View share = null; private boolean reviewing = false; + private AppCompatDelegate getDelegate() { + if (delegate == null) { + delegate = AppCompatDelegate.create(this, null); + } + return delegate; + } + @Override public void onCreate(Bundle state) { + getDelegate().installViewFactory(); + getDelegate().onCreate(state); super.onCreate(state); - setContentView(R.layout.activity_dev_report); + getDelegate().setContentView(R.layout.activity_dev_report); sharedPreferencesFactory = new SharedPreferencesFactory( getApplicationContext(), getConfig()); @@ -95,7 +108,9 @@ public class DevReportActivity extends BaseCrashReportDialog } } - TextView title = (TextView) findViewById(R.id.title); + Toolbar tb = (Toolbar) findViewById(R.id.toolbar); + getDelegate().setSupportActionBar(tb); + userCommentView = (EditText) findViewById(R.id.user_comment); userEmailView = (EditText) findViewById(R.id.user_email); TextView debugReport = (TextView) findViewById(R.id.debug_report); @@ -105,8 +120,10 @@ public class DevReportActivity extends BaseCrashReportDialog progress = findViewById(R.id.progress_wheel); share = findViewById(R.id.share_dev_report); - title.setText(isFeedback() ? R.string.feedback_title : - R.string.crash_report_title); + //noinspection ConstantConditions + getDelegate().getSupportActionBar().setTitle( + isFeedback() ? R.string.feedback_title : + R.string.crash_report_title); userCommentView.setHint(isFeedback() ? R.string.enter_feedback : R.string.describe_crash); @@ -137,6 +154,12 @@ public class DevReportActivity extends BaseCrashReportDialog reviewing = state.getBoolean(STATE_REVIEWING, false); } + @Override + public void onPostCreate(Bundle state) { + super.onPostCreate(state); + getDelegate().onPostCreate(state); + } + @Override public void onResume() { super.onResume(); @@ -144,12 +167,42 @@ public class DevReportActivity extends BaseCrashReportDialog if (chevron.isSelected()) refresh(); } + @Override + protected void onPostResume() { + super.onPostResume(); + getDelegate().onPostResume(); + } + + @Override + public void onTitleChanged(CharSequence title, int color) { + super.onTitleChanged(title, color); + getDelegate().setTitle(title); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + getDelegate().onConfigurationChanged(newConfig); + } + @Override public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putBoolean(STATE_REVIEWING, reviewing); } + @Override + public void onStop() { + super.onStop(); + getDelegate().onStop(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + getDelegate().onDestroy(); + } + @Override public void onBackPressed() { closeReport();