mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-05 13:17:43 +01:00
リファクタ
This commit is contained in:
parent
e6bf85dd3b
commit
cd656322d1
@ -9,8 +9,8 @@ android {
|
||||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 25
|
||||
versionCode 121
|
||||
versionName "1.2.1"
|
||||
versionCode 122
|
||||
versionName "1.2.2"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ dependencies {
|
||||
testCompile 'junit:junit:4.12'
|
||||
// compile 'com.android.volley:volley:1.0.0'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.8.1'
|
||||
// compile 'com.squareup.okhttp3:okhttp-urlconnection:3.8.0' // Vollery に使う
|
||||
// compile 'com.squareup.okhttp3:okhttp-urlconnection:3.8.0' // Vollery に使う
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
|
||||
compile 'com.github.woxthebox:draglistview:1.4.3'
|
||||
|
@ -1,64 +1,63 @@
|
||||
package jp.juggler.subwaytooter;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ContentValues;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Base64OutputStream;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import jp.juggler.subwaytooter.api.TootApiClient;
|
||||
import jp.juggler.subwaytooter.api.TootApiResult;
|
||||
import jp.juggler.subwaytooter.api.entity.TootAccount;
|
||||
import jp.juggler.subwaytooter.api.entity.TootInstance;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus;
|
||||
import jp.juggler.subwaytooter.dialog.ActionsDialog;
|
||||
import jp.juggler.subwaytooter.table.AcctColor;
|
||||
import jp.juggler.subwaytooter.table.SavedAccount;
|
||||
import jp.juggler.subwaytooter.util.Emojione;
|
||||
import jp.juggler.subwaytooter.util.HTMLDecoder;
|
||||
import jp.juggler.subwaytooter.util.LogCategory;
|
||||
import jp.juggler.subwaytooter.util.Utils;
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ContentValues;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Base64OutputStream;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import jp.juggler.subwaytooter.api.TootApiClient;
|
||||
import jp.juggler.subwaytooter.api.TootApiResult;
|
||||
import jp.juggler.subwaytooter.api.entity.TootAccount;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus;
|
||||
import jp.juggler.subwaytooter.dialog.ActionsDialog;
|
||||
import jp.juggler.subwaytooter.table.AcctColor;
|
||||
import jp.juggler.subwaytooter.table.SavedAccount;
|
||||
import jp.juggler.subwaytooter.util.Emojione;
|
||||
import jp.juggler.subwaytooter.util.HTMLDecoder;
|
||||
import jp.juggler.subwaytooter.util.LogCategory;
|
||||
import jp.juggler.subwaytooter.util.Utils;
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class ActAccountSetting extends AppCompatActivity
|
||||
implements View.OnClickListener
|
||||
@ -92,8 +91,6 @@ public class ActAccountSetting extends AppCompatActivity
|
||||
|
||||
initializeProfile();
|
||||
|
||||
initializeInstanceInformation();
|
||||
|
||||
btnOpenBrowser.setText( getString( R.string.open_instance_website, account.host ) );
|
||||
}
|
||||
|
||||
@ -1087,75 +1084,5 @@ public class ActAccountSetting extends AppCompatActivity
|
||||
}.executeOnExecutor( App1.task_executor );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void initializeInstanceInformation(){
|
||||
|
||||
loadInstanceInformation();
|
||||
}
|
||||
|
||||
void loadInstanceInformation(){
|
||||
// サーバから情報をロードする
|
||||
|
||||
final ProgressDialog progress = new ProgressDialog( this );
|
||||
|
||||
final AsyncTask< Void, Void, TootApiResult > task = new AsyncTask< Void, Void, TootApiResult >() {
|
||||
|
||||
TootInstance data;
|
||||
|
||||
@Override protected TootApiResult doInBackground( Void... params ){
|
||||
TootApiClient client = new TootApiClient( ActAccountSetting.this, new TootApiClient.Callback() {
|
||||
@Override public boolean isApiCancelled(){
|
||||
return isCancelled();
|
||||
}
|
||||
|
||||
@Override public void publishApiProgress( final String s ){
|
||||
}
|
||||
} );
|
||||
client.setAccount( account );
|
||||
|
||||
TootApiResult result = client.request( "/api/v1/instance" );
|
||||
if( result != null && result.object != null ){
|
||||
data = TootInstance.parse( result.object );
|
||||
if( data == null ) return new TootApiResult( "TootInstance parse failed." );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCancelled( TootApiResult result ){
|
||||
super.onPostExecute( result );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute( TootApiResult result ){
|
||||
try{
|
||||
progress.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
}
|
||||
if( result == null ){
|
||||
// cancelled.
|
||||
}else if( data != null ){
|
||||
showInstanceInformation( data );
|
||||
}else{
|
||||
Utils.showToast( ActAccountSetting.this, true, result.error );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
task.executeOnExecutor( App1.task_executor );
|
||||
progress.setIndeterminate( true );
|
||||
progress.setOnDismissListener( new DialogInterface.OnDismissListener() {
|
||||
@Override public void onDismiss( DialogInterface dialog ){
|
||||
task.cancel( true );
|
||||
}
|
||||
} );
|
||||
progress.show();
|
||||
}
|
||||
|
||||
private void showInstanceInformation( TootInstance data ){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class HeaderViewHolderProfile extends HeaderViewHolderBase implements View.OnCli
|
||||
btnFollow = (ImageButton) viewRoot.findViewById( R.id.btnFollow );
|
||||
ivFollowedBy = (ImageView) viewRoot.findViewById( R.id.ivFollowedBy );
|
||||
tvRemoteProfileWarning = (TextView) viewRoot.findViewById( R.id.tvRemoteProfileWarning );
|
||||
|
||||
|
||||
ivBackground.setOnClickListener( this );
|
||||
btnFollowing.setOnClickListener( this );
|
||||
btnFollowers.setOnClickListener( this );
|
||||
@ -75,12 +75,11 @@ class HeaderViewHolderProfile extends HeaderViewHolderBase implements View.OnCli
|
||||
llProfile.setBackgroundColor( c );
|
||||
}
|
||||
|
||||
void bindData(Column column){
|
||||
void bindData( Column column ){
|
||||
this.who = column.who_account;
|
||||
|
||||
showColor();
|
||||
|
||||
|
||||
if( who == null ){
|
||||
tvCreated.setText( "" );
|
||||
ivBackground.setImageDrawable( null );
|
||||
@ -95,12 +94,12 @@ class HeaderViewHolderProfile extends HeaderViewHolderBase implements View.OnCli
|
||||
btnFollow.setImageDrawable( null );
|
||||
tvRemoteProfileWarning.setVisibility( View.GONE );
|
||||
}else{
|
||||
tvCreated.setText( TootStatus.formatTime( tvCreated.getContext(),who.time_created_at ,true ) );
|
||||
ivBackground.setImageUrl( activity.pref, 0f,access_info.supplyBaseUrl( who.header_static ) );
|
||||
ivAvatar.setImageUrl( activity.pref, 16f,access_info.supplyBaseUrl( who.avatar_static ) , access_info.supplyBaseUrl( who.avatar ));
|
||||
tvCreated.setText( TootStatus.formatTime( tvCreated.getContext(), who.time_created_at, true ) );
|
||||
ivBackground.setImageUrl( activity.pref, 0f, access_info.supplyBaseUrl( who.header_static ) );
|
||||
ivAvatar.setImageUrl( activity.pref, 16f, access_info.supplyBaseUrl( who.avatar_static ), access_info.supplyBaseUrl( who.avatar ) );
|
||||
tvDisplayName.setText( who.decoded_display_name );
|
||||
|
||||
tvRemoteProfileWarning.setVisibility( column.access_info.isRemoteUser(who) ? View.VISIBLE : View.GONE );
|
||||
|
||||
tvRemoteProfileWarning.setVisibility( column.access_info.isRemoteUser( who ) ? View.VISIBLE : View.GONE );
|
||||
|
||||
String s = "@" + access_info.getFullAcct( who );
|
||||
if( who.locked ){
|
||||
@ -160,7 +159,7 @@ class HeaderViewHolderProfile extends HeaderViewHolderBase implements View.OnCli
|
||||
new DlgContextMenu( activity, column, who, null, null ).show();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,9 +264,9 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
int c = this.acct_color = column.acct_color != 0 ? column.acct_color : Styler.getAttributeColor( activity, R.attr.colorTimeSmall );
|
||||
tvBoostedTime.setTextColor( c );
|
||||
tvTime.setTextColor( c );
|
||||
// tvBoostedAcct.setTextColor( c );
|
||||
// tvFollowerAcct.setTextColor( c );
|
||||
// tvAcct.setTextColor( c );
|
||||
// tvBoostedAcct.setTextColor( c );
|
||||
// tvFollowerAcct.setTextColor( c );
|
||||
// tvAcct.setTextColor( c );
|
||||
}
|
||||
|
||||
if( item instanceof MSPToot ){
|
||||
@ -360,7 +360,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
account_boost = who;
|
||||
llBoosted.setVisibility( View.VISIBLE );
|
||||
ivBoosted.setImageResource( Styler.getAttributeResourceId( activity, icon_attr_id ) );
|
||||
tvBoostedTime.setText( TootStatus.formatTime( tvBoostedTime.getContext(),time ,true) );
|
||||
tvBoostedTime.setText( TootStatus.formatTime( tvBoostedTime.getContext(), time, true ) );
|
||||
tvBoosted.setText( text );
|
||||
setAcct( tvBoostedAcct, access_info.getFullAcct( who ) );
|
||||
}
|
||||
@ -368,7 +368,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
private void showFollow( @NonNull TootAccount who ){
|
||||
account_follow = who;
|
||||
llFollow.setVisibility( View.VISIBLE );
|
||||
ivFollow.setImageUrl( activity.pref, 16f,access_info.supplyBaseUrl( who.avatar_static ) );
|
||||
ivFollow.setImageUrl( activity.pref, 16f, access_info.supplyBaseUrl( who.avatar_static ) );
|
||||
tvFollowerName.setText( who.decoded_display_name );
|
||||
setAcct( tvFollowerAcct, access_info.getFullAcct( who ) );
|
||||
|
||||
@ -381,19 +381,19 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
llStatus.setVisibility( View.VISIBLE );
|
||||
|
||||
if( status instanceof MSPToot ){
|
||||
tvTime.setText( TootStatus.formatTime( tvTime.getContext(), status.time_created_at , column.column_type != Column.TYPE_CONVERSATION ) );
|
||||
tvTime.setText( TootStatus.formatTime( tvTime.getContext(), status.time_created_at, column.column_type != Column.TYPE_CONVERSATION ) );
|
||||
}else if( status instanceof TootStatus ){
|
||||
TootStatus ts = (TootStatus) status;
|
||||
int icon_id = Styler.getVisibilityIcon( activity, ts.visibility );
|
||||
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder( );
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder();
|
||||
int start = sb.length();
|
||||
sb.append(ts.visibility);
|
||||
sb.append( ts.visibility );
|
||||
int end = sb.length();
|
||||
sb.setSpan( new EmojiImageSpan( activity, icon_id ), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE );
|
||||
sb.append(' ');
|
||||
sb.append(TootStatus.formatTime( activity,status.time_created_at, column.column_type != Column.TYPE_CONVERSATION ));
|
||||
tvTime.setText(sb);
|
||||
sb.append( ' ' );
|
||||
sb.append( TootStatus.formatTime( activity, status.time_created_at, column.column_type != Column.TYPE_CONVERSATION ) );
|
||||
tvTime.setText( sb );
|
||||
}
|
||||
|
||||
account_thumbnail = status.account;
|
||||
@ -401,7 +401,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
|
||||
if( status.account == null ){
|
||||
tvName.setText( "?" );
|
||||
ivThumbnail.setImageUrl( activity.pref, 16f,null, null );
|
||||
ivThumbnail.setImageUrl( activity.pref, 16f, null, null );
|
||||
}else{
|
||||
tvName.setText( status.account.decoded_display_name );
|
||||
ivThumbnail.setImageUrl(
|
||||
@ -568,7 +568,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
}
|
||||
}
|
||||
// 正方形じゃないせいか、うまく動かない activity.density * 4f );
|
||||
iv.setImageUrl( activity.pref, 0f, access_info.supplyBaseUrl( url ) , access_info.supplyBaseUrl( url ) );
|
||||
iv.setImageUrl( activity.pref, 0f, access_info.supplyBaseUrl( url ), access_info.supplyBaseUrl( url ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,26 +192,26 @@ public class TootStatus extends TootStatusLike {
|
||||
|
||||
private static final SimpleDateFormat date_format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault() );
|
||||
|
||||
public static String formatTime( Context context,long t ,boolean bAllowRelative){
|
||||
if( bAllowRelative && App1.pref.getBoolean( Pref.KEY_RELATIVE_TIMESTAMP,false ) ){
|
||||
public static String formatTime( Context context, long t, boolean bAllowRelative ){
|
||||
if( bAllowRelative && App1.pref.getBoolean( Pref.KEY_RELATIVE_TIMESTAMP, false ) ){
|
||||
long now = System.currentTimeMillis();
|
||||
long delta = now - t;
|
||||
String sign = context.getString( delta > 0 ? R.string.ago : R.string.later );
|
||||
delta = delta >= 0 ? delta : -delta;
|
||||
delta = delta >= 0 ? delta : - delta;
|
||||
if( delta < 2000L ){
|
||||
return context.getString( R.string.time_within_second );
|
||||
}else if( delta < 60000L ){
|
||||
int v = (int)(delta /1000L);
|
||||
return context.getString( v > 1 ? R.string.relative_time_second_2 : R.string.relative_time_second_1 ,v,sign);
|
||||
int v = (int) ( delta / 1000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_second_2 : R.string.relative_time_second_1, v, sign );
|
||||
}else if( delta < 3600000L ){
|
||||
int v =(int) (delta / 60000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_minute_2 : R.string.relative_time_minute_1 ,v,sign);
|
||||
int v = (int) ( delta / 60000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_minute_2 : R.string.relative_time_minute_1, v, sign );
|
||||
}else if( delta < 86400000L ){
|
||||
int v =(int) (delta / 3600000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_hour_2 : R.string.relative_time_hour_1 ,v,sign);
|
||||
int v = (int) ( delta / 3600000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_hour_2 : R.string.relative_time_hour_1, v, sign );
|
||||
}else if( delta < 65 * 86400000L ){
|
||||
int v =(int) (delta / 3600000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_day_2 : R.string.relative_time_day_1 ,v,sign);
|
||||
int v = (int) ( delta / 3600000L );
|
||||
return context.getString( v > 1 ? R.string.relative_time_day_2 : R.string.relative_time_day_1, v, sign );
|
||||
}
|
||||
}
|
||||
date_format.setTimeZone( TimeZone.getDefault() );
|
||||
|
@ -28,9 +28,8 @@ public class DlgDraftPicker
|
||||
, DialogInterface.OnDismissListener
|
||||
{
|
||||
|
||||
|
||||
public interface Callback{
|
||||
void onDraftSelected(JSONObject draft);
|
||||
public interface Callback {
|
||||
void onDraftSelected( JSONObject draft );
|
||||
}
|
||||
|
||||
private ActPost activity;
|
||||
@ -41,7 +40,7 @@ public class DlgDraftPicker
|
||||
private Cursor cursor;
|
||||
private PostDraft.ColIdx colIdx;
|
||||
|
||||
private AsyncTask<Void,Void,Cursor> task;
|
||||
private AsyncTask< Void, Void, Cursor > task;
|
||||
|
||||
public DlgDraftPicker(){
|
||||
}
|
||||
@ -53,34 +52,35 @@ public class DlgDraftPicker
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean onItemLongClick( AdapterView< ? > parent, View view, int position, long id ){
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick( AdapterView< ? > parent, View view, int position, long id ){
|
||||
|
||||
PostDraft draft = getPostDraft( position );
|
||||
if( draft != null ){
|
||||
Utils.showToast( activity,false,R.string.draft_deleted );
|
||||
Utils.showToast( activity, false, R.string.draft_deleted );
|
||||
draft.delete();
|
||||
reload();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void onDismiss( DialogInterface dialog ){
|
||||
if( task != null){
|
||||
if( task != null ){
|
||||
task.cancel( true );
|
||||
task = null;
|
||||
}
|
||||
|
||||
|
||||
lvDraft.setAdapter( null );
|
||||
|
||||
|
||||
if( cursor != null ){
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void open(final ActPost _activity,final Callback _callback){
|
||||
public void open( final ActPost _activity, final Callback _callback ){
|
||||
this.activity = _activity;
|
||||
this.callback = _callback;
|
||||
|
||||
@ -102,7 +102,6 @@ public class DlgDraftPicker
|
||||
;
|
||||
dialog.setOnDismissListener( this );
|
||||
|
||||
|
||||
dialog.show();
|
||||
|
||||
reload();
|
||||
@ -110,7 +109,7 @@ public class DlgDraftPicker
|
||||
|
||||
private void reload(){
|
||||
|
||||
if( task != null){
|
||||
if( task != null ){
|
||||
task.cancel( true );
|
||||
task = null;
|
||||
}
|
||||
@ -123,6 +122,7 @@ public class DlgDraftPicker
|
||||
@Override protected void onCancelled( Cursor cursor ){
|
||||
super.onCancelled( cursor );
|
||||
}
|
||||
|
||||
@Override protected void onPostExecute( Cursor cursor ){
|
||||
if( ! dialog.isShowing() ){
|
||||
// dialog is already closed.
|
||||
@ -135,7 +135,7 @@ public class DlgDraftPicker
|
||||
Utils.showToast( activity, true, "failed to loading drafts." );
|
||||
}else{
|
||||
DlgDraftPicker.this.cursor = cursor;
|
||||
colIdx = new PostDraft.ColIdx(cursor);
|
||||
colIdx = new PostDraft.ColIdx( cursor );
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class DlgDraftPicker
|
||||
|
||||
private PostDraft getPostDraft( int position ){
|
||||
if( cursor == null ) return null;
|
||||
return PostDraft.loadFromCursor( cursor,colIdx, position);
|
||||
return PostDraft.loadFromCursor( cursor, colIdx, position );
|
||||
}
|
||||
|
||||
private class MyViewHolder {
|
||||
@ -161,7 +161,7 @@ public class DlgDraftPicker
|
||||
PostDraft draft = getPostDraft( position );
|
||||
if( draft == null ) return;
|
||||
|
||||
tvTime.setText( TootStatus.formatTime( tvTime.getContext(),draft.time_save ,false ));
|
||||
tvTime.setText( TootStatus.formatTime( tvTime.getContext(), draft.time_save, false ) );
|
||||
|
||||
String cw = draft.json.optString( ActPost.DRAFT_CONTENT_WARNING );
|
||||
String c = draft.json.optString( ActPost.DRAFT_CONTENT );
|
||||
@ -177,7 +177,7 @@ public class DlgDraftPicker
|
||||
}
|
||||
}
|
||||
|
||||
private class MyAdapter extends BaseAdapter{
|
||||
private class MyAdapter extends BaseAdapter {
|
||||
|
||||
@Override public int getCount(){
|
||||
if( cursor == null ) return 0;
|
||||
@ -185,7 +185,7 @@ public class DlgDraftPicker
|
||||
}
|
||||
|
||||
@Override public Object getItem( int position ){
|
||||
return getPostDraft(position);
|
||||
return getPostDraft( position );
|
||||
}
|
||||
|
||||
@Override public long getItemId( int position ){
|
||||
@ -197,7 +197,7 @@ public class DlgDraftPicker
|
||||
if( view == null ){
|
||||
view = activity.getLayoutInflater().inflate( R.layout.lv_draft_picker, parent, false );
|
||||
holder = new MyViewHolder( view );
|
||||
view.setTag(holder);
|
||||
view.setTag( holder );
|
||||
}else{
|
||||
holder = (MyViewHolder) view.getTag();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user