This file contains 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
@EActivity | |
public class HogeActivity{ | |
@Rest WebApi webApi; | |
public void hoge(){ | |
try{ | |
UserJson json = webApi.getUser(1234); | |
return json; | |
}catch(RestClientException e){ | |
//HTTPエラー処理 | |
//RestClientException は非チェック例外 |
This file contains 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
public class MainActivity extends Activity { | |
// 省略 | |
@Background | |
void login(String username, String password) { | |
try { | |
webApi.login(username, password); | |
callbackLogin(); | |
} catch (HttpClientErrorException e) { | |
callbackLoginMiss(e); |
This file contains 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
@SharedPref(value=Scope.UNIQUE) | |
public interface MyPrefs { | |
@DefaultLong(-1) long userId(); | |
} |
This file contains 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
@EFragment(R.layout.fragment_timeline) | |
public class TimelineFragment extends Fragment { | |
@ViewById ListView timelineListView; | |
@AfterViews | |
void onAfterViews(){ | |
List<TimelineItem> items = Lists.newArrayList(); | |
//itemsにデータ詰める | |
TimelineAdapter adapter = new TimelineAdapter(getActivity(), items); | |
timelineListView.setAdapter(adapter); |
This file contains 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
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="jp.hoge" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<application | |
android:name=".AppImpl_" | |
android:allowBackup="true" | |
android:icon="@drawable/icon" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme" > |
This file contains 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.example.ble; | |
import static android.bluetooth.BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE; | |
import static android.bluetooth.BluetoothAdapter.ACTION_REQUEST_ENABLE; | |
import static android.bluetooth.BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION; | |
import static android.bluetooth.BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE; | |
import static android.bluetooth.BluetoothAdapter.getDefaultAdapter; | |
import java.io.IOException; | |
import java.io.InputStream; |
This file contains 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
curl --header "Authorization: key=<server key>" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"<registration id>\"],\"data\":{\"message\":\"Hello\"}}" |
This file contains 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
public void testSayHello() { | |
//このclickで画面遷移すると仮定する。 | |
onView(withId(R.id.greet_button)) | |
.perform(click()); | |
//遷移後の画面に"Hello Steve!"が表示されるが、このassertはOKだったりNGだったりする。 | |
onView(withText("Hello Steve!")) | |
.check(matches(isDisplayed())); | |
} |
This file contains 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
deploygate { | |
userName = "shikajiro" | |
token = "hogehoge" | |
apks { | |
release { | |
sourceFile = file("build/outputs/apk/app-release.apk") | |
message = deploygateMsg | |
} | |
debug { |
This file contains 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
//※ここにユーザーアカウント選択画面があると素敵だと思います。 | |
//oauth tokenの取得 | |
String token; | |
try { | |
token = GoogleAuthUtil.getToken(this, "[email protected]", "oauth2:https://spreadsheets.google.com/feeds"); | |
Log.i("TAG", token); | |
} catch (UserRecoverableAuthException e) { | |
//最初のアクセスの場合かならずここに来る。 | |
//ユーザーに承認を求める画面が表示される。 |