1. Подключаемся к серверу:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.test.android.helpers; | |
| import android.os.Build; | |
| import android.webkit.WebResourceResponse; | |
| import com.google.gson.Gson; | |
| import com.google.gson.reflect.TypeToken; | |
| import com.test.android.Application; | |
| import org.apache.commons.collections.CollectionUtils; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.location.Criteria; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; | |
| import android.os.Looper; | |
| import rx.Observable; | |
| import rx.Subscriber; |
You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.
The RecyclerView should use a LinearLayoutManager.
You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)
This is a porting of the class SimpleSectionedListAdapter provided by Google
Example:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.widget.SeekBar; | |
| public class FloatSeekBar extends SeekBar { | |
| private float max = 1.0f; | |
| private float min = 0.0f; | |
| public FloatSeekBar(Context context, AttributeSet attrs, int defStyle) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Lua Cheat Sheet for Programmers, by Al Sweigart http://coffeeghost.net | |
| -- This cheat sheet is an executable Lua program. | |
| --[[ This is | |
| a multline comment]] | |
| ---[[ This is a neat trick. The first -- makes -[[ not a multiline comment. | |
| print("This line executes.") | |
| --]] The rest of this line is also a comment. | |
| print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def iter_group(queue): | |
| buf = [] | |
| prev_key = None | |
| for val in queue: | |
| cur_key, cur_val = val | |
| #print cur_key, cur_val | |
| if cur_key == prev_key or prev_key is None: | |
| buf.append(cur_val) | |
| else: |
