清华大学研读间预约应用

Tutu-Android 清华小图

  • 还在为预定不到文图研读间而愁眉苦脸,每晚熬到零点只为抢到一个研读间才能安心睡觉吗?
  • 还在因不知道文图剩余座位为零而白跑一趟,或傻傻苦等吗?
  • 总因为赶不上研读间预约时间而承担着违约的风险,最终导致一个月无法预订研读间吗?
  • 不用怕,不担心,清华小图来帮你:D!

清华小图的简介

清华小图是一款面向全清华的师生的文科图书馆研读间智能预约助手。小图会为你提供全方位的文图研读间预订服务。包括研读间的筛选、普通预约、修改、退订,研读间的智能预约、智能推荐,研读间的自动预约、定时轮询,个人预约信息和学籍信息的查询,文图剩余自习座位实时查询。您可以在任意时刻切换账户或退出登录,您也可以随时与开发者通过问题反馈沟通报告bug。

Android Studio应用指南

0、引言

本文转载自关于Android Studio,你需要知道的9件事

1、如何构建你的项目

点击Build然后选择Make Project,最后点击右下方的Gradle Console查看打印信息。

2、Gradle Tasks的使用

点击右侧的Gradle,依次展开项目名–>:app,可以查看所有的Gradle任务,比如双击assembleRelease,就可以执行此task。双击assemble,表示同时执行assembleDebugassembleRelease,会在目录app/build/apk/生成对应的debug和release的APK。

生成的APK命名规则:app-<flavor>-<buildtype>.apk; 比如: app-full-release.apkapp-demo-debug.apk.

也可以在左下角点击控制台进行相应的任务命令:比如输入gradle tasks命令可以查看所有的task、输入gradle build命令表示同时执行assemblecheck;同时命令还支持驼峰匹配:比如gradle aR等同于gradle assembleRelease

3、运行配置

点击Run选择Edit Configuration,展开Android Application,可以新建一个配置或者编辑一个现有的配置:可以配置是否自动启动默认Activity,启动特定Activity,部署目标是否手动选择,比如可以自动部署到USB(真机);模拟器网速控制:

网速规则如下所示:

1
None: no latency
2
GPRS: GPRS (min 150, max 550 milliseconds)
3
EDGE: EDGE/EGPRS (min 80, max 400 milliseconds)
4
UMTS: UMTS/3G (min 35, max 200 milliseconds)

同时可以配置模拟器启动时的额外命令行:

比如启动适配屏幕:-scale 96dpi;还有logcat配置:比如是否每次启动时自动清空。

Loading data from multiple sources with RxJava

Simply copy from Loading data from multiple sources with RxJava

Suppose I have some Data

  • that I query from the network. I could simply hit the network each time I need the data, but caching the data on disk and in memory would be much more efficient.
  • More specifically, I want a setup that:
    Occasionally performs queries from the network for fresh data.
    Retrieves data as quickly as possible otherwise (by caching network results).

I’d like to present an implementation of this setup usingRxJava.

Basic Pattern

Given an Observable<Data> for each source (network, disk and memory), we can construct a simple solution using two operators, concat() and first().

concat() takes multiple Observables and concatenates their sequences. first() emits only the first item from a sequence. Therefore, if you use concat().first(), it retrieves the first item emitted by multiple sources.

Let’s see it in action:

1
// Our sources (left as an exercise for the reader)
2
Observable<Data> memory = ...;  
3
Observable<Data> disk = ...;  
4
Observable<Data> network = ...;
5
6
// Retrieve the first source with data
7
Observable<Data> source = Observable  
8
  .concat(memory, disk, network)
9
  .first();

The key to this pattern is that concat() only subscribes to each child Observable when it needs to. There’s no unnecessary querying of slower sources if data is cached, sincefirst() will stop the sequence early. In other words, if memory returns a result, then we won’t bother going to disk or network. Conversely, if neither memory nor disk have data, it’ll make a new network request.

Note that the order of the source Observables in concat() matters, since it’s checking them one-by-one.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×