From 685eebeb56b33ea5e43aa888e6ad6331e5211de8 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 25 May 2016 23:51:22 +0200 Subject: [PATCH] add title to activitys --- .../java/org/schabi/newpipe/ErrorActivity.java | 11 ++++++++++- .../org/schabi/newpipe/SettingsActivity.java | 5 ++++- .../schabi/newpipe/download/MainActivity.java | 17 +++++++++-------- app/src/main/res/values/strings.xml | 3 +++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/ErrorActivity.java index 1c55b5b8c..95cede795 100644 --- a/app/src/main/java/org/schabi/newpipe/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ErrorActivity.java @@ -11,6 +11,7 @@ import android.os.Build; import android.preference.PreferenceManager; import android.support.design.widget.Snackbar; import android.support.v4.app.NavUtils; +import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; @@ -165,7 +166,15 @@ public class ErrorActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_error); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + try { + ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setTitle(R.string.error_report_title); + actionBar.setDisplayShowTitleEnabled(true); + } catch (Exception e) { + Log.e(TAG, "Error turing exception handling"); + e.printStackTrace(); + } ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); errorList = ac.errorList; diff --git a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java index 04b084154..316923c25 100644 --- a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java +++ b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java @@ -56,7 +56,10 @@ public class SettingsActivity extends PreferenceActivity { getDelegate().onCreate(savedInstanceBundle); super.onCreate(savedInstanceBundle); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setTitle(R.string.settings_title); + actionBar.setDisplayShowTitleEnabled(true); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) diff --git a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java index cf0af9eb8..034cb18e2 100644 --- a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java @@ -12,6 +12,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; import android.support.v4.app.NavUtils; +import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; @@ -95,14 +96,14 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte super.onCreate(savedInstanceState); setContentView(R.layout.activity_downloader); - try { - //noinspection ConstantConditions - - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } catch(Exception e) { - Log.d(TAG, "Could not get SupportActionBar"); - e.printStackTrace(); - } + + //noinspection ConstantConditions + + // its ok if this failes, we will catch that error later, and send it as report + ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setTitle(R.string.downloads_title); + actionBar.setDisplayShowTitleEnabled(true); mPrefs = getSharedPreferences("threads", Context.MODE_WORLD_READABLE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8eddb14e1..96d6708d2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -80,6 +80,9 @@ Video is Age restricted. Enable age restricted videos in the settings first. live Downloads + Downloads + Settings + Error report Error