Remove intermediate activity classes
This commit is contained in:
parent
c5a637de78
commit
65fb876c5e
@ -50,7 +50,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class ActivityUi extends BaseUi {
|
||||
|
||||
private int layoutId;
|
||||
private final int layoutId;
|
||||
|
||||
@Nonnull
|
||||
private Preferences.Gui.Theme theme = Preferences.Gui.Theme.material_theme;
|
||||
@ -267,10 +267,6 @@ public class ActivityUi extends BaseUi {
|
||||
}
|
||||
}
|
||||
|
||||
public void setLayoutId(int layoutId) {
|
||||
this.layoutId = layoutId;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Language getLanguage() {
|
||||
return language;
|
||||
|
@ -18,16 +18,12 @@ public class BaseActivity extends AppCompatActivity {
|
||||
@Nonnull
|
||||
protected final ActivityUi ui;
|
||||
|
||||
public BaseActivity(@Nonnull ActivityUi ui) {
|
||||
this.ui = ui;
|
||||
public BaseActivity() {
|
||||
this(R.layout.main_empty);
|
||||
}
|
||||
|
||||
public BaseActivity(@LayoutRes int layout) {
|
||||
this(layout, "Activity");
|
||||
}
|
||||
|
||||
public BaseActivity(@LayoutRes int layout, @Nonnull String logTag) {
|
||||
this.ui = new ActivityUi(layout, logTag);
|
||||
this.ui = new ActivityUi(layout, getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -62,8 +62,6 @@ import static org.solovyev.android.wizard.WizardUi.*;
|
||||
|
||||
public class CalculatorActivity extends BaseActivity implements SharedPreferences.OnSharedPreferenceChangeListener, Toolbar.OnMenuItemClickListener {
|
||||
|
||||
@Nonnull
|
||||
public static final String TAG = CalculatorActivity.class.getSimpleName();
|
||||
@Inject
|
||||
PreferredPreferences preferredPreferences;
|
||||
@Inject
|
||||
@ -89,7 +87,7 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
|
||||
private boolean useBackAsPrev;
|
||||
|
||||
public CalculatorActivity() {
|
||||
super(0, TAG);
|
||||
super(R.layout.activity_main);
|
||||
}
|
||||
|
||||
private static void firstTimeInit(@Nonnull SharedPreferences preferences, @Nonnull Context context) {
|
||||
@ -163,8 +161,6 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
ui.setLayoutId(R.layout.activity_main);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
public abstract class EmptyActivity extends BaseActivity {
|
||||
|
||||
protected EmptyActivity() {
|
||||
this(R.layout.main_empty);
|
||||
}
|
||||
|
||||
protected EmptyActivity(int layoutResId) {
|
||||
super(layoutResId);
|
||||
}
|
||||
}
|
@ -23,14 +23,13 @@
|
||||
package org.solovyev.android.calculator.about;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.solovyev.android.calculator.BaseActivity;
|
||||
import org.solovyev.android.calculator.FragmentTab;
|
||||
import org.solovyev.android.calculator.EmptyActivity;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AboutActivity extends EmptyActivity {
|
||||
public class AboutActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -34,10 +34,6 @@ public class FunctionsActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_FUNCTION = "function";
|
||||
|
||||
public FunctionsActivity() {
|
||||
super(R.layout.main_empty, FunctionsActivity.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -34,10 +34,6 @@ import static org.solovyev.android.calculator.FragmentTab.saved_history;
|
||||
|
||||
public class HistoryActivity extends BaseActivity {
|
||||
|
||||
public HistoryActivity() {
|
||||
super(R.layout.main_empty, HistoryActivity.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -23,19 +23,13 @@
|
||||
package org.solovyev.android.calculator.matrix;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.solovyev.android.calculator.BaseActivity;
|
||||
import org.solovyev.android.calculator.FragmentTab;
|
||||
import org.solovyev.android.calculator.EmptyActivity;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import static android.support.v7.app.ActionBar.NAVIGATION_MODE_STANDARD;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 12.10.12
|
||||
* Time: 10:56
|
||||
*/
|
||||
public class CalculatorMatrixActivity extends EmptyActivity {
|
||||
public class CalculatorMatrixActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -25,16 +25,11 @@ package org.solovyev.android.calculator.operators;
|
||||
import android.os.Bundle;
|
||||
import org.solovyev.android.calculator.BaseActivity;
|
||||
import org.solovyev.android.calculator.FragmentTab;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class OperatorsActivity extends BaseActivity {
|
||||
|
||||
public OperatorsActivity() {
|
||||
super(R.layout.main_empty, OperatorsActivity.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -25,7 +25,6 @@ package org.solovyev.android.calculator.variables;
|
||||
import android.os.Bundle;
|
||||
import org.solovyev.android.calculator.BaseActivity;
|
||||
import org.solovyev.android.calculator.FragmentTab;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -33,10 +32,6 @@ public class VariablesActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_VARIABLE = "variable";
|
||||
|
||||
public VariablesActivity() {
|
||||
super(R.layout.main_empty, VariablesActivity.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
Loading…
Reference in New Issue
Block a user