Action bar is shown in the Settings again

This commit is contained in:
serso
2015-01-28 21:43:26 +01:00
parent 3be5a66012
commit 070d0a12d1
4 changed files with 59 additions and 1 deletions

View File

@@ -3,7 +3,11 @@ package org.solovyev.android.calculator.preferences;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import org.solovyev.android.calculator.ActivityUi;
import org.solovyev.android.calculator.AdView;
import org.solovyev.android.calculator.App;
@@ -20,15 +24,36 @@ public abstract class BasePreferencesActivity extends PreferenceActivity {
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
private Inventory inventory;
private AdView adView;
private Toolbar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
actionBar.setTitle(getTitle());
checkout.start();
inventory = checkout.loadInventory();
}
@Override
public void setContentView(int layout) {
final ViewGroup contentView = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.cpp_activity_settings, new LinearLayout(this), true);
actionBar = (Toolbar) contentView.findViewById(R.id.action_bar);
actionBar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
final ViewGroup contentWrapper = (ViewGroup) contentView.findViewById(R.id.content_wrapper);
LayoutInflater.from(this).inflate(layout, contentWrapper, true);
getWindow().setContentView(contentView);
}
private class InventoryListener implements Inventory.Listener {
@Override