1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 09:00:31 +00:00

add title to activitys

This commit is contained in:
Christian Schabesberger 2016-05-25 23:51:22 +02:00
parent f23ae091cc
commit 685eebeb56
4 changed files with 26 additions and 10 deletions

View File

@ -11,6 +11,7 @@ import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -165,7 +166,15 @@ public class ErrorActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_error); 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(); ActivityCommunicator ac = ActivityCommunicator.getCommunicator();
errorList = ac.errorList; errorList = ac.errorList;

View File

@ -56,7 +56,10 @@ public class SettingsActivity extends PreferenceActivity {
getDelegate().onCreate(savedInstanceBundle); getDelegate().onCreate(savedInstanceBundle);
super.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() getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment()) .replace(android.R.id.content, new SettingsFragment())

View File

@ -12,6 +12,7 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
@ -95,14 +96,14 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_downloader); setContentView(R.layout.activity_downloader);
try {
//noinspection ConstantConditions //noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true); // its ok if this failes, we will catch that error later, and send it as report
} catch(Exception e) { ActionBar actionBar = getSupportActionBar();
Log.d(TAG, "Could not get SupportActionBar"); actionBar.setDisplayHomeAsUpEnabled(true);
e.printStackTrace(); actionBar.setTitle(R.string.downloads_title);
} actionBar.setDisplayShowTitleEnabled(true);
mPrefs = getSharedPreferences("threads", Context.MODE_WORLD_READABLE); mPrefs = getSharedPreferences("threads", Context.MODE_WORLD_READABLE);

View File

@ -80,6 +80,9 @@
<string name="video_is_age_restricted">Video is Age restricted. Enable age restricted videos in the settings first.</string> <string name="video_is_age_restricted">Video is Age restricted. Enable age restricted videos in the settings first.</string>
<string name="duration_live">live</string> <string name="duration_live">live</string>
<string name="downloads">Downloads</string> <string name="downloads">Downloads</string>
<string name="downloads_title">Downloads</string>
<string name="settings_title">Settings</string>
<string name="error_report_title">Error report</string>
<!-- error strings --> <!-- error strings -->
<string name="general_error">Error</string> <string name="general_error">Error</string>