Skip to content

Instantly share code, notes, and snippets.

View yamanetoshi's full-sized avatar

YAMANE Toshiaki yamanetoshi

View GitHub Profile
@yamanetoshi
yamanetoshi / 20151031172534.kifu
Created November 2, 2015 01:53
将棋部 10.31 の一局
# Kifu for Android 棋譜ファイル
開始日時:2015/10/31 17:25:34
手合割:平手
先手:先手
後手:後手
手数----指手---------消費時間--
1 7六歩(77) ( 0:06/00:00:06)
2 3四歩(33) ( 0:02/00:00:02)
3 7五歩(76) ( 0:02/00:00:08)
4 8八角成(22) ( 0:06/00:00:08)
@yamanetoshi
yamanetoshi / fugahoge.xml
Created October 27, 2015 02:43
android layout example
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp" >
# Kifu for Android 棋譜ファイル
開始日時:2015/09/14 20:33:54
手合割:平手
先手:先手
後手:後手
手数----指手---------消費時間--
1 7六歩(77) ( 0:23/00:00:23)
2 8四歩(83) ( 0:03/00:00:03)
3 2六歩(27) ( 0:20/00:00:43)
4 8五歩(84) ( 0:01/00:00:04)
@yamanetoshi
yamanetoshi / 20150905171926.kifu
Created September 6, 2015 09:27
将棋部 9.5 棋譜 2
# Kifu for Android 棋譜ファイル
開始日時:2015/09/05 17:19:26
手合割:平手
先手:先手
後手:後手
手数----指手---------消費時間--
1 2六歩(27) ( 0:35/00:00:35)
2 8四歩(83) ( 0:01/00:00:01)
3 2五歩(26) ( 0:01/00:00:36)
4 8五歩(84) ( 0:02/00:00:03)
@yamanetoshi
yamanetoshi / 20150905161450.kifu
Created September 6, 2015 09:25
将棋部 9.5 棋譜 1
# Kifu for Android 棋譜ファイル
開始日時:2015/09/05 16:14:50
手合割:平手
先手:先手
後手:後手
手数----指手---------消費時間--
1 7六歩(77) ( 0:01/00:00:01)
2 8四歩(83) ( 0:04/00:00:04)
3 6八銀(79) ( 0:06/00:00:07)
4 8五歩(84) ( 0:15/00:00:19)
@yamanetoshi
yamanetoshi / CustomRobolectricTestRunner.jara
Created September 3, 2015 01:38
Superclass of testcode
public class CustomRobolectricTestRunner extends RobolectricTestRunner {
public CustomRobolectricTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
String buildVariant = (BuildConfig.FLAVOR.isEmpty() ? "" : BuildConfig.FLAVOR + "/") + BuildConfig.BUILD_TYPE;
System.setProperty("android.package", BuildConfig.APPLICATION_ID);
System.setProperty("android.manifest", "build/intermediates/manifests/full/" + buildVariant + "/AndroidManifest.xml");
System.setProperty("android.resources", "build/intermediates/res/" + buildVariant);
System.setProperty("android.assets", "build/intermediates/assets/" + buildVariant);
}
}
@yamanetoshi
yamanetoshi / ApplicationTest.java
Created September 3, 2015 01:33
First test using Robolectric
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class ApplicationTest {
@Test
public void testAppName() {
String actual = RuntimeEnvironment.application.getString(R.string.app_name);
String expected = "RobolectricSample";
assertThat(actual, is(expected));
}
@yamanetoshi
yamanetoshi / HelloWorldEspressoTest.java
Created August 27, 2015 07:53
Espresso Hello World
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
@yamanetoshi
yamanetoshi / IntentIntegratorExample.java
Created August 27, 2015 06:09
IntentIntegrator (ZXing) Example
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button)findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// new IntentIntegrator(MainActivity.this).initiateScan(IntentIntegrator.ONE_D_CODE_TYPES);
@yamanetoshi
yamanetoshi / Utiliti.java
Created July 31, 2015 04:04
getting matrix object
private static Matrix getMatrix(String path) {
Matrix m = new Matrix();
m.reset();
try {
ExifInterface ei = new ExifInterface(path);
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,1);
switch(orientation)
{
case 1://only scaling