当前位置: 首页>>代码示例>>Java>>正文


Java SwipeRefreshLayout.setColorSchemeColors方法代码示例

本文整理汇总了Java中android.support.v4.widget.SwipeRefreshLayout.setColorSchemeColors方法的典型用法代码示例。如果您正苦于以下问题:Java SwipeRefreshLayout.setColorSchemeColors方法的具体用法?Java SwipeRefreshLayout.setColorSchemeColors怎么用?Java SwipeRefreshLayout.setColorSchemeColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.widget.SwipeRefreshLayout的用法示例。


在下文中一共展示了SwipeRefreshLayout.setColorSchemeColors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_events, container, false);
    vSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
    vSwipeRefreshLayout.setOnRefreshListener(this);
    vSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.primary));
    vSwipeRefreshLayout.setEnabled(true);

    vRecyclerView = (RecyclerView) view.findViewById(R.id.cardList);
    vRecyclerView.setHasFixedSize(false);
    final LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    vRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            // So the user didn't accidentally refresh on pulling up
            vSwipeRefreshLayout.setEnabled(llm.findFirstCompletelyVisibleItemPosition() == 0 || (llm.findFirstVisibleItemPosition() == 0 && llm.findFirstCompletelyVisibleItemPosition() == -1));
        }
    });
    vRecyclerView.setLayoutManager(llm);
    return view;
}
 
开发者ID:gregoreesmaa,项目名称:minu-poska-android,代码行数:24,代码来源:EventsFragment.java

示例2: initView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initView() {

        mRecyclerView = (RecyclerView) findViewById(R.id.mRecyclerView);
        tv_empty = (TextView) findViewById(R.id.tv_empty);
        sfl = (SwipeRefreshLayout) findViewById(R.id.sfl);
        sfl.setColorSchemeColors(Color.parseColor("#FF4081"));
        //创建一个LinearLayoutManager对象
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        mRecyclerView.setLayoutManager(linearLayoutManager);
        //创建adapter对象
        myAdapter = new MyAdapter(this, mRecyclerView);
        mRecyclerView.setAdapter(myAdapter);
        myAdapter.setData(list);//设置数据


        if (list.isEmpty()) {
            mRecyclerView.setVisibility(View.GONE);
            tv_empty.setVisibility(View.VISIBLE);
        } else {
            mRecyclerView.setVisibility(View.VISIBLE);
            tv_empty.setVisibility(View.GONE);
        }

    }
 
开发者ID:xzh1223,项目名称:ListPageDemo,代码行数:25,代码来源:MainActivity.java

示例3: bindView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
protected void bindView(){
    //初始化啊Map UIi相关
    mRlMapUiContainer = (RelativeLayout) findViewById(R.id.rl_map_ui_group);
    mBtnMapStyleChange = (Button) findViewById(R.id.btn_change_map_style);
    mBtnActivityLayoutChange = (Button) findViewById(R.id.btn_quit_map_ui);
    mTvMoveDistance = (TextView) findViewById(R.id.tv_duration_distance);
    mTvMoveDuration = (TextView) findViewById(R.id.tv_duration_time);

    mBtnMapStyleChange.setOnClickListener(this);
    mBtnActivityLayoutChange.setOnClickListener(this);

    mLocationProgressLayout = (SwipeRefreshLayout) findViewById(R.id.spl_refresh_view);
    mLocationProgressLayout.setRefreshing(true);
    mLocationProgressLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent),
            getResources().getColor(R.color.colorPrimary));

}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:18,代码来源:MovementTrackActivity.java

示例4: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_assignments, container, false);
    vSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
    vSwipeRefreshLayout.setOnRefreshListener(this);
    vSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.primary));

    vRecyclerView = (RecyclerView) view.findViewById(R.id.cardList);
    vRecyclerView.setHasFixedSize(false);
    final LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    vRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            // So the user didn't accidentally refresh on pulling up
            vSwipeRefreshLayout.setEnabled(llm.findFirstCompletelyVisibleItemPosition() == 0);
        }
    });
    vRecyclerView.setLayoutManager(llm);
    return view;
}
 
开发者ID:gregoreesmaa,项目名称:minu-poska-android,代码行数:23,代码来源:AssignmentsFragment.java

示例5: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    mRecyclerView = (RecyclerView) findViewById(R.id.rv_list);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeLayout);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    mSwipeRefreshLayout.setColorSchemeColors(Color.rgb(47, 223, 189));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    setTitle("Pull TO Refresh Use");
    setBackBtn();
    initAdapter();
    addHeadView();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:PullToRefreshUseActivity.java

示例6: initSwipeRefresh

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initSwipeRefresh() {
    swipeRefreshLayout = (SwipeRefreshLayout) contentView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setColorSchemeColors(ExtraUtil.fetchColor(getContext(), R.attr.colorAccent));
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            (new LoadAppsTask()).execute(true);
        }
    });
}
 
开发者ID:by-syk,项目名称:NanoIconPack,代码行数:11,代码来源:AppsFragment.java

