URL: http://www.v2ex.com/api/site/stats.json
获取社区统计信息。
| import java.util.ArrayList; | |
| import java.util.List; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.text.Layout; | |
| import android.text.Layout.Alignment; | |
| import android.text.StaticLayout; | |
| import android.text.TextUtils.TruncateAt; |
URL: http://www.v2ex.com/api/site/stats.json
获取社区统计信息。
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="com.cyrilmottier.android.anapp"> | |
| <!-- ... --> | |
| <application | |
| android:icon="@drawable/ic_launcher" | |
| android:label="@string/config_app_name" | |
| android:theme="@style/Theme.AnApp" > |
##ss-redir 的 iptables 配置(透明代理)
透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则
创建 /etc/ss-redir.json 本地监听 7777
运行ss-redir -v -c /etc/ss-redir.json
iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
| /* | |
| * Copyright 2014 Google Inc. | |
| * | |
| * 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 |
| route = 8.0.0.0/255.0.0.0 | |
| route = 58.0.0.0/255.0.0.0 | |
| route = 23.0.0.0/255.0.0.0 | |
| route = 117.0.0.0/255.0.0.0 | |
| route = 199.0.0.0/255.0.0.0 | |
| route = 190.0.0.0/255.0.0.0 | |
| route = 198.0.0.0/255.0.0.0 | |
| route = 173.0.0.0/255.0.0.0 | |
| route = 174.0.0.0/255.0.0.0 | |
| route = 168.0.0.0/255.0.0.0 |
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * 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 |
| public class CircularProgressDrawable extends Drawable | |
| implements Animatable { | |
| private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator(); | |
| private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator(); | |
| private static final int ANGLE_ANIMATOR_DURATION = 2000; | |
| private static final int SWEEP_ANIMATOR_DURATION = 600; | |
| private static final int MIN_SWEEP_ANGLE = 30; | |
| private final RectF fBounds = new RectF(); |
| /* | |
| * Copyright (C) 2014 The Android Open Source Project | |
| * | |
| * 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 |
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |