Example usage for android.widget LinearLayout startAnimation

List of usage examples for android.widget LinearLayout startAnimation

Introduction

In this page you can find the example usage for android.widget LinearLayout startAnimation.

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:de.gebatzens.ggvertretungsplan.fragment.SubstFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    bundle = ((MainActivity) getActivity()).savedState;
    mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
    mGGFrag = new SubstAdapter(this, savedInstanceState, (MainActivity) getActivity());
    if (bundle != null) {
        mGGFrag.heute.spinnerPos = bundle.getInt("ggvp_frag_today_spinner");
        mGGFrag.morgen.spinnerPos = bundle.getInt("ggvp_frag_tomorrow_spinner");
    }/* w  w  w .  ja v a 2  s  .  c o  m*/
    mViewPager.setAdapter(mGGFrag);
    mViewPager.setOffscreenPageLimit(3);
    if (bundle != null)
        mViewPager.setCurrentItem(bundle.getInt("ggvp_tab"));

    mToolbar = (Toolbar) ((MainActivity) this.getActivity()).mToolbar;
    ColorDrawable mToolbarColor = (ColorDrawable) mToolbar.getBackground();
    int mToolbarColorId = mToolbarColor.getColor();

    mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    mSlidingTabLayout.setBackgroundColor(mToolbarColorId);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        mSlidingTabLayout.setPadding(toPixels(48), 0, toPixels(48), 0);
    } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        mSlidingTabLayout.setPadding(toPixels(8), 0, toPixels(8), 0);
    }
    mSlidingTabLayout.setViewPager(mViewPager);

    swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.refresh);
    // Setup refresh listener which triggers new data loading
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            GGApp.GG_APP.refreshAsync(new Runnable() {
                @Override
                public void run() {
                    swipeContainer.post(new Runnable() {
                        @Override
                        public void run() {
                            swipeContainer.setRefreshing(false);
                        }
                    });

                }
            }, true, GGApp.FragmentType.PLAN);
        }
    });
    // Configure the refreshing colors
    swipeContainer.setColorSchemeResources(R.color.custom_material_green, R.color.custom_material_red,
            R.color.custom_material_blue, R.color.custom_material_orange);

    FrameLayout contentFrame = (FrameLayout) getActivity().findViewById(R.id.content_fragment);
    contentFrame.setVisibility(View.VISIBLE);
    LinearLayout fragmentLayout = (LinearLayout) getActivity().findViewById(R.id.fragment_layout);
    Animation fadeIn = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.fade_in);
    fragmentLayout.startAnimation(fadeIn);

}

From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java

@Override
public void onViewCreated(View v, Bundle b) {
    super.onViewCreated(v, b);

    if (GGApp.GG_APP.getDataForFragment(type) == null) {
        getContentView().addView(createLoadingView());
    }//from   w w  w .j  a  v  a  2 s  . c om

    FrameLayout contentFrame = (FrameLayout) getActivity().findViewById(R.id.content_fragment);
    contentFrame.setVisibility(View.VISIBLE);
    LinearLayout fragmentLayout = (LinearLayout) getActivity().findViewById(R.id.fragment_layout);
    Animation fadeIn = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.fade_in);
    fragmentLayout.startAnimation(fadeIn);

}