示例7: initSwipeToRefresh

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initSwipeToRefresh() {
    final SwipeRefreshLayout swipeLayout = findViewById(R.id.refresh);
    swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new SyncSurveyTask(swipeLayout).execute();
        }
    });

    swipeLayout.setColorSchemeColors(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null));
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:12,代码来源:SurveyActivity.java

示例8: initSwipeRefreshColors

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public static void initSwipeRefreshColors(@NonNull SwipeRefreshLayout swipeRefreshLayout) {
    Context c = swipeRefreshLayout.getContext();
    swipeRefreshLayout.setColorSchemeColors(
            ResourcesCompat.getColor(c.getResources(), R.color.hpiRed, c.getTheme()),
            ResourcesCompat.getColor(c.getResources(), R.color.hpiOrange, c.getTheme()),
            ResourcesCompat.getColor(c.getResources(), R.color.hpiYellow, c.getTheme()));
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:8,代码来源:ViewUtil.java

示例9: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    this.context = this;

    appPreferences = App.getAppPreferences();
    packageManager = getPackageManager();

    setInitialConfiguration();
    OtherUtils.requestPermissions(context);

    recyclerView = (RecyclerView) findViewById(R.id.app_list);
    refresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
    noResults = (LinearLayout) findViewById(R.id.no_results);

    icon = (ImageView) findViewById(R.id.no_results_icon);
    if (appPreferences.getTheme().equals("0")) {
        icon.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.grey_two));
    }

    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(linearLayoutManager);
    drawer = setNavigationDrawer(context, toolbar, recyclerView, false, appInstalledAdapter, appSystemAdapter, appDisabledAdapter, appHiddenAdapter, appFavoriteAdapter);

    // might be useful in the future
    if (!appPreferences.getInitialSetup()) {
        appPreferences.setInitialSetup(true);
    }

    refresh.setColorSchemeColors(appPreferences.getPrimaryColor());
    refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            refresh.setRefreshing(true);
            new getInstalledApps().execute();
        }
    });

    refresh.post(new Runnable() {
        @Override
        public void run() {
            refresh.setRefreshing(true);
        }
    });
    new getInstalledApps().execute();
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:50,代码来源:MainActivity.java

示例10: initSwipeToRefresh

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void initSwipeToRefresh() {
    final SwipeRefreshLayout swipeLayout = findViewById(R.id.refresh);
    swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new SyncNewsTask(swipeLayout).execute();
        }
    });

    swipeLayout.setColorSchemeColors(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null));
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:12,代码来源:SchwarzesBrettActivity.java

示例11: init

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void init() {
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);

    // 使用Toolbar替换ActionBar
    setSupportActionBar(toolbar);

    // 设置刷新控件颜色
    swipeRefreshLayout.setColorSchemeColors(Color.parseColor("#4DB6AC"));

    // 模拟获取数据
    getData();
    loadMoreAdapter = new LoadMoreAdapter(dataList);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(loadMoreAdapter);

    // 设置下拉刷新
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 刷新数据
            dataList.clear();
            getData();
            loadMoreAdapter.notifyDataSetChanged();

            // 延时1s关闭下拉刷新
            swipeRefreshLayout.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (swipeRefreshLayout != null && swipeRefreshLayout.isRefreshing()) {
                        swipeRefreshLayout.setRefreshing(false);
                    }
                }
            }, 1000);
        }
    });

    // 设置加载更多监听
    recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
        @Override
        public void onLoadMore() {
            loadMoreAdapter.setLoadState(loadMoreAdapter.LOADING);

            if (dataList.size() < 52) {
                // 模拟获取网络数据,延时1s
                new Timer().schedule(new TimerTask() {
                    @Override
                    public void run() {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                getData();
                                loadMoreAdapter.setLoadState(loadMoreAdapter.LOADING_COMPLETE);
                            }
                        });
                    }
                }, 1000);
            } else {
                // 显示加载到底的提示
                loadMoreAdapter.setLoadState(loadMoreAdapter.LOADING_END);
            }
        }
    });
}
 
开发者ID:alidili,项目名称:Demos,代码行数:66,代码来源:LoadMoreActivity.java

示例12: init

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private void init() {
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);

    // 使用Toolbar替换ActionBar
    setSupportActionBar(toolbar);

    // 设置刷新控件颜色
    swipeRefreshLayout.setColorSchemeColors(Color.parseColor("#4DB6AC"));

    // 模拟获取数据
    getData();
    LoadMoreWrapperAdapter loadMoreWrapperAdapter = new LoadMoreWrapperAdapter(dataList);
    loadMoreWrapper = new LoadMoreWrapper(loadMoreWrapperAdapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(loadMoreWrapper);

    // 设置下拉刷新
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 刷新数据
            dataList.clear();
            getData();
            loadMoreWrapper.notifyDataSetChanged();

            // 延时1s关闭下拉刷新
            swipeRefreshLayout.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (swipeRefreshLayout != null && swipeRefreshLayout.isRefreshing()) {
                        swipeRefreshLayout.setRefreshing(false);
                    }
                }
            }, 1000);
        }
    });

    // 设置加载更多监听
    recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
        @Override
        public void onLoadMore() {
            loadMoreWrapper.setLoadState(loadMoreWrapper.LOADING);

            if (dataList.size() < 52) {
                // 模拟获取网络数据,延时1s
                new Timer().schedule(new TimerTask() {
                    @Override
                    public void run() {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                getData();
                                loadMoreWrapper.setLoadState(loadMoreWrapper.LOADING_COMPLETE);
                            }
                        });
                    }
                }, 1000);
            } else {
                // 显示加载到底的提示
                loadMoreWrapper.setLoadState(loadMoreWrapper.LOADING_END);
            }
        }
    });
}
 
