1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-10 16:34:41 +01:00

絵文字データ生成につかってるリポジトリをgit submodule で取り込んだ

This commit is contained in:
tateisu 2017-09-30 10:13:50 +09:00
parent 4350dc75ad
commit fd49608d9b
16 changed files with 11802 additions and 20 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "_Emoji/emoji-data"]
path = _Emoji/emoji-data
url = git@github.com:iamcal/emoji-data.git
[submodule "_Emoji/emojione2.x"]
path = _Emoji/emojione2.x
url = git@github.com:emojione/emojione.git

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
_ArtWork/v0.5.1/sticker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 KiB

11749
_Emoji/EmojiData201709.java Normal file

File diff suppressed because it is too large Load Diff

1
_Emoji/emoji-data Submodule

@ -0,0 +1 @@
Subproject commit eb2246bb9263cba4e04e1497d635925ef59bd143

1
_Emoji/emojione2.x Submodule

@ -0,0 +1 @@
Subproject commit ca555ab7575ad3016ae0e2b45f330da9fd0027c8

View File

@ -34,9 +34,12 @@ public class ActCallback extends AppCompatActivity {
if( intent != null ){
String action = intent.getAction();
String type = intent.getType();
if( Intent.ACTION_SEND.equals( action )
|| Intent.ACTION_SEND_MULTIPLE.equals( action )
|| ( type != null && type.startsWith( "image/" ) && Intent.ACTION_VIEW.equals( action ) )
if(
// ACTION_SEND ACTION_SEND_MULTIPLE
Intent.ACTION_SEND.equals( action )
|| Intent.ACTION_SEND_MULTIPLE.equals( action )
// ACTION_VIEW かつ type 画像かビデオ
|| ( Intent.ACTION_VIEW.equals( action ) && type != null && ( type.startsWith( "image/" ) || type.startsWith( "video/" ) ) )
){
// Google Photo などから送られるIntentに含まれるuriの有効期間はActivityが閉じられるまで
@ -69,7 +72,7 @@ public class ActCallback extends AppCompatActivity {
final String action = src.getAction();
final String type = src.getType();
if( type != null && (type.startsWith( "image/" ) || type.startsWith( "video/" )) ){
if( type != null && ( type.startsWith( "image/" ) || type.startsWith( "video/" ) ) ){
if( Intent.ACTION_VIEW.equals( action ) ){
Uri uri = src.getData();
if( uri == null ) return null;

View File

@ -68,6 +68,7 @@ import jp.juggler.subwaytooter.table.PostDraft;
import jp.juggler.subwaytooter.table.SavedAccount;
import jp.juggler.subwaytooter.dialog.ActionsDialog;
import jp.juggler.subwaytooter.util.DecodeOptions;
import jp.juggler.subwaytooter.util.EmojiDecoder;
import jp.juggler.subwaytooter.util.LinkClickContext;
import jp.juggler.subwaytooter.util.LogCategory;
import jp.juggler.subwaytooter.util.MyClickableSpan;
@ -708,10 +709,10 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
private void updateTextCount(){
int length = 0;
String s = etContent.getText().toString();
String s = EmojiDecoder.decodeShortCode( etContent.getText().toString() );
length += s.codePointCount( 0, s.length() );
s = cbContentWarning.isChecked() ? etContentWarning.getText().toString() : "";
s = cbContentWarning.isChecked() ? EmojiDecoder.decodeShortCode( etContentWarning.getText().toString() ): "";
length += s.codePointCount( 0, s.length() );
int max;
@ -720,7 +721,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
}else{
max = 350;
for( MyEditText et : list_etChoice ){
s = et.getText().toString();
s = EmojiDecoder.decodeShortCode(et.getText().toString());
length += s.codePointCount( 0, s.length() );
}
}
@ -1143,6 +1144,10 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
if( acceptable_mime_types == null ){
acceptable_mime_types = new HashSet<>();
//
acceptable_mime_types.add( "image/*" ); // Android標準のギャラリーが image/* を出してくることがあるらしい
acceptable_mime_types.add( "video/*" ); // Android標準のギャラリーが image/* を出してくることがあるらしい
//
acceptable_mime_types.add( "image/jpeg" );
acceptable_mime_types.add( "image/png" );
acceptable_mime_types.add( "image/gif" );

View File

@ -418,7 +418,7 @@ public class App1 extends Application {
@Nullable public static byte[] getHttpCached( @NonNull String url ){
Response response;
long t_start = SystemClock.elapsedRealtime();
try{
okhttp3.Request.Builder request_builder = new okhttp3.Request.Builder();
request_builder.url( url );
@ -429,9 +429,6 @@ public class App1 extends Application {
}catch( Throwable ex ){
log.e( ex, "getHttp network error." );
return null;
}finally{
long t_delta = SystemClock.elapsedRealtime() -t_start;
log.d("getHttp: time=%dms",t_delta);
}
if( ! response.isSuccessful() ){
@ -450,7 +447,7 @@ public class App1 extends Application {
@Nullable public static String getHttpCachedString( @NonNull String url ){
Response response;
long t_start = SystemClock.elapsedRealtime();
try{
okhttp3.Request.Builder request_builder = new okhttp3.Request.Builder();
request_builder.url( url );
@ -461,9 +458,6 @@ public class App1 extends Application {
}catch( Throwable ex ){
log.e( ex, "getHttp network error." );
return null;
}finally{
long t_delta = SystemClock.elapsedRealtime() -t_start;
log.d("getHttp: time=%dms",t_delta);
}
if( ! response.isSuccessful() ){

View File

@ -144,11 +144,14 @@ public class CustomEmojiCache {
@Override public void run(){
while( ! bCancelled.get() ){
Request request;
int req_size;
synchronized( queue ){
request = queue.isEmpty() ? null : queue.removeFirst();
req_size = queue.size();
}
if( request == null ){
log.d("wait. req_size=%d",req_size );
waitEx( 86400000L );
continue;
}
@ -157,7 +160,9 @@ public class CustomEmojiCache {
continue;
}
long now = getNow();
int cache_size;
synchronized( cache ){
// 成功キャッシュ
@ -174,7 +179,10 @@ public class CustomEmojiCache {
}
sweep_cache();
cache_size = cache.size();
}
log.d("start get image. req_size=%d, cache_size=%d",req_size ,cache_size);
APNGFrames frames = null;
try{
@ -216,7 +224,7 @@ public class CustomEmojiCache {
private void sweep_cache(){
// キャッシュの掃除
if( cache.size() >= CACHE_MAX ){
if( cache.size() >= CACHE_MAX + 64 ){
ArrayList< CacheItem > list = new ArrayList<>();
list.addAll( cache.values() );

View File

@ -7,6 +7,10 @@ import android.support.annotation.Nullable;
import android.text.Spannable;
import android.view.View;
import java.util.ArrayList;
import jp.juggler.subwaytooter.App1;
public class NetworkEmojiInvalidator implements Runnable, NetworkEmojiSpan.InvalidateCallback {
@NonNull final View view;
@NonNull final Handler handler;
@ -16,11 +20,21 @@ public class NetworkEmojiInvalidator implements Runnable, NetworkEmojiSpan.Inval
this.view = view;
}
final ArrayList<Object> draw_target_list = new ArrayList<>( );
// 装飾テキスト中のカスタム絵文字スパンにコールバックを登録する
public void register( @Nullable Spannable dst ){
if( dst == null ) return;
for(Object o :draw_target_list){
App1.custom_emoji_cache.cancelRequest( o );
}
draw_target_list.clear();
for( NetworkEmojiSpan span : dst.getSpans( 0, dst.length(), NetworkEmojiSpan.class ) ){
span.setInvalidateCallback( this );
Object tag = new Object();
draw_target_list.add( tag);
span.setInvalidateCallback( tag, this );
}
}

View File

@ -5,7 +5,6 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.SystemClock;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -38,8 +37,10 @@ public class NetworkEmojiSpan extends ReplacementSpan implements CustomEmojiCach
}
private InvalidateCallback invalidate_callback;
private Object draw_target_tag;
public void setInvalidateCallback( InvalidateCallback invalidate_callback ){
public void setInvalidateCallback( Object draw_target_tag,InvalidateCallback invalidate_callback ){
this.draw_target_tag = draw_target_tag;
this.invalidate_callback = invalidate_callback;
}
@ -85,7 +86,7 @@ public class NetworkEmojiSpan extends ReplacementSpan implements CustomEmojiCach
if( invalidate_callback == null ) return;
// APNGデータの取得
APNGFrames frames = App1.custom_emoji_cache.get( this, url, this );
APNGFrames frames = App1.custom_emoji_cache.get( draw_target_tag, url, this );
if( frames == null ) return;
long t = invalidate_callback.getTimeFromStart();