From source file:com.bhb27.isu.Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MainContext = this;

    LinearLayout layout = (LinearLayout) findViewById(R.id.MainLayout);
    AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setFillAfter(true);//from  www. j av a  2  s . c om
    animation.setDuration(750);
    layout.startAnimation(animation);

    suVersion = Tools.SuVersion(MainContext);
    isCMSU = SuVersionBool(suVersion);

    Runnable runSepolicy = new Runnable() {
        public void run() {
            Sepolicy();
            // Only run boot service if app was used and is CM SU
            if (isCMSU && !Tools.getBoolean("run_boot", false, MainContext))
                Tools.saveBoolean("run_boot", true, MainContext);
        }
    };
    new Thread(runSepolicy).start();

    suSwitch = (Switch) findViewById(R.id.suSwitch);
    SuSwitchSummary = (TextView) findViewById(R.id.SuSwitchSummary);
    SuStatus = (TextView) findViewById(R.id.SuStatus);
    su_version = (TextView) findViewById(R.id.su_version);
    su_version_summary = (TextView) findViewById(R.id.su_version_summary);
    su_version_summary.setText(suVersion);

    SelinuxSwitch = (Switch) findViewById(R.id.SelinuxSwitch);
    SelinuxStatus = (TextView) findViewById(R.id.SelinuxStatus);
    Selinux_State = (TextView) findViewById(R.id.Selinux_State);
    Selinux_State.setText(Tools.getSELinuxStatus());

    iSuNotification = (Switch) findViewById(R.id.iSuNotification);
    SuSelinuxSwitch = (Switch) findViewById(R.id.SuSelinuxSwitch);
    SuSelinuxSwitchSummary = (TextView) findViewById(R.id.SuSelinuxSwitchSummary);

    per_app = (Button) findViewById(R.id.buttonPer_app);
    per_app_summary = (TextView) findViewById(R.id.per_app);

    download_folder_link = (TextView) findViewById(R.id.download_folder_link);
    kernel_check = (TextView) findViewById(R.id.kernel_check);
    // about button
    about = (Button) findViewById(R.id.buttonAbout);
    about.setOnClickListener(new View.OnClickListener() {
        Intent myIntent = new Intent(getApplicationContext(), AboutActivity.class);

        @Override
        public void onClick(View v) {
            startActivity(myIntent);
        }
    });

    ic_launcher = (ImageView) findViewById(R.id.ic_launcher);
    ic_launcher.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Tools.DoAToast(getString(R.string.isu_by), MainContext);
        }
    });

    //reboot support check
    if (RebootSupport()) {
        kernel_check.setText(getString(R.string.isu_reboot));
        download_folder_link.setVisibility(View.GONE);
    } else if (Tools.KernelSupport()) {
        kernel_check.setText(getString(R.string.isu_kernel_good));
        download_folder_link.setVisibility(View.GONE);
    } else {
        kernel_check.setTextColor(getColorWrapper(MainContext, R.color.colorAccent));
        kernel_check.setText(getString(R.string.isu_kernel_bad));
        download_folder_link.setText(getString(R.string.download_folder_link));
        download_folder_link.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://www.androidfilehost.com/?w=files&flid=120360")));
                } catch (ActivityNotFoundException ex) {
                    Tools.DoAToast(getString(R.string.no_browser), MainContext);
                }
            }
        });
    }
    UpdateMain(isCMSU);
}

From source file:pro.jariz.reisplanner.fragments.PlannerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    thisView = inflater.inflate(R.layout.fragment_planner, container, false);

    final SlidingFragmentActivity context = (SlidingFragmentActivity) this.getActivity();

    //make sure we've got some actionbar buttons
    setHasOptionsMenu(true);/*from w ww  . j  av a  2 s.c  om*/

    //context.getSupportMenuInflater().

    CheckBox extra = (CheckBox) thisView.findViewById(R.id.extraOptions);
    extra.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            LinearLayout time = (LinearLayout) thisView.findViewById(R.id.time);
            LinearLayout date = (LinearLayout) thisView.findViewById(R.id.date);
            if (isChecked) {
                time.setVisibility(View.VISIBLE);
                date.setVisibility(View.VISIBLE);
                Animation anim = AnimationUtils.loadAnimation(context, R.anim.fadein);
                time.startAnimation(anim);
                date.startAnimation(anim);
            } else {
                time.setVisibility(View.GONE);
                date.setVisibility(View.GONE);
                //Animation anim = AnimationUtils.loadAnimation(context, R.anim.fadeout);

                //time.startAnimation(anim);
                //date.startAnimation(anim);
            }
        }
    });

    context.getSupportActionBar().setTitle("Planner");

    Time time = new Time();
    time.setToNow();

    Integer lastCacheTime = DB.getLastCacheTime("stations");

    Time difference = new Time();
    difference.set(time.toMillis(true) - lastCacheTime);

    //no stations present or cache is outdated? refresh.
    if (DB.getStationCount() == 0 || (lastCacheTime != 0 && difference.monthDay >= 10)) {
        Crouton.showText(context, getResources().getString(R.string.updating_station_list),
                CroutonStyles.infoStyle);

        new NSTask(this).execute(NSTask.TYPE_STATIONS);
    } else {
        //cache time!
        new NSTask(this).execute(NSTask.TYPE_STATIONS_DB);
    }

    return thisView;
}