开发者ID:alidili,项目名称:Demos,代码行数:67,代码来源:LoadMoreWrapperActivity.java

示例13: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_notify_cmt, container, false);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_notify_cmt_recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(new NotifyCmtAdapter(new ArrayList<CmtNotifyItem>()));
    mRecyclerView.addItemDecoration(new SpaceItemDecoration(5));
    mSwipeRefreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.fragment_notify_cmt_swipe_refresh_layout);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));

    List<CmtNotifyItem> cmtNotifyItemsFromDatabase = DataSupport.findAll(CmtNotifyItem.class);
    if(cmtNotifyItemsFromDatabase==null){
        Log.i(TAG, "onCreateView: cmtNotifyItemsFromDatabase==null");
        getData();
    }
    else{
        Log.i(TAG, "onCreateView: load cmt from database");
        NotifyCmtAdapter adapter = new NotifyCmtAdapter(cmtNotifyItemsFromDatabase);
        mRecyclerView.setAdapter(adapter);

    }

    

    mHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case MSG_GET_NOTIFY_LIST:
                    Gson gson = new Gson();
                    List<CmtNotifyItem> cmtNotifyItems = gson.fromJson(mJson, new TypeToken<List<CmtNotifyItem>>(){}.getType());
                    DataSupport.deleteAll(CmtNotifyItem.class);
                    DataSupport.saveAll(cmtNotifyItems);
                    mRecyclerView.setAdapter(new NotifyCmtAdapter(cmtNotifyItems));
                    mSwipeRefreshLayout.setRefreshing(false);
                    break;
                default:
                    break;
            }
        }
    };
    return view;
}
 
开发者ID:shawnsky,项目名称:RantApp,代码行数:46,代码来源:NotifyCmtFragment.java

示例14: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    //init RecyclerView
    rcv = (RecyclerView) findViewById(R.id.rcv);
    mLinearLayoutManager = new LinearLayoutManager(this);
    rcv.setLayoutManager(mLinearLayoutManager);
    rcv.addOnScrollListener(new EndlessScrollListener());

    srl = (SwipeRefreshLayout) findViewById(R.id.srl);
    srl.setColorSchemeColors(Color.RED, Color.GREEN, Color.YELLOW);
    srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    mBeanList.clear();
                    getMovies(CURRENT_PAGE);
                }
            }, 2000);
        }
    });
    //init Adapter
    mBeanList = new ArrayList<>();
    mQuickAdapter = new MovieQuickAdapter(this, mBeanList);

    //set EmptyView
    mQuickAdapter.setEmptyView(R.layout.rcv_empty);
    mQuickAdapter.setOnPageLoadListener(new BaseQuickAdapter.OnPageLoadListener() {
        @Override
        public void onPageLoad() {
            CURRENT_PAGE++;
            getMovies(CURRENT_PAGE);
        }
    }, PAGE_COUNT);
    //set OnItemClickListener
    mQuickAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View v, int position) {
            Toasty.info(MainActivity.this, mBeanList.get(position).getTitle()).show();
        }
    });
    getMovies(CURRENT_PAGE);
}
 
开发者ID:piscessu,项目名称:BaseQuickAdapter,代码行数:48,代码来源:MainActivity.java

示例15: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
 * 更新RecyclerView需要更新presenter,而设置加载或者刷新的数据需要讲数据添加到adapter中。
 * @param savedInstanceState
 */

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

    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh_layout);

    mRecycylerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecycylerView.setLayoutManager(new LinearLayoutManager(this));

    adapter = new ListAdapter(getDatas());

    presenter = new LoadMorePresenter(adapter);

    presenter.setLoadView(new LoadView(this))
    .setOnLoadMoreListener(new OnLoadMoreListener() {
        @Override
        public void onLoad() {
        loadData();
        }
    })
    .setOnLoadFailListener(new OnLoadFailListener() {
        @Override
        public void loadFail() {
            loadData();
        }
    });

    mRecycylerView.setAdapter(presenter);

    mSwipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(this,R.color.colorAccent));

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 避免正在加载的时候出现刷新问题
            presenter.setRefreshing(true);
            refreshData();
        }
    });
}
 
开发者ID:evansherry,项目名称:PullRefreshLoadMore,代码行数:47,代码来源:MainActivity.java


注:本文中的android.support.v4.widget.SwipeRefreshLayout.setColorSchemeColors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。