Example usage for android.view.animation AlphaAnimation setDuration

List of usage examples for android.view.animation AlphaAnimation setDuration

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setDuration.

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

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 a2s  .c o  m
    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:com.aosijia.dragonbutler.ui.widget.ActionSheet.java

private Animation createAlphaInAnimation() {
    AlphaAnimation an = new AlphaAnimation(0, 1);
    an.setDuration(ALPHA_DURATION);
    return an;
}

From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java

private Animation createAlphaOutAnimation() {
    AlphaAnimation an = new AlphaAnimation(1, 0);
    an.setDuration(ALPHA_DURATION);
    an.setFillAfter(true);/*  w  ww.java 2 s.  co  m*/
    return an;
}

From source file:net.bither.fragment.hot.AddAddressHotHDMFragment.java

private void finalAnimation() {
    final int fadeDuration = 400;
    final int zoomDuration = 500;

    AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setDuration(fadeDuration);
    fadeOut.setFillAfter(true);//from  ww  w  .  j a v a2s .c  o  m
    vBg.startAnimation(fadeOut);
    tvHot.startAnimation(fadeOut);
    tvCold.startAnimation(fadeOut);
    tvServer.startAnimation(fadeOut);
    if (llSingularRunning.getVisibility() == View.VISIBLE) {
        llSingularRunning.startAnimation(fadeOut);
    }
    flContainer.postDelayed(new Runnable() {
        @Override
        public void run() {
            vBg.setVisibility(View.GONE);
            tvHot.setVisibility(View.INVISIBLE);
            tvCold.setVisibility(View.INVISIBLE);
            tvServer.setVisibility(View.INVISIBLE);

            int[] size = getCompactContainerSize();
            WrapLayoutParamsForAnimator animWrapper = new WrapLayoutParamsForAnimator(flContainer);
            ObjectAnimator animatorWidth = ObjectAnimator.ofInt(animWrapper, "width", size[0])
                    .setDuration(zoomDuration);
            ObjectAnimator animatorHeight = ObjectAnimator.ofInt(animWrapper, "height", size[1])
                    .setDuration(zoomDuration);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.playTogether(animatorWidth, animatorHeight);
            animatorSet.start();

            flContainer.postDelayed(new Runnable() {
                @Override
                public void run() {
                    Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.hdm_keychain_add_spin);
                    anim.setFillAfter(true);
                    flContainer.startAnimation(anim);

                    ArrayList<String> addresses = getAddresses();
                    Intent intent = new Intent();
                    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, addresses);
                    getActivity().setResult(Activity.RESULT_OK, intent);

                    flContainer.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (getActivity() != null) {
                                ((AddPrivateKeyActivity) getActivity()).save();
                            }
                        }
                    }, anim.getDuration());
                }
            }, zoomDuration);
        }
    }, fadeDuration);
}

From source file:com.duy.pascal.ui.debug.activities.DebugActivity.java

@WorkerThread
private void showPopupAt(final LineNumber lineNumber, final String msg) {
    mHandler.post(new Runnable() {
        @Override/*  w w  w.  j  av  a2  s. c  om*/
        public void run() {
            if (isFinishing())
                return;
            //get relative position of expression at edittext
            Point position = mCodeView.getDebugPosition(lineNumber.getLine(), lineNumber.getColumn(),
                    Gravity.TOP);
            DLog.d(TAG, "generate: " + position);
            dismissPopup();
            //create new popup
            PopupWindow window = new PopupWindow(DebugActivity.this);
            LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
            View container = inflater.inflate(R.layout.popup_expr_result, null);
            container.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
            int windowHeight = container.getMeasuredHeight();
            int windowWidth = container.getMeasuredWidth();

            window.setContentView(container);
            window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            window.setTouchable(true);
            window.setSplitTouchEnabled(true);
            window.setOutsideTouchable(true);

            window.showAtLocation(mCodeView, Gravity.NO_GRAVITY, position.x - windowWidth / 3,
                    position.y + toolbar.getHeight() - windowHeight);

            TextView txtResult = container.findViewById(R.id.txt_result);
            txtResult.setText(msg);
            AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.5f);
            alphaAnimation.setDuration(1000);
            alphaAnimation.setRepeatMode(Animation.REVERSE);
            alphaAnimation.setRepeatCount(Animation.INFINITE);
            txtResult.startAnimation(alphaAnimation);
            DebugActivity.this.mPopupWindow = window;
        }
    });
}

From source file:com.pentacog.mctracker.ServerListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    RelativeLayout serverView = null;//from w w  w.  ja v a  2 s  .  c o m
    ServerViewHolder holder = null;
    Server server = serverList.get(position);
    server.id = position;
    if (convertView == null) {
        serverView = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item,
                parent, false);
        holder = new ServerViewHolder((int) getItemId(position), serverView);
        serverView.setTag(holder);
    } else {
        serverView = (RelativeLayout) convertView;
        holder = (ServerViewHolder) serverView.getTag();
        holder.id = (int) getItemId(position);
    }

    //set server name
    holder.serverTitle.setText(server.name);
    //set server IP
    String serverName = server.address.toString();
    if (!serverName.startsWith("/")) {
        int index = serverName.lastIndexOf('/');
        if (index != -1) {
            String tempString;
            tempString = serverName.substring(index + 1);
            serverName = serverName.substring(0, index);
            serverName += " " + tempString;
        }
    } else {
        serverName = serverName.replace("/", "");
    }
    if (server.port != 25565)
        serverName += ":" + server.port;
    holder.serverIp.setText(serverName);

    //set fav icon
    if (server.favorite) {
        holder.favStar.setVisibility(View.VISIBLE);
    } else {
        holder.favStar.setVisibility(View.INVISIBLE);
    }

    if (!server.queried) {
        AlphaAnimation a = new AlphaAnimation(1.0f, 0.2f);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        a.setDuration(300);
        holder.statusBar.setBackgroundColor(Color.BLUE);
        holder.statusBar.startAnimation(a);

        //         holder.loading.setVisibility(View.VISIBLE);
        holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers);
        holder.serverData.setText(R.string.loading);
        holder.playerCount.setVisibility(View.INVISIBLE);
        holder.ping.setVisibility(View.INVISIBLE);
        new ServerViewUpdater(serverView, server);
    } else {
        setupServerCell(server, holder);
    }

    return serverView;
}

