パルカワ2

最近はFlutterをやっています

見極め判断と妄想判断

僕は働いていく上で「理解する力」「考える力」「伝える力」「実行する力」が非常に重要だと思っていて、「考える力」は判断を下すことを含めているとも思っている。

最近、判断について考えていて、つい妄想で判断してしまうことがあるなと感じたのでその気持ちをしたためました。

AppCompatEditTextで改行すると下線と文字の幅が小さくなる

こういうXML書いていて、このAppCompatEditTextで改行すると下線と文字の幅が小さくなる。

    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="吉高由里子"
        android:minHeight="40dp"
        android:padding="6dp" />

f:id:hisaichi5518:20160730235005p:plain


XMLをよくみるとpaddingが入っていて、AppCompatEditTextにpaddingは効いていないようであったので削除したら、改行してもギュッと小さくならなくなった。

f:id:hisaichi5518:20160730235017p:plain

    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="吉高由里子"
        android:minHeight="40dp" />

Android で ポケモンGO が 出来ない アナタに送る最高のソリューション

今すぐNexus 5X買いましょう。

さあ、今すぐNexus 5Xを買いましょう!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

最近見たAmazon プライムビデオ

コミコンまわり笑った。TED1見てないので???ってなるところあった。

白ゆき姫殺人事件 [DVD]

白ゆき姫殺人事件 [DVD]

井上真央よいですね……

百万円と苦虫女 [DVD]

百万円と苦虫女 [DVD]

引っ越したい。

ヒミズ

ヒミズ

二階堂 ふみ良いですね…………

ウェンズデーよいですね………
小さい時に時々見てたけどこんな話だったっけ!! ってなった。2見てたのかなぁ

泥酔してるときでも見れてよいです

雑記

映画館行くと体調悪くなるので、家でダラダラお酒を飲みながら適当に見るのも良い。

Firebase API initialization failure.

compileSdkVersion 24, targetSdkVersion 24, サポートライブラリ 24.0.0 で開発してたらFirebaseがErrorを吐いてた。

サポートライブラリを24.0.0にしてるのが原因のようなので、24の機能に依存しているわけではないので、全部23に戻した。

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "io.github.hisaichi5518.akashic"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}
    
dependencies {
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
}

エラーが出てるけど、通知は受け取れたので、24のままでも良かったかもしれない(気持ち悪いけど)

07-17 19:06:28.532 7303-7303/io.github.hisaichi5518.akashic E/FirebaseApp: Firebase API initialization failure.
                                                                           java.lang.reflect.InvocationTargetException
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.google.firebase.FirebaseApp.zza(Unknown Source)
                                                                               at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                               at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                               at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
                                                                               at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
                                                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
                                                                               at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                               at android.app.ActivityThread.installProvider(ActivityThread.java:5158)
                                                                               at android.app.ActivityThread.installContentProviders(ActivityThread.java:4753)
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4693)
                                                                               at android.app.ActivityThread.-wrap1(ActivityThread.java)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:148)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5422)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                            Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/io.github.hisaichi5518.akashic/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_71b4f57689b32f0b280a7a5d016ccf0a2694cb94-classes.dex)
                                                                               at com.google.firebase.iid.zzg.zzeC(Unknown Source)
                                                                               at com.google.firebase.iid.zzg.<init>(Unknown Source)
                                                                               at com.google.firebase.iid.zzg.<init>(Unknown Source)
                                                                               at com.google.firebase.iid.zzd.zzb(Unknown Source)
                                                                               at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at com.google.firebase.FirebaseApp.zza(Unknown Source) 
                                                                               at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                                                                               at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                                                                               at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
                                                                               at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                                                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
                                                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
                                                                               at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                                                                               at android.app.ActivityThread.installProvider(ActivityThread.java:5158) 
                                                                               at android.app.ActivityThread.installContentProviders(ActivityThread.java:4753) 
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4693) 
                                                                               at android.app.ActivityThread.-wrap1(ActivityThread.java) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:148) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5422) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

RecyclerView.ItemDecorationの中では分岐しないようにした

RecyclerViewでリストを作る時、RecyclerView.ItemDecorationを使って各Viewの間隔を広げていた。左と右でサイズが違う事と1個だけアイテムを消すとズレる事に気づいた。

最初の表示 消したあと
f:id:hisaichi5518:20160716180516p:plain f:id:hisaichi5518:20160716180529p:plain

getSpanIndexが削除前の値を返しているというのもあるけど、outRect.right = 0してるのに効かない時があるようだった。outRect.rightが設定された状態から0にしようとするとダメっぽいので、そもそも分岐するのをやめた。

最初の表示 消したあと
f:id:hisaichi5518:20160716180923p:plain f:id:hisaichi5518:20160716180955p:plain
    private class Decoration extends RecyclerView.ItemDecoration {
        private int mLeft, mTop, mRight, mBottom;

        Decoration(int left, int top, int right, int bottom) {
            mLeft = left;
            mTop = top;
            mRight = right;
            mBottom = bottom;
        }

        @Override
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
            GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();

            int position = layoutParams.getViewAdapterPosition();
            if (position == RecyclerView.NO_POSITION) {
                outRect.set(0, 0, 0, 0);
                return;
            }

            outRect.left = mLeft;
            outRect.top = mTop;
            outRect.right = mRight;
            outRect.bottom = mBottom;
        }
    }

全部のコードはここにおいた。
GitHub - hisaichi5518/RecyclerViewItemDecorationTest

人によって“当たり前”は違う

自分にとって当たり前と思ってることはたくさんある。僕の場合、小学生まで家で食べる天ぷらには醤油とマヨネーズを付けて食べるのが当たり前だった。他の家は天つゆで食べると聞いてマジで驚いた。

コードにおいても、自分の中に当たり前がある。僕にとってはインデントが揃ってるのは当たり前だし、コードに対してテストがあるのも当たり前のことだと思ってる。

コードにおいての当たり前も天ぷらの話と同じように人によって違う。ある人はテストがないのが当たり前なのかもしれないし、インデントバラバラが当たり前なのかもしれない。

自分の当たり前は正しいのか、相手の当たり前はなんなのか、そしてそれは正しいのかを考える。そうやっていくことで、自分の当たり前をより良くし、お金を大量に得たい。