From 1c39b2b9e858524e55fa56c1e524226de1c36dae Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 22 Feb 2016 09:26:39 +0100 Subject: [PATCH] Use empty layout for activities without tabs --- .../android/calculator/BaseActivity.java | 7 +- .../preferences/PreferencesActivity.java | 14 +++- .../{activity_empty.xml => activity_tabs.xml} | 2 +- app/src/main/res/layout/activity_empty.xml | 43 ++----------- app/src/main/res/layout/activity_tabs.xml | 64 +++++++++++++++++++ 5 files changed, 87 insertions(+), 43 deletions(-) rename app/src/main/res/layout-land/{activity_empty.xml => activity_tabs.xml} (97%) create mode 100644 app/src/main/res/layout/activity_tabs.xml diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java index 149c416a..d48433c4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java @@ -1,23 +1,24 @@ package org.solovyev.android.calculator; +import static org.solovyev.android.calculator.App.cast; + import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.v7.app.AppCompatActivity; import android.view.KeyEvent; import android.view.MenuItem; + import org.solovyev.android.calculator.view.Tabs; import javax.annotation.Nonnull; -import static org.solovyev.android.calculator.App.cast; - public class BaseActivity extends AppCompatActivity { @Nonnull protected final ActivityUi ui; public BaseActivity() { - this(R.layout.activity_empty); + this(R.layout.activity_tabs); } public BaseActivity(@LayoutRes int layout) { diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java index 1eacd3dc..a24c3480 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java @@ -7,7 +7,13 @@ import android.os.Bundle; import android.support.annotation.StringRes; import android.support.annotation.XmlRes; import android.util.SparseArray; -import org.solovyev.android.calculator.*; + +import org.solovyev.android.calculator.ActivityUi; +import org.solovyev.android.calculator.App; +import org.solovyev.android.calculator.AppComponent; +import org.solovyev.android.calculator.BaseActivity; +import org.solovyev.android.calculator.Preferences; +import org.solovyev.android.calculator.R; import org.solovyev.android.checkout.ActivityCheckout; import org.solovyev.android.checkout.Billing; import org.solovyev.android.checkout.Checkout; @@ -16,8 +22,6 @@ import org.solovyev.android.checkout.Products; import javax.annotation.Nonnull; import javax.inject.Inject; -import static android.support.v7.app.ActionBar.NAVIGATION_MODE_STANDARD; - public class PreferencesActivity extends BaseActivity implements SharedPreferences.OnSharedPreferenceChangeListener { static final String EXTRA_PREFERENCE = "preference"; @@ -44,6 +48,10 @@ public class PreferencesActivity extends BaseActivity implements SharedPreferenc @Inject Products products; + public PreferencesActivity() { + super(R.layout.activity_empty); + } + @Nonnull static SparseArray getPreferences() { return preferences; diff --git a/app/src/main/res/layout-land/activity_empty.xml b/app/src/main/res/layout-land/activity_tabs.xml similarity index 97% rename from app/src/main/res/layout-land/activity_empty.xml rename to app/src/main/res/layout-land/activity_tabs.xml index dc12f1d4..c69c26f9 100644 --- a/app/src/main/res/layout-land/activity_empty.xml +++ b/app/src/main/res/layout-land/activity_tabs.xml @@ -43,7 +43,7 @@ - + android:orientation="vertical"> - - - - - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_tabs.xml b/app/src/main/res/layout/activity_tabs.xml new file mode 100644 index 00000000..9fcc5115 --- /dev/null +++ b/app/src/main/res/layout/activity_tabs.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file