Adds changes in toots

This commit is contained in:
tom79 2017-08-15 12:12:51 +02:00
parent 62f9379a2f
commit 6f8a1ab819
2 changed files with 36 additions and 11 deletions

View File

@ -571,11 +571,11 @@ public class MainActivity extends AppCompatActivity
set_text_size_value.setText(String.format("%s%%",String.valueOf(textSize)));
set_icon_size_value.setText(String.format("%s%%",String.valueOf(iconSize)));
set_text_size.setMax(12);
set_icon_size.setMax(12);
set_text_size.setMax(20);
set_icon_size.setMax(20);
set_text_size.setProgress(((textSize-70)/5));
set_icon_size.setProgress(((textSize-70)/5));
set_text_size.setProgress(((textSize-50)/5));
set_icon_size.setProgress(((iconSize-50)/5));
set_text_size.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
@ -585,7 +585,7 @@ public class MainActivity extends AppCompatActivity
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int value = 70 + progress*5;
int value = 50 + progress*5;
set_text_size_value.setText(String.format("%s%%",String.valueOf(value)));
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt(Helper.SET_TEXT_SIZE, value);
@ -599,7 +599,7 @@ public class MainActivity extends AppCompatActivity
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int value = 70 + progress*5;
int value = 50 + progress*5;
set_icon_size_value.setText(String.format("%s%%",String.valueOf(value)));
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putInt(Helper.SET_ICON_SIZE, value);
@ -608,6 +608,7 @@ public class MainActivity extends AppCompatActivity
});
builder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
MainActivity.this.recreate();
dialog.dismiss();
}
})

View File

@ -34,6 +34,7 @@ import android.text.Selection;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -200,6 +201,29 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
} else {
holder = (ViewHolder) convertView.getTag();
}
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int iconSizePercent = sharedpreferences.getInt(Helper.SET_ICON_SIZE, 100);
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 100);
holder.status_more.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_more.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_privacy.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_privacy.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_reply.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_reply.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
holder.status_content.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
holder.status_account_displayname.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
holder.status_account_username.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12*textSizePercent/100);
holder.status_reblog_user.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
holder.status_toot_date.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12*textSizePercent/100);
holder.status_spoiler.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
holder.status_content_translated.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()){
holder.status_content_container.setVisibility(View.GONE);
holder.status_spoiler_container.setVisibility(View.VISIBLE);
@ -267,7 +291,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
holder.status_action_container.setVisibility(View.GONE);
}
//Manages theme for icon colors
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if( theme == Helper.THEME_DARK){
changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_text);
@ -301,11 +324,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
final float scale = context.getResources().getDisplayMetrics().density;
if( !status.getIn_reply_to_account_id().equals("null") || !status.getIn_reply_to_id().equals("null") ){
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply);
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (15 * scale + 0.5f));
img.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (15 * iconSizePercent/100 * scale + 0.5f));
holder.status_account_displayname.setCompoundDrawables( img, null, null, null);
}else if( status.getReblog() != null){
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_retweet_black);
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (15 * scale + 0.5f));
img.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (15 * iconSizePercent/100 * scale + 0.5f));
holder.status_account_displayname.setCompoundDrawables( img, null, null, null);
}else{
holder.status_account_displayname.setCompoundDrawables( null, null, null, null);
@ -539,8 +562,8 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
else
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_black);
imgFav.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (20 * scale + 0.5f));
imgReblog.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (20 * scale + 0.5f));
imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null);
holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null);
@ -1079,4 +1102,5 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
builderSingle.create().requestWindowFeature(Window.FEATURE_NO_TITLE);
builderSingle.show();
}
}