Java Code Examples for android.support.v4.widget.SwipeRefreshLayout#setColorScheme()

The following examples show how to use android.support.v4.widget.SwipeRefreshLayout#setColorScheme() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwipeRefreshLayoutBasicFragment.java    From views-widgets-samples with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_sample, container, false);

    // Retrieve the SwipeRefreshLayout and ListView instances
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);

    // BEGIN_INCLUDE (change_colors)
    // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
    mSwipeRefreshLayout.setColorScheme(
            R.color.swipe_color_1, R.color.swipe_color_2,
            R.color.swipe_color_3, R.color.swipe_color_4);
    // END_INCLUDE (change_colors)

    // Retrieve the ListView
    mListView = (ListView) view.findViewById(android.R.id.list);

    return view;
}
 
Example 2
Source File: DevicePermissionsListActivity.java    From freeiot-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle arg0) {
	super.onCreate(arg0);
	
	setContentView(R.layout.activity_deivces_permission_list);
	
	identifier = getIntent().getStringExtra("identifier");
	
	swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
	swipeLayout.setColorScheme(R.color.main_red_color);
	swipeLayout.setOnRefreshListener(this);
	swipeLayout.setProgressViewOffset(true, 0, UIUtils.dip2px(this, 48));
       mListView = (ListView) findViewById(R.id.listview);
       
       findViewById(R.id.back).setOnClickListener(this);
       findViewById(R.id.btn_add).setOnClickListener(this);
       loadDeviceAuthList(true);
}
 
Example 3
Source File: PhotoGridFragment.java    From glimmr with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Log.d("(PhotoGridFragment)" + getLogTag(), "onCreateView");
    }
    mLayout = (RelativeLayout) inflater.inflate(R.layout.gridview_fragment, container,
            false);

    mSwipeLayout = (SwipeRefreshLayout) mLayout.findViewById(R.id.swipe_container);
    mSwipeLayout.setColorScheme(R.color.flickr_pink, R.color.flickr_blue, R.color.flickr_pink,
            R.color.flickr_blue);
    mSwipeLayout.setOnRefreshListener(this);

    mNoConnectionLayout = (ViewGroup) mLayout.findViewById(R.id.no_connection_layout);

    initGridView();

    return mLayout;
}
 
Example 4
Source File: SwipeRefreshLayoutBasicFragment.java    From android-SwipeRefreshLayoutBasic with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_sample, container, false);

    // Retrieve the SwipeRefreshLayout and ListView instances
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);

    // BEGIN_INCLUDE (change_colors)
    // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
    mSwipeRefreshLayout.setColorScheme(
            R.color.swipe_color_1, R.color.swipe_color_2,
            R.color.swipe_color_3, R.color.swipe_color_4);
    // END_INCLUDE (change_colors)

    // Retrieve the ListView
    mListView = (ListView) view.findViewById(android.R.id.list);

    return view;
}
 
Example 5
Source File: MyDevicesListFragment.java    From freeiot-android with MIT License 5 votes vote down vote up
public void initView(View rootView) {
        mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_container);
        mSwipeRefreshLayout.setColorScheme(R.color.main_red_color);
        mSwipeRefreshLayout.setOnRefreshListener(this);
        mSwipeRefreshLayout.setProgressViewOffset(true, 0, UIUtils.dip2px(getActivity(), 48));
        mListView = (ListView) rootView.findViewById(R.id.listview);

        LocalBroadcastManager.getInstance(getActivity())
                .registerReceiver(refreshDevicesReceiver,
                        new IntentFilter(ActionConstants.ACTON_REFRESH_DEVICES));
        refreshDevices(true);
//		UpdateConfig.setDebug(true);
        UmengUpdateAgent.forceUpdate(getActivity());
    }
 
Example 6
Source File: DeviceControlActivity.java    From freeiot-android with MIT License 5 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstances) {
		super.onCreate(savedInstances);
		setContentView(R.layout.activity_outlet_control);
		
		Bundle bundle = getIntent().getExtras();
		if (bundle != null) {
            mIdentifier = bundle.getString("identifier");
//			operateUrl = String.format(operateUrl, mIdentifier);
			mUrl = bundle.getString("app");
			if (BridgeUtil.hasAssetFile(this, "index.html")) {
				mUrl = "file:///android_asset/index.html";
			}
			LogUtils.e("url=> " + mUrl);
//			mUrl = "file:///android_asset/index.html";
//            mUrl = "file:///android_asset/failed/404.html";
            mTitleName = bundle.getString("name");
			((TextView)findViewById(R.id.title)).setText(mTitleName);
		}
		
		mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.swipe_container);
		mSwipeRefreshLayout.setColorScheme(R.color.main_red_color);
		mSwipeRefreshLayout.setOnRefreshListener(this);
		
		mProgressBar = (ProgressBar)findViewById(R.id.progressbar);
		mWebView = (XWalkView) findViewById(R.id.webview);
		findViewById(R.id.back).setOnClickListener(this);
		bridgeHelper = new BridgeHelper(this, mWebView);
		initVebView();
	}
 
Example 7
Source File: UltimateListview.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void initView() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.ultimate_listview_layout, this);
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.ultimate_listview_swipe_layout);
    mBasicUltimateListView = (BasicUltimateListView) view.findViewById(R.id.basicUltimateListView);
    mSwipeRefreshLayout.setEnabled(false);
    mSwipeRefreshLayout.setColorScheme(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
}
 
Example 8
Source File: WebsiteListFragment.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // Log.d(TAG, "ListFragment in onViewCreated ");

    mListViewContainer = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);

    mListViewContainer.setOnRefreshListener(this);
    mListViewContainer.setColorScheme(R.color.holo_blue_bright, R.color.holo_orange_light,
            R.color.holo_green_light, R.color.holo_red_light);

    mListView = getListView();
    mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    mListView.setOnScrollListener(this);

    headerOnList = getActivity().getLayoutInflater().inflate(R.layout.header_view, null);
    headerTextView = (TextView) headerOnList.findViewById(R.id.headerTextView);
    headerOnList.setBackgroundColor(listViewHeaderColor);
    mListView.addHeaderView(headerOnList);

    newsAdapter = new NewsAdapter(getActivity(), retainedList);
    SwingBottomInAnimationAdapter animAdapter = new SwingBottomInAnimationAdapter(newsAdapter);
    ScaleInAnimationAdapter animAdapterMultiple = new ScaleInAnimationAdapter(animAdapter);
    animAdapterMultiple.setAbsListView(mListView);

    mListView.setAdapter(animAdapterMultiple);

    footerOnList = getActivity().getLayoutInflater().inflate(R.layout.footer_view, null);
    mListView.addFooterView(footerOnList);
    mListView.removeFooterView(footerOnList);
}
 
Example 9
Source File: MainActivity.java    From SwipeRefreshLayout-ListViewExample with Apache License 2.0 5 votes vote down vote up
private void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) {

        refreshLayout.setOnRefreshListener(this);

        refreshLayout.setColorScheme(
                android.R.color.holo_blue_light,
                android.R.color.holo_orange_light,
                android.R.color.holo_green_light,
                android.R.color.holo_red_light);

    }
 
Example 10
Source File: ColorSwicher.java    From catnut with MIT License 4 votes vote down vote up
public static void injectColor(SwipeRefreshLayout swipeRefreshLayout) {
	int[] colors = ramdomColors(4);
	swipeRefreshLayout.setColorScheme(colors[0], colors[1], colors[2], colors[3]);
}