首页

as实现刮刮乐,保准中奖(app源码)

java

2020-6-17

/**
 *
 * Copyright 2016 Harish Sridharan
 * 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.
 */

package com.cooltechworks.scratchview.demo;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.cooltechworks.views.ScratchTextView;

import androidx.appcompat.app.AppCompatActivity;

/**
 * Created by Harish on 10/03/16.
 */
public class DemoClothingActivity extends AppCompatActivity {

    private TextView mScratchTitleView;

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clothing);

        mScratchTitleView = (TextView) findViewById(R.id.scratch_title_text);
        ScratchTextView scratchTextView = (ScratchTextView) findViewById(R.id.scratch_view);

        if(scratchTextView != null) {
            scratchTextView.setRevealListener(new ScratchTextView.IRevealListener() {
                @Override
                public void onRevealed(ScratchTextView tv) {
                    showPrice();
                    mScratchTitleView.setText(R.string.flat_200_offer);
                }

                @Override
                public void onRevealPercentChangedListener(ScratchTextView stv, float percent) {
                    // on percent reveal.
                }
            });
        }

    }

    /**
     * Reveals the discounted price.
     */
    private void showPrice() {
        View priceBeforeView = findViewById(R.id.price_before_text);
        View priceAfterText = findViewById(R.id.price_after_text);
        View priceContainer = findViewById(R.id.price_container);
        FlipAnimator animator = new FlipAnimator(priceBeforeView, priceAfterText, priceContainer.getWidth()/2, priceContainer.getHeight()/2);
        animator.setDuration(800);
        animator.setRotationDirection(FlipAnimator.DIRECTION_Y);
        priceContainer.startAnimation(animator);
    }


}

资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
ScratchView-master/.gitignore , 45
ScratchView-master/LICENSE , 11357
ScratchView-master/README.md , 4035
ScratchView-master/ScratchView.iml , 865
ScratchView-master/app/app.iml , 15673
ScratchView-master/app/build.gradle , 1013
ScratchView-master/app/proguard-rules.pro , 675
ScratchView-master/app/src/main/AndroidManifest.xml , 1211
ScratchView-master/app/src/main/java/com/cooltechworks/scratchview/demo/CaptchaActivity.java , 357
ScratchView-master/app/src/main/java/com/cooltechworks/scratchview/demo/DemoClothingActivity.java , 2436
ScratchView-master/app/src/main/java/com/cooltechworks/scratchview/demo/FlipAnimator.java , 5627
ScratchView-master/app/src/main/java/com/cooltechworks/scratchview/demo/MainActivity.java , 648
ScratchView-master/app/src/main/res/drawable/ic_cart.xml , 687
ScratchView-master/app/src/main/res/drawable/ic_chevron_down.xml , 352
ScratchView-master/app/src/main/res/drawable/ic_wishlist.xml , 391
ScratchView-master/app/src/main/res/drawable/img_sample1.png , 124179
ScratchView-master/app/src/main/res/drawable/img_sample2.png , 26465
ScratchView-master/app/src/main/res/layout/activity_captcha.xml , 4225
ScratchView-master/app/src/main/res/layout/activity_clothing.xml , 8232
ScratchView-master/app/src/main/res/layout/activity_main.xml , 1199
ScratchView-master/app/src/main/res/mipmap-hdpi/ic_launcher.png , 3418
ScratchView-master/app/src/main/res/mipmap-mdpi/ic_launcher.png , 2206
ScratchView-master/app/src/main/res/mipmap-xhdpi/ic_launcher.png , 4842
ScratchView-master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png , 7718
ScratchView-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png , 10486
ScratchView-master/app/src/main/res/values-v21/styles.xml , 26
ScratchView-master/app/src/main/res/values-w820dp/dimens.xml , 358
ScratchView-master/app/src/main/res/values/colors.xml , 341
ScratchView-master/app/src/main/res/values/dimens.xml , 254
ScratchView-master/app/src/main/res/values/strings.xml , 1251
ScratchView-master/app/src/main/res/values/styles.xml , 708
ScratchView-master/build.gradle , 794
ScratchView-master/gradle.properties , 909
ScratchView-master/gradle/wrapper/gradle-wrapper.jar , 53637
ScratchView-master/gradle/wrapper/gradle-wrapper.properties , 233
ScratchView-master/gradlew , 4971
ScratchView-master/gradlew.bat , 2404
ScratchView-master/screenshots/scratch_image_view_demo.gif , 207622
ScratchView-master/screenshots/scratch_text_view_demo.gif , 204253
ScratchView-master/settings.gradle , 25
ScratchView-master/views/build.gradle , 749
ScratchView-master/views/proguard-rules.pro , 675
ScratchView-master/views/src/main/AndroidManifest.xml , 271
ScratchView-master/views/src/main/java/com/cooltechworks/utils/BitmapUtils.java , 2120
ScratchView-master/views/src/main/java/com/cooltechworks/views/ScratchImageView.java , 12106
ScratchView-master/views/src/main/java/com/cooltechworks/views/ScratchTextView.java , 12146
ScratchView-master/views/src/main/res/drawable/ic_scratch_pattern.png , 681
ScratchView-master/views/src/main/res/values/colors.xml , 742
ScratchView-master/views/src/main/res/values/strings.xml , 68
ScratchView-master/views/views.iml , 13678
没有账号? 忘记密码?

社交账号快速登录