Google, Play Store にて Allo と Duo を事前登録受付中!!

メッセージングアプリで巻き返しを図っているようです.

Official Google Blog: Saying 👋 to Allo and Duo: new apps for smart messaging and video calling

Google_Allo_-_Google_Play_の_Android_アプリ

Google_Duo_-_Google_Play_の_Android_アプリ

Allo はメッセージングアプリ.

Duo は動画チャットアプリ.

先手必勝のここらでいまさらユーザをキャッチできるのかしら.


Android Studio の セキュリティアラート が発令中!!

今, メール受信したけど.

alert

Dear Android Studio Developer,

As an app developer on Google Play, we wanted to make you aware of an important security update for Android Studio.

On May 11th, we released the Android Studio 2.1.1 update. This incremental update addresses a security vulnerability in the underlying IntelliJ platform that affects all previous versions of Android Studio. The vulnerability concerns the IDE itself and has no effect on individual apps.

Please update to Android Studio 2.1.1 as soon as possible. More information about the vulnerability can be found in this G+ posting. JetBrains has also released more details on the vulnerability.

To address this security vulnerability, simply go into Android Studio and check updates. For OS X users, navigate to the Android Studio Menu and click Check for Updates. For Windows or Linux users, navigate to the Help menu and click Check for Updates. You should be running at least Android Studio 2.1.1. The update message was sent as a in-product notification to all users of Android Studio. If you want a new install, you can download v2.1.1 from the Android Studio website.

If you’re still using v1.5.x and not able to switch to v2.x immediately, please download Android Studio v1.5.2 from the Android Studio tools website.

Regards,

The Android Studio Team

正直, このメールさえもなんだかクリックするのが怖い...

以下, HTMLメールに掲載されているリンク先一覧.

Download Android Studio and SDK Tools | Android Developers

Please update to Android Studio v2.1.1 We wanted to make you aware of an imp...

Security update for IntelliJ-based IDEs v2016.1 and older versions | Company Blog

Android Studio 1.5.2 - Android Studio Project Site

どのリンクもクリックするとまともなサイトが表示されるのですが, どのリンクもリダイレクトされているのが, なんとなくきもい.

curl

バージョン 2.1.1 にしておけばいいということですかね.

いまやメールもすぐには信じられなくなってるのは私だけでしょうか.

きもくないすか?


【Android Studio】idea.vmoptions の設定

少し遅すぎないかと思い, ビルド時間を短縮しようとな.

~/Library/Preferences/AndroidStudio2.1/idea.vmoptions

デフォルトで以下でした.


-Xms128m      
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOopseservedCodeCacheSize=96m
-XX:+UseCompressedOops

他人の設定を見てみる.


-Xms128m
-Xmx1024m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-Dgroovy.source.encoding=UTF-8

Tips: Android StudioのIDEのメモリ割り当てを増やす(Xmxはどこやねん) - sos の 作業メモ


-Xms512m
-Xmx1024m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=128m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-Dgroovy.source.encoding=UTF-8
-Dfile.encoding=UTF-8

[Android Studio] 起動時のメモリ割り当てサイズを変更する / コンパイラのエンコーディングを変更する | Developers.IO


-Xms2048m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m

PSA: Apparently assigning a ton of memory to gradle makes it noticeably faster.. : androiddev


-server
-Xms2g
-Xmx2g
-XX:NewRatio=3
-Xss16m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=240m
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:SoftRefLRUPolicyMSPerMB=50
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-ea

One and the only one reason to customize IntelliJ IDEA memory settings - Tomasz Dziurko


-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
-XX:SurvivorRatio=8
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=65
-XX:+CMSScavengeBeforeRemark
-XX:+UseCMSInitiatingOccupancyOnly
-XX:ReservedCodeCacheSize=64m
-XX:-TraceClassUnloading
-ea
-Dsun.io.useCanonCaches=false

Prashanth's Blog: Performance Tuning of IntelliJ IDEA startup options

こんなグラフあったけども, そんなにデフォルトではとろいのか?

One_and_the_only_one_reason_to_customize_IntelliJ_IDEA_memory_settings_-_Tomasz_Dziurko

きっと多くの環境で稼働できるようにやわらかめの設定なのでしょうね, デフォルトって.

