mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-04 20:57:59 +01:00
v1.5.5
- インスタンス情報カラムにインスタンスのサムネイルを表示する(マストドン1.6.1以降)
This commit is contained in:
parent
5b6b9be93b
commit
c89f14b737
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -37,7 +37,7 @@
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -9,8 +9,8 @@ android {
|
||||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 154
|
||||
versionName "1.5.4"
|
||||
versionCode 155
|
||||
versionName "1.5.5"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package jp.juggler.subwaytooter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
@ -15,6 +16,7 @@ import jp.juggler.subwaytooter.util.LogCategory;
|
||||
import jp.juggler.subwaytooter.util.Utils;
|
||||
import jp.juggler.subwaytooter.view.MyLinkMovementMethod;
|
||||
import jp.juggler.subwaytooter.view.MyListView;
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView;
|
||||
|
||||
class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnClickListener {
|
||||
|
||||
@ -28,6 +30,7 @@ class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnCl
|
||||
private final TextView tvUserCount;
|
||||
private final TextView tvTootCount;
|
||||
private final TextView tvDomainCount;
|
||||
private final MyNetworkImageView ivThumbnail;
|
||||
|
||||
HeaderViewHolderInstance( ActMain arg_activity, Column arg_column, MyListView parent ){
|
||||
super( arg_activity, arg_column
|
||||
@ -65,8 +68,11 @@ class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnCl
|
||||
tvUserCount = viewRoot.findViewById( R.id.tvUserCount );
|
||||
tvTootCount = viewRoot.findViewById( R.id.tvTootCount );
|
||||
tvDomainCount = viewRoot.findViewById( R.id.tvDomainCount );
|
||||
ivThumbnail = viewRoot.findViewById( R.id.ivThumbnail );
|
||||
|
||||
btnInstance.setOnClickListener( this );
|
||||
btnEmail.setOnClickListener( this );
|
||||
ivThumbnail.setOnClickListener( this );
|
||||
|
||||
tvDescription.setMovementMethod( MyLinkMovementMethod.getInstance() );
|
||||
}
|
||||
@ -89,6 +95,7 @@ class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnCl
|
||||
btnEmail.setText( "?" );
|
||||
btnEmail.setEnabled( false );
|
||||
tvDescription.setText( "?" );
|
||||
ivThumbnail.setImageUrl(App1.pref,0f,null);
|
||||
}else{
|
||||
btnInstance.setText( supplyEmpty( instance.uri ) );
|
||||
btnInstance.setEnabled( ! TextUtils.isEmpty( instance.uri ) );
|
||||
@ -124,16 +131,24 @@ class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnCl
|
||||
tvDomainCount.setText( "" + instance.stats.domain_count );
|
||||
|
||||
}
|
||||
|
||||
if( TextUtils.isEmpty( instance.thumbnail )){
|
||||
ivThumbnail.setImageUrl(App1.pref,0f,null);
|
||||
}else{
|
||||
ivThumbnail.setImageUrl(App1.pref,0f,instance.thumbnail,instance.thumbnail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onClick( View v ){
|
||||
switch( v.getId() ){
|
||||
|
||||
case R.id.btnInstance:
|
||||
if( instance != null && instance.uri != null ){
|
||||
activity.openChromeTab( activity.nextPosition( column ), column.access_info, "https://" + instance.uri + "/about", true );
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.btnEmail:
|
||||
if( instance != null && instance.email != null ){
|
||||
try{
|
||||
@ -149,6 +164,20 @@ class HeaderViewHolderInstance extends HeaderViewHolderBase implements View.OnCl
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.ivThumbnail:
|
||||
if( instance != null && !TextUtils.isEmpty( instance.thumbnail )){
|
||||
try{
|
||||
Intent intent = new Intent( Intent.ACTION_VIEW );
|
||||
intent.setData( Uri.parse(instance.thumbnail) );
|
||||
activity.startActivity( intent );
|
||||
|
||||
}catch( Throwable ex ){
|
||||
ex.printStackTrace();
|
||||
Utils.showToast( activity, true, "missing web browser" );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,19 +27,26 @@ public class TootInstance {
|
||||
|
||||
public String version;
|
||||
|
||||
// バージョンの内部表現
|
||||
public VersionString decoded_version;
|
||||
|
||||
// いつ取得したか
|
||||
public long time_parse;
|
||||
|
||||
// インスタンスのサムネイル。推奨サイズ1200x630px。マストドン1.6.1以降。
|
||||
public String thumbnail;
|
||||
|
||||
// ユーザ数等の数字。マストドン1.6以降。
|
||||
public Stats stats;
|
||||
public static class Stats {
|
||||
public long user_count;
|
||||
public long status_count;
|
||||
public long domain_count;
|
||||
}
|
||||
|
||||
public Stats stats;
|
||||
////////////////////////////////////////////////
|
||||
// 以下は内部で使用する
|
||||
|
||||
// バージョンの内部表現
|
||||
public VersionString decoded_version;
|
||||
|
||||
// いつ取得したか
|
||||
public long time_parse;
|
||||
|
||||
|
||||
@Nullable
|
||||
public static TootInstance parse( JSONObject src ){
|
||||
@ -56,6 +63,8 @@ public class TootInstance {
|
||||
|
||||
dst.stats = parseStats( src.optJSONObject( "stats" ) );
|
||||
|
||||
dst.thumbnail = Utils.optStringX( src, "thumbnail" );
|
||||
|
||||
return dst;
|
||||
}catch( Throwable ex ){
|
||||
log.trace( ex );
|
||||
|
@ -128,6 +128,28 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/thumbnail_1_6_1_later"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
|
||||
<jp.juggler.subwaytooter.view.MyNetworkImageView
|
||||
android:id="@+id/ivThumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:scaleType="fitCenter"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
|
@ -492,8 +492,9 @@
|
||||
|
||||
<string name="mime_type_missing">Missing MIME type.</string>
|
||||
<string name="mime_type_not_acceptable">MIME type %1$s is not acceptable.\nSupported MIME types are image/jpeg, image/png, image/gif, video/webm, video/mp4 .</string>
|
||||
<string name="thumbnail_1_6_1_later">Thumbnail (Mastodon 1.6.1 or later)</string>
|
||||
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->
|
||||
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
|
||||
<!--<string name="abc_action_bar_up_description">Revenir en haut de la page</string>-->
|
||||
|
@ -779,4 +779,5 @@
|
||||
<string name="not_provided_mastodon_under_1_6">マストドン1.6未満では利用できません</string>
|
||||
<string name="mime_type_missing">MIMEタイプが不明です</string>
|
||||
<string name="mime_type_not_acceptable">MIMEタイプ %1$s には対応できません。対応できるMIMEタイプは image/jpeg, image/png, image/gif, video/webm, video/mp4 です</string>
|
||||
<string name="thumbnail_1_6_1_later">サムネイル(マストドン1.6.1以降)</string>
|
||||
</resources>
|
||||
|
@ -483,5 +483,6 @@
|
||||
<string name="not_provided_mastodon_under_1_6">Not provided under Mastodon 1.6</string>
|
||||
<string name="mime_type_missing">Missing MIME type.</string>
|
||||
<string name="mime_type_not_acceptable">MIME type %1$s is not acceptable.\nSupported MIME types are image/jpeg, image/png, image/gif, video/webm, video/mp4 .</string>
|
||||
<string name="thumbnail_1_6_1_later">Thumbnail (Mastodon 1.6.1 or later)</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user