From source file:com.oginotihiro.datepicker.DatePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    int currentView = MONTH_AND_DAY_VIEW;
    int listPosition = -1;
    int listPositionOffset = 0;

    if (savedInstanceState != null) {
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
    }//w w  w  . j ava  2 s. co  m

    View view = inflater.inflate(R.layout.oginotihiro_date_picker_dialog, container, false);

    mDayOfWeekView = (TextView) view.findViewById(R.id.datePickerHeader);

    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);

    mSelectedMonthTv = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTv = (TextView) view.findViewById(R.id.date_picker_day);
    mSelectedYearTv = (TextView) view.findViewById(R.id.date_picker_year);
    mSelectedYearTv.setOnClickListener(this);

    int[][] states = new int[][] { new int[] { -android.R.attr.state_pressed, -android.R.attr.state_selected },
            new int[] { -android.R.attr.state_pressed, android.R.attr.state_selected },
            new int[] { android.R.attr.state_pressed } };
    int[] colors = new int[] { getResources().getColor(R.color.date_picker_text_normal), mColor, mDarkColor };
    ColorStateList csl = new ColorStateList(states, colors);

    mSelectedMonthTv.setTextColor(csl);
    mSelectedDayTv.setTextColor(csl);
    mSelectedYearTv.setTextColor(csl);

    Activity activity = getActivity();
    mYearPickerView = new YearPickerView(activity, this);
    mDayPickerView = new DayPickerView(activity, this);

    mAnimator = (ViewAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);

    AlphaAnimation inAlphaAnimation = new AlphaAnimation(0.0F, 1.0F);
    inAlphaAnimation.setDuration(300);
    mAnimator.setInAnimation(inAlphaAnimation);

    AlphaAnimation outAlphaAnimation = new AlphaAnimation(1.0F, 0.0F);
    outAlphaAnimation.setDuration(300);
    mAnimator.setOutAnimation(outAlphaAnimation);

    mDoneButton = (Button) view.findViewById(R.id.done);

    StateListDrawable sld = new StateListDrawable();
    sld.addState(new int[] { android.R.attr.state_pressed },
            new ColorDrawable(Color.argb(60, Color.red(mColor), Color.green(mColor), Color.blue(mColor))));

    mDoneButton.setOnClickListener(this);

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
        mDoneButton.setBackgroundDrawable(sld);
    } else {
        mDoneButton.setBackground(sld);
    }

    updateDisplay();
    setCurrentView(currentView, true);

    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        }
        if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
        }
    }
    return view;
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill getting from
 * the moneybox./*  w  w w. j  a va  2 s .c o m*/
 * 
 * @param img
 *            ImageView to receive the animation
 * @param layout
 *            Layout that paint the image
 * @return Set of animations to apply to the image
 */
private AnimationSet createGetAnimation(ImageView img, View layout) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // get
    TranslateAnimation get;
    int bottom;

    bottom = Math.abs(layout.getHeight() - img.getLayoutParams().height);
    get = new TranslateAnimation(1.0f, 1.0f, bottom, 1.0f);
    get.setDuration(1500);
    result.addAnimation(get);

    // Fade out
    AlphaAnimation fadeOut;

    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setDuration(300);
    fadeOut.setStartOffset(1500);

    result.addAnimation(fadeOut);

    return result;
}

From source file:com.kubotaku.android.sample.sensordataviewer.SensorDataActivity.java

private void setShowValueAnimation(View view) {
    final AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(750);
    alphaAnimation.setFillAfter(true);/*from  w ww. j  av a  2  s .  c  o  m*/
    view.setAnimation(alphaAnimation);
}

From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java

public void setSatelliteCount(int count) {
    ImageView imgSatelliteCount = (ImageView) rootView.findViewById(R.id.simpleview_imgSatelliteCount);
    TextView txtSatelliteCount = (TextView) rootView.findViewById(R.id.simpleview_txtSatelliteCount);

    if (count > -1) {
        setColor(imgSatelliteCount, IconColorIndicator.Good);

        AlphaAnimation fadeIn = new AlphaAnimation(0.6f, 1.0f);
        fadeIn.setDuration(1200);
        fadeIn.setFillAfter(true);//from w ww .j a  v a 2  s  .c o m
        txtSatelliteCount.startAnimation(fadeIn);
        txtSatelliteCount.setText(String.valueOf(count));
    } else {
        clearColor(imgSatelliteCount);
        txtSatelliteCount.setText("");
    }

}