Configuring JVM options and platform properties – JetBrains Support

Android Studio の ビルド がやけにトロい


ButterKnife 8.0 に更新で @Bind → @BindView など

更新されています.

Butter_Knife

Version 8.0.0 (2016-04-25)

- @Bind becomes @BindView and @BindViews (one view and multiple views, respectively).
- Calls to bind now return an Unbinder instance which can be used to null references. - This replaces the unbind API and adds support for being able to clear listeners.
- New: @BindArray binds String, CharSequence, and int arrays and TypeArray to fields.
- New: @BindBitmap binds Bitmap instances from resources to fields.
- @BindDrawable now supports a tint field which accepts a theme attribute.

-The runtime and compiler are now split into two artifacts.

compile 'com.jakewharton:butterknife:8.0.0'
apt 'com.jakewharton:butterknife-compiler:8.0.0'

- New: apply overloads which accept a single view and arrays of views.
- ProGuard rules now ship inside of the library and are included automatically.
- @Optional annotation is back to mark methods as being optional.

butterknife/CHANGELOG.md at master · JakeWharton/butterknife

明示することで, バインドできるリソース範囲を広げながら処理速度は落とさない.

あと, proguard 記述は不要なのだとさ.

Butter Knife


2分で作れる「About Page」にみる Intent の作り方

Pocket の開発者の方なのかな.

以下のような記述のみで「About Page」が作成できるようです.


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        View aboutPage = new AboutPage(this)
                .isRTL(false)
                .setImage(R.drawable.dummy_image)
                .addGroup("Connect with us")
                .addEmail("[email protected]")
                .addFacebook("the.medy")
                .addTwitter("medyo80")
                .addYoutube("UCdPQtdWIsg7_pi4mrRu46vA")
                .addPlayStore("com.ideashower.readitlater.pro")
                .addInstagram("medyo80")
                .addGitHub("medyo")
                .create();

        setContentView(aboutPage);
    }

medyo/android-about-page: Create an awesome About Page for your Android App in 2 minutes

こんなかんじになります.

20160425-115827_1

下の方の各アイテムをタップすると, 作成されたそれぞれの Intent で startActivity されるわけですが.


mContext.startActivity(element.getIntent());

どんな Intent なのか見てみましょう.

メール


Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{email});

Facebook


Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);

if (AboutPageUtils.isAppInstalled(mContext, "com.facebook.katana")){
  intent.setPackage("com.facebook.katana");
  int versionCode = 0;
  try {
    versionCode = mContext.getPackageManager().getPackageInfo("com.facebook.katana", 0).versionCode;
  } catch (PackageManager.NameNotFoundException e) {
    e.printStackTrace();
  }

  if (versionCode >= 3002850) {
    Uri uri = Uri.parse("fb://facewebmodal/f?href=" + "http://facebook.com/" + id);
    intent.setData(uri);
  } else {
    Uri uri = Uri.parse("fb://page/"+id);
    intent.setData(uri);
  }
}else{
  intent.setData( Uri.parse("http://facebook.com/" + id));
}

Facebookアプリを入れている場合は, そのバージョンのよってセットする Uri を分けているようです.

Twitter


Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);

if (AboutPageUtils.isAppInstalled(mContext, "com.twitter.android")){
  intent.setPackage("com.twitter.android");
  intent.setData(Uri.parse(String.format("twitter://user?user_id=%s",id)));
}else{
  intent.setData(Uri.parse(String.format("http://twitter.com/%s",id)));
}

Play Store


Uri uri = Uri.parse("market://details?id=" + id);
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);

YouTube


Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(String.format("http://youtube.com/channel/%s", id)));

if (AboutPageUtils.isAppInstalled(mContext, "com.google.android.youtube")){
  intent.setPackage("com.google.android.youtube");
}

Instagram


Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://instagram.com/_u/"+id));

if (AboutPageUtils.isAppInstalled(mContext, "com.instagram.android")){
  intent.setPackage("com.instagram.android");
}

GitHub


Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(String.format("https://github.com/%s", id)));

まとめ

ユーザに, ブラウザで開くか, アプリで開くか, の選択の余地を与えず, インストールしているかの判断の後, パッケージ指定で独自スキームの Uri を渡して投げる, てのが今のやり方か.

それがおまえらのやり方か!!