2016의 게시물 표시

android Notification의 Small Icon을 감싸는 색상 지정하기

이미지
이것을 무엇이라 검색을 해야할지 감이 안와서 이런저런 검색을 해보고 고민을 하다가 특정 API가 있는것을 확인하고 아래와 같이 글을 쓴다.  위의 그림에서 노란색 동그라미 영역안에 보이는 아이콘을 커스텀으로 할 수 있는지에 대해 여러방면으로 알아봤다. 관련된 결론을 내면 아래와 같다. (해당 위치의 아이콘을 아래에서는 "노티 위 작은 아이콘" 으로 한다.) 1. LargeIcon 옆의 작은 아이콘은 Small Icon이다.    이 Small Icon은         위와 같이 상단 Indicator에 보여지는 아이콘과 동일하다.     5.0(롤리팝) 이상에서는 해당 아이콘이 흰색이어야 한다.     만약 흰색이 아닌경우는 Crash까지 발생하는 단말이 있다.     또한 흰색이 아닌경우는 "노티 위 작은 아이콘"에     가장 유사한 형태의 기본 아이콘이 위치하게 된다.     흰색의 아이콘인 경우는 정상적으로 노출. 2. 그 다음 의문은, "노티 위 작은 아이콘"을 감싸는 색상인데    Notification.Builder의 setColor를 설정을 하면 색상이 설정된다.   3. Indicator에 노출되는 아이콘과, "노티 위 작은 아이콘"은    디자인을 다르게 할 수 없다. 위의 내용은 너무나 간단한 것인데, 찾는데 시간이 걸렸어서 위와같이 간단히 정리를 해둡니다.

CustomView로 Android Notification 띄우기

현재 Android 7.0까지 나온 상황에서 6.0 이상에 추가된 Notification의 모든 기능을 활용하는 코드는 아니지만 5.0 부터 추가된 Headup Notification까지는 포함하는 코드이다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 public   static   int  showNotification(Context context,  int  iconResId, RemoteViews view, RemoteViews bigView, Class activityCls) {     Notification.Builder builder  =   new  Notification.Builder(context)             .setSmallIcon(iconResId)             .setWhen( System .currentTimeMillis())             .setPriority(Notification.PRIORITY_MAX)             .setFullScreenIntent(getIntent(context, activityCls),  true )             .setContentIntent(getIntent(context, activityCls));     Notification notification  =   null ;        if (Build.VERSION.SDK_INT  > =  Build.VERSION_CODES.N) {         builder.setCustomContentView(view);          if (bigView  ! =   n

bat 파일을 통해 반복적인 Encoding 처리

HEVC 영상들울 h264로 바꿔야 하는 작업이 필요했다. 단순히 Code로 작성하면 단순하지만 그렇게까지 코딩하고 싶지 않았기에 BAT 파일로 만드는 방법을 찾아보던 중 아래와 같은 방법을 발견했다. @ECHO OFF for %%i in (625 626 627 628 629) do ( for %%j in (0 1 2 3 4 5 6 7 8 9) do (     ffmpeg -i G:\SAM_%%i%%j.MP4 -acodec aac -ar 48000 -ab 640k -vcodec libx264 -b 100000k -r 29.97 G:\E_SAM_%%i%%j.MP4 ) ) %%i와 %%j는 일반 코딩에서 변수 정도로 보면 된다. for-each문과 유사한 형태. ffmpeg의 옵션값들은 별도의 글들을 통해 확인해보길 바란다.

Xml Gradient Drawable중 type="radial"문제.

원형 그라데이션을 xml로 추가하기 위해서, 아래와 같은 형식의 xml을 작성해 사용해보려 하였다. (출처 : http://www.b2creativedesigns.com/shapes.php) bg_simple.xml: 1 <?xml version= "1.0"   encoding= "UTF-8" ?> 2 <shape xmlns:android= " http://schemas.android.com/apk/res/android " 3      android:shape= "rectangle" > 4      <gradient android:type= "radial" 5           android:startColor= "#39629C" 6           android:centerColor= "#5580BD" 7           android:endColor= "#C8DAF2" 8           android:gradientRadius= "350" /> 9 </shape> 하지만, 계속해서 화면에 보이는것은 단색. 이리저리 값들을 바꿔보았지만, gradientRadius 값이 0.5를 경계로 startColor/endColor 기준으로 단색이 나오는 것을 빼고는 변하는 것이 없었다.  Android Relese Note에서 확인해보니 아래와 같은 issue가 등록되었고, (https://code.google.com/p/android/issues/detail?id=71065) Android 5.0 (Lollipop)에서 발생하던 이슈였고, 5.1에서 수정될 것이라고 한다. [이런... 그렇다면 radial Type의 xml은 사용못하는

[펌] RelativeLayout의 alignBaseline과 alignBottom의 차이

이미지
RelativeLayout의 alignBaseline과 alignBottom의 차이가 궁금해서 검색하다가 유용한 정보를 확인하게 되어 모아둔다. 아래와 같은 고민을 했던 적이 있는데, 이런식으로 정렬이 가능하단걸 알게 되었으니, 앞으로 참 잘 쓸 수 있을 듯 하다. To visualize the difference, I usually imagine two textboxes in Word or Photoshop. alignBottom  lines up the bottom of the textboxes. (The blue outline) Text could be uneven, but the boxes they're in would line up on the bottom. alignBaseline  aligns the actual text within the box. This can help ensure that the texts line up on the bottom, regardless of font size or textbox size. (The green line) What is a Baseline? Baseline  is a typography term that refers to the invisible line text is written on. (As referenced in  What is the baseline in RelativeLayout? ) Warning If you're not careful, using alignBaseline could make your layout look like this:  Details:  Watch That Baseline Alignment I don't know if you're still looking for the answer, but I decided to at least put this out there

AndroidMenifest에서 Http URL intent filter 걸기

이미지
웹서비스와 앱서비스를 동시에 하는 유튜브와 같은 경우는 앱에서 해당 URL을 잡아서 앱으로 바로 띄울수도 있는 기능이 필요하다. 물론 앱을 띄우기 위해서 appScheme://execute 와 비슷한 scheme을 사용할 수 도 있지만, 해당 Scheme은 앱이 설치 되어있지 않은 단말에서는 무용지물이기 때문에 그것에 대비한 방법으로 아래 내용을 소개한다. 1. 목적    - http 혹은 https URL의 링크 이동을 앱에서 직접 잡아서  앱을 띄울 수 있도록 처리한다. 2. 기본방법    ※ 예시)  http://www.myservice.com/ 이라는 URL로 이동시 앱을 띄우고자 할 때    Step 1) AndroidMenifest.xml에서 해당 URL로 앱이 실행 될 경우 띄울 Activity에 아래와 같은 내용을 추가한다. 1 2 3 4 5 6 7 < intent-filter >     < action   android:name = "android.intent.action.VIEW"   / >     < category   android:name = "android.intent.category.DEFAULT"   / >     < category   android:name = "android.intent.category.BROWSABLE"   / >         < data   android:scheme = "http"                    android:host = "www.myservice.com" / > </ intent-filter > Colored by Color Scripter cs      Step 2) 해당 Activity의 Java C