From source file:com.fa.imaged.activity.DetailActivityV2.java

/**
 * Load the item's image into our {@link ImageView}.
 *//*from w  ww. jav a  2  s  .  c  o  m*/
private void loadImage() {

    Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).noFade()
            .placeholder(android.R.color.background_light).into(detailImageV2, new Callback() {

                @Override
                public void onError() {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess() {
                    Bitmap bitmap = ((BitmapDrawable) detailImageV2.getDrawable()).getBitmap();
                    Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
                        @Override
                        public void onGenerated(Palette palette) {
                            Palette.Swatch vibrant = palette.getVibrantSwatch();
                            if (vibrant != null) {
                                // If we have a vibrant color
                                // update the title TextView
                                detailUserInfo.setBackgroundColor(vibrant.getRgb());
                            }
                        }
                    });

                    Picasso.with(getApplicationContext()).load(detailImageLoaderv2.standard_resolution).noFade()
                            .placeholder(detailImageV2.getDrawable()).into(detailImageV2);
                    LinearLayout detailSlideUp = (LinearLayout) findViewById(R.id.detail_slide_up);
                    detailSlideUp.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
                            android.support.v7.appcompat.R.anim.abc_slide_in_bottom));
                    if (detailImageLoaderv2.video) {
                        PlayVideo();
                    }
                }

            });
}

From source file:sjizl.com.FileUploadTest.java

public void do_animation_top(LinearLayout left_button) {

    float px = dipToPixels(getBaseContext(), -30);
    Animation animation1 = new TranslateAnimation(0, 0, -50, 0);
    animation1.setDuration(1000);/*from   www.j  av a 2 s. c  o  m*/

    animation1.setFillEnabled(true);
    animation1.setFillAfter(true);

    left_button.startAnimation(animation1);

}

From source file:com.ridhofkr.hanacaraka.LetterCardActivity.java

private void applyRotation(float start, float end, LinearLayout front, LinearLayout back, boolean flag) {
    final float centerX = front.getWidth() / 2.0f;
    final float centerY = front.getHeight() / 2.0f;

    final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end, centerX, centerY, 310.0f, true);
    rotation.setDuration(300);/*w w w .  ja  v a2  s  .  co m*/
    rotation.setFillAfter(true);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(new DisplayNextView(flag, front, back));

    LinearLayout inside = (LinearLayout) back.findViewById(R.id.backcardinside);
    if (flag) {
        String text = ((String) ((TextView) front.findViewById(R.id.cardinfotitle)).getText());
        front.startAnimation(rotation);
        removeSoundListener(front);
        inside.addView(ctrl.playAnimation(LetterCardActivity.this, text, category));
    } else {
        back.startAnimation(rotation);
        addSoundListener(front);
        inside.removeViewAt(2);
    }
}

From source file:com.initiativaromania.hartabanilorpublici.IRUserInterface.activities.MainActivity.java

