Commit 5e2d33f1 authored by Luboš Horáček's avatar Luboš Horáček

Zimní obrazovky

parent 1d082d99
......@@ -23,7 +23,6 @@
android:id="@+id/newuseranim_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/newuseranim_balcony"
android:clickable="true" >
<RelativeLayout
......
......@@ -24,6 +24,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:id="@+id/screen_loader_background"
android:background="@drawable/screen_loader_background" >
<ImageView
......
......@@ -41,6 +41,7 @@ import cz.nic.tablexia.R;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.main.MainActivity;
import cz.nic.tablexia.menu.MenuActivity;
import cz.nic.tablexia.util.TimeUtils;
public class LoaderFragment extends Fragment {
private static final int LOADER_BACKGROUND_LAYOUT_ID = R.layout.screen_loader;
......@@ -65,6 +66,7 @@ public class LoaderFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
pageLayout = inflater.inflate(LOADER_BACKGROUND_LAYOUT_ID, null);
checkWinter(pageLayout);
displaySize = new Point();
display = getActivity().getWindowManager().getDefaultDisplay();
display.getSize(displaySize);
......@@ -73,6 +75,13 @@ public class LoaderFragment extends Fragment {
return pageLayout;
}
private void checkWinter(View loader) {
if (TimeUtils.isWinter()) {
View v = loader.findViewById(R.id.screen_loader_background);
v.setBackgroundResource(R.drawable.screen_loader_background_winter);
}
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
......
......@@ -56,6 +56,7 @@ import cz.nic.tablexia.R;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.menu.MenuActivity;
import cz.nic.tablexia.util.MediaPlayerHelper;
import cz.nic.tablexia.util.TimeUtils;
import cz.nic.tablexia.widget.RatioPositionSizeImageView;
import cz.nic.tablexia.widget.RatioPositionTextView;
......@@ -113,16 +114,20 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
pageLayout = (ViewGroup) inflater.inflate(NEWUSER_LAYOUT_BALCONY_ID, null);
pageLayout.setAnimationCacheEnabled(true);
pageLayout.setDrawingCacheEnabled(true);
handler = new Handler();
backgroundBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.newuseranim_balcony);
newspaperView = pageLayout.findViewById(R.id.newuseranim_newspaper);
pageLayout.setOnTouchListener(this);
newspaper = (ImageView) pageLayout.findViewById(R.id.newuseranim_newspaper_image);
newspaperView = pageLayout.findViewById(R.id.newuseranim_newspaper);
if (TimeUtils.isWinter()) {
newspaperView.setBackgroundResource(R.drawable.newuseranim_balcony_winter);
}
newspaperOpenOne = pageLayout.findViewById(R.id.newuseranim_newspaper_layout);
newspaperClosed = (ImageView) pageLayout.findViewById(R.id.newuseranim_newspaper_closed);
newspaperSlide1 = (ImageView) pageLayout.findViewById(R.id.newuseranim_newspaper_slide1);
......@@ -345,7 +350,7 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
MediaPlayerHelper.playSound("newuser/sfx/noviny_prilet.mp3", true, getActivity());
newspaperView.setVisibility(View.VISIBLE);
newspaper.setVisibility(View.VISIBLE);
newspaperView.setBackgroundResource((getResources().getIdentifier("newuseranim_balcony_blur", "drawable", "cz.nic.tablexia")));
  • Pozor na používání package name jako stringu @vtarantik

    • je z toho až runtimová chyba, takže se na to špatně přichází
    • přistupovat pomocí R.id.*
    • o package si případně říkat context.getPackageName()
Please register or sign in to reply
newspaperView.setBackgroundResource(TimeUtils.isWinter() ? R.drawable.newuseranim_balcony_blur_winter : R.drawable.newuseranim_balcony_blur);
AnimationSet animationSet = new AnimationSet(true);
......
package cz.nic.tablexia.util;
import java.util.Calendar;
public class TimeUtils {
public static boolean isWinter() {
Calendar c = Calendar.getInstance();
return ((c.get(Calendar.MONTH) > 10) || (c.get(Calendar.MONTH) < 2));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment