Layouts
This commit is contained in:
@@ -71,28 +71,28 @@ public final class CalculatorButtons {
|
||||
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
|
||||
final Display display = activity.getWindowManager().getDefaultDisplay();
|
||||
|
||||
final DragButton button = (DragButton)activity.findViewById(R.id.equalsButton);
|
||||
if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
|
||||
button.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 1f));
|
||||
if (display.getWidth() <= 480) {
|
||||
// mobile phones
|
||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||
if (calculatorDisplayView != null) {
|
||||
calculatorDisplayView.setBackgroundDrawable(null);
|
||||
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.equalsButton);
|
||||
if (equalsButton != null) {
|
||||
if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
|
||||
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 1f));
|
||||
if (display.getWidth() <= 480) {
|
||||
// mobile phones
|
||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||
if (calculatorDisplayView != null) {
|
||||
calculatorDisplayView.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
button.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 0f));
|
||||
if (display.getWidth() <= 480) {
|
||||
// mobile phones
|
||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||
if (calculatorDisplayView != null) {
|
||||
calculatorDisplayView.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.equals9));
|
||||
} else {
|
||||
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 0f));
|
||||
if (display.getWidth() <= 480) {
|
||||
// mobile phones
|
||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||
if (calculatorDisplayView != null) {
|
||||
calculatorDisplayView.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.equals9));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processButtons(false, theme, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,33 +1,66 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 25.09.12
|
||||
* Time: 12:03
|
||||
*/
|
||||
public class CalculatorDisplayFragment extends SherlockFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.calc_display, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setDisplay(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
}
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 25.09.12
|
||||
* Time: 12:03
|
||||
*/
|
||||
public class CalculatorDisplayFragment extends SherlockFragment {
|
||||
|
||||
@NotNull
|
||||
private final CalculatorFragmentHelper fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_display, R.string.result);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
fragmentHelper.onCreate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return fragmentHelper.onCreateView(this, inflater, container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View root, Bundle savedInstanceState) {
|
||||
super.onViewCreated(root, savedInstanceState);
|
||||
|
||||
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setDisplay(getActivity());
|
||||
|
||||
fragmentHelper.onViewCreated(this, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
fragmentHelper.onResume(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
fragmentHelper.onPause(this);
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
fragmentHelper.onDestroy(this);
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
@@ -20,14 +20,14 @@ public interface CalculatorFragmentHelper {
|
||||
|
||||
void onCreate(@NotNull Fragment fragment);
|
||||
|
||||
void onResume(@NotNull Fragment fragment);
|
||||
|
||||
void onPause(@NotNull Fragment fragment);
|
||||
|
||||
@NotNull
|
||||
View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container);
|
||||
|
||||
void onViewCreated(@NotNull Fragment fragment, @NotNull View root);
|
||||
|
||||
void onResume(@NotNull Fragment fragment);
|
||||
|
||||
void onPause(@NotNull Fragment fragment);
|
||||
|
||||
void onDestroy(@NotNull Fragment fragment);
|
||||
}
|
||||
|
Reference in New Issue
Block a user