Coder Social home page Coder Social logo

hitblockrefresh's Introduction

FunGameRefreshView

有趣好玩的下拉刷新库, 你还记得小时候打的黑白掌上游戏机么?

Preview

FunGame

目前支持两种游戏:打砖块和打坦克
    打砖块规则简单,没有接住小球即GameOver;
    打坦克规则为:漏掉敌方坦克超过十辆或者与敌方坦克相撞即GameOver,看看你能不能坚持三分钟吧。嘿嘿~;

Usage

布局文件中:
<com.zuck.swipe.hitblockrefresh.view.FunGameRefreshView
    android:id="@+id/refresh_hit_block"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:game_type="hit_block">

    <ListView
        android:id="@+id/list_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars="none">
    </ListView>
</com.zuck.swipe.hitblockrefresh.view.FunGameRefreshView>

Activity中:
    refreshView = (FunGameRefreshView) findViewById(R.id.refresh_fun_game);

    listView = (ListView) findViewById(R.id.list_view);

    arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, createDate());

    listView.setAdapter(arrayAdapter);
    refreshView.setOnRefreshListener(new FunGameRefreshView.FunGameRefreshListener() {
        @Override
        public void onRefreshing() {
            try {
                // 模拟网络请求耗时动作
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            mHandler.sendEmptyMessage(0);
        }
    });

当刷新完毕后需要在主线程中调用:
    refreshView.finishRefreshing();

Attributes

支持下拉头部控件中游戏切换:
    <attr name="game_type" format="enum">
        <enum name="hit_block" value="0" />
        <enum name="battle_city" value="1" />
    </attr>

支持游戏中各部分模型颜色自定义:
    <attr name="left_model_color" format="color" />
    <attr name="middle_model_color" format="color" />
    <attr name="right_model_color" format="color" />

支持HitBlock游戏中砖块列数和小球速度自定义:
    <attr name="block_horizontal_num" format="integer" />
    <attr name="ball_speed" format="integer">
        <enum name="low" value="3" />
        <enum name="medium" value="6" />
        <enum name="fast" value="9" />
    </attr>

#Thanks

UI设计来自于:https://github.com/dasdom/BreakOutToRefresh

#Licence

Hitomis

hitblockrefresh's People

Contributors

hitomis avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.