private void initTransparentView() {

    /* Avoid displaying infographic if the home button has been pushed */
    Intent intent = getIntent();/*from   w w w  .  jav  a 2  s .  co  m*/
    displayInfographic = intent.getBooleanExtra(EXTRA_DISPLAY_INFOGRAPHIC, true);
    System.out.println("Display info " + displayInfographic);
    if (!displayInfographic) {
        LinearLayout linear = (LinearLayout) findViewById(R.id.transparentLayer);
        linear.setVisibility(View.INVISIBLE);
        return;
    }

    /* Setup the OK button */
    Button okButton = (Button) findViewById(R.id.okButton);
    if (okButton != null) {
        okButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                System.out.println("OK button pushed");

                Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_down);
                LinearLayout linear = (LinearLayout) findViewById(R.id.transparentLayer);
                linear.startAnimation(animation);
                linear.setVisibility(View.INVISIBLE);

                Toast toast = Toast.makeText(getBaseContext(), "Apasa pe simbolurile  din jurul tau",
                        Toast.LENGTH_LONG);
                toast.setGravity(Gravity.CENTER | Gravity.CENTER_HORIZONTAL, 0, 0);
                toast.show();

                /* Display initial seek bar value */
                Rect thumbRect = seekBar.getThumb().getBounds();
                seekBarValue.setX(thumbRect.exactCenterX());
                DecimalFormat dm = new DecimalFormat("###,###.###");
                seekBarValue.setText(" " + String.valueOf(dm.format(CommManager.aroundTotalSum)) + " EURO ");
                seekBarValue.setVisibility(View.VISIBLE);
                seekBarValue.startAnimation(animationFadeIn);
            }
        });
    }

    /* Send request to get the init data */
    CommManager.requestInitData(new ICommManagerResponse() {
        @Override
        public void processResponse(JSONObject response) {
            MainActivity.this.receiveInitData(response);
        }

        @Override
        public void onErrorOccurred(String errorMsg) {
            Toast.makeText(MainActivity.this, "Eroare conectare la server", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:fm.krui.kruifm.StreamFragment.java

/**
 * Moves the stream status bar into view to show messages regarding stream status. Use indefinite time constraints
 * @param message String to display in the status bar.
 * @param isIndefinite true if the message should be displayed until explicitly cancelled by a broadcast message.
 *///  ww w  .j a  va  2  s .  co m
public void showStreamStatusBar(String message, boolean isIndefinite) {
    final LinearLayout statusContainer = (LinearLayout) getActivity()
            .findViewById(R.id.stream_status_container_linearlayout);
    // Apply label text, then bring the status bar into view
    TextView statusLabel = (TextView) getActivity().findViewById(R.id.stream_status_label_textview);
    statusLabel.setText(message);
    statusContainer.setVisibility(View.VISIBLE);

    // Construct translation animations from xml.
    final Animation animIn = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_up);
    final Animation animOut = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_down);
    statusContainer.startAnimation(animIn);

    if (!isIndefinite) {

        // When fade in is completed, trigger a fade out animation.
        animIn.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                animOut.setStartOffset(1200);
                statusContainer.startAnimation(animOut);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });

        // When the animation has completely faded out, hide its parent container
        animOut.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                statusContainer.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }
}

From source file:fm.krui.kruifm.StreamActivity.java

/**
 * Moves the stream status bar into view to show messages regarding stream status. Use indefinite time constraints
 * @param message String to display in the status bar.
 * @param isIndefinite true if the message should be displayed until explicitly cancelled by a broadcast message.
 *///from w  w  w .j ava 2 s  . c om
public void showStreamStatusBar(String message, boolean isIndefinite) {
    final LinearLayout statusContainer = (LinearLayout) this
            .findViewById(R.id.stream_status_container_linearlayout);
    // Apply label text, then bring the status bar into view
    TextView statusLabel = (TextView) this.findViewById(R.id.stream_status_label_textview);
    statusLabel.setText(message);
    statusContainer.setVisibility(View.VISIBLE);

    // Construct translation animations from xml.
    final Animation animIn = AnimationUtils.loadAnimation(this, R.anim.translate_up);
    final Animation animOut = AnimationUtils.loadAnimation(this, R.anim.translate_down);
    statusContainer.startAnimation(animIn);

    if (!isIndefinite) {

        // When fade in is completed, trigger a fade out animation.
        animIn.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                animOut.setStartOffset(1200);
                statusContainer.startAnimation(animOut);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });

        // When the animation has completely faded out, hide its parent container
        animOut.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                statusContainer.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }
}