bug fix, layout fix
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
9127e2150b
commit
8e155042a4
@ -23,6 +23,9 @@ import java.util.List;
|
|||||||
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
|
||||||
|
|
||||||
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
|
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
|
||||||
|
import static org.nuclearfog.twidda.adapter.holder.LoginHolder.IDX_CREATED;
|
||||||
|
import static org.nuclearfog.twidda.adapter.holder.LoginHolder.IDX_SCR_NAME;
|
||||||
|
import static org.nuclearfog.twidda.adapter.holder.LoginHolder.IDX_USERNAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adapter for {@link AccountFragment}
|
* adapter for {@link AccountFragment}
|
||||||
@ -78,11 +81,11 @@ public class AccountAdapter extends Adapter<LoginHolder> {
|
|||||||
Account account = data.get(position);
|
Account account = data.get(position);
|
||||||
User user = account.getUser();
|
User user = account.getUser();
|
||||||
String date = StringTools.formatCreationTime(account.getLoginDate());
|
String date = StringTools.formatCreationTime(account.getLoginDate());
|
||||||
holder.date.setText(date);
|
holder.text[IDX_CREATED].setText(date);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
// set profile information
|
// set profile information
|
||||||
holder.username.setText(user.getUsername());
|
holder.text[IDX_USERNAME].setText(user.getUsername());
|
||||||
holder.screenname.setText(user.getScreenname());
|
holder.text[IDX_SCR_NAME].setText(user.getScreenname());
|
||||||
// set profile image
|
// set profile image
|
||||||
if (settings.imagesEnabled()) {
|
if (settings.imagesEnabled()) {
|
||||||
String pbLink = user.getImageLink();
|
String pbLink = user.getImageLink();
|
||||||
@ -92,6 +95,11 @@ public class AccountAdapter extends Adapter<LoginHolder> {
|
|||||||
Picasso.get().load(pbLink).transform(new RoundedCornersTransformation(2, 0))
|
Picasso.get().load(pbLink).transform(new RoundedCornersTransformation(2, 0))
|
||||||
.error(R.drawable.no_image).into(holder.profile);
|
.error(R.drawable.no_image).into(holder.profile);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
holder.profile.setImageResource(0);
|
||||||
|
holder.text[IDX_USERNAME].setText(R.string.account_user_unnamed);
|
||||||
|
holder.text[IDX_SCR_NAME].setText(R.string.account_user_id_prefix);
|
||||||
|
holder.text[IDX_SCR_NAME].append(Long.toString(account.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,29 +22,31 @@ import static android.graphics.PorterDuff.Mode.SRC_IN;
|
|||||||
*/
|
*/
|
||||||
public class LoginHolder extends ViewHolder {
|
public class LoginHolder extends ViewHolder {
|
||||||
|
|
||||||
|
public static final int IDX_USERNAME = 0;
|
||||||
|
public static final int IDX_SCR_NAME = 1;
|
||||||
|
public static final int IDX_CREATED = 2;
|
||||||
|
|
||||||
public final ImageView profile;
|
public final ImageView profile;
|
||||||
public final TextView username, screenname, date;
|
|
||||||
public final ImageButton remove;
|
public final ImageButton remove;
|
||||||
|
public final TextView[] text = new TextView[3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public LoginHolder(ViewGroup parent, GlobalSettings settings) {
|
public LoginHolder(ViewGroup parent, GlobalSettings settings) {
|
||||||
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_login, parent, false));
|
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_account, parent, false));
|
||||||
// get views
|
// get views
|
||||||
CardView background = (CardView) itemView;
|
CardView background = (CardView) itemView;
|
||||||
username = itemView.findViewById(R.id.item_login_username);
|
text[IDX_USERNAME] = itemView.findViewById(R.id.item_login_username);
|
||||||
screenname = itemView.findViewById(R.id.item_login_screenname);
|
text[IDX_SCR_NAME] = itemView.findViewById(R.id.item_login_screenname);
|
||||||
date = itemView.findViewById(R.id.item_login_createdAt);
|
text[IDX_CREATED] = itemView.findViewById(R.id.item_login_createdAt);
|
||||||
remove = itemView.findViewById(R.id.item_login_remove);
|
remove = itemView.findViewById(R.id.item_login_remove);
|
||||||
profile = itemView.findViewById(R.id.item_login_image);
|
profile = itemView.findViewById(R.id.item_login_image);
|
||||||
// theme views
|
// theme views
|
||||||
screenname.setTextColor(settings.getFontColor());
|
for (TextView tv : text) {
|
||||||
screenname.setTypeface(settings.getTypeFace());
|
tv.setTextColor(settings.getFontColor());
|
||||||
screenname.setTextColor(settings.getFontColor());
|
tv.setTypeface(settings.getTypeFace());
|
||||||
screenname.setTypeface(settings.getTypeFace());
|
}
|
||||||
date.setTextColor(settings.getFontColor());
|
|
||||||
date.setTypeface(settings.getTypeFace());
|
|
||||||
remove.setImageResource(R.drawable.cross);
|
remove.setImageResource(R.drawable.cross);
|
||||||
remove.setColorFilter(settings.getIconColor(), SRC_IN);
|
remove.setColorFilter(settings.getIconColor(), SRC_IN);
|
||||||
background.setCardBackgroundColor(settings.getCardColor());
|
background.setCardBackgroundColor(settings.getCardColor());
|
||||||
|
@ -46,13 +46,14 @@ public class AccountLoader extends AsyncTask<Account, Void, List<Account>> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Account> doInBackground(Account... param) {
|
protected List<Account> doInBackground(Account... param) {
|
||||||
|
List<Account> result = null;
|
||||||
try {
|
try {
|
||||||
// remove account if parameter is set
|
// remove account if parameter is set
|
||||||
if (param != null && param.length > 0) {
|
if (param != null && param.length > 0) {
|
||||||
database.removeLogin(param[0].getId());
|
database.removeLogin(param[0].getId());
|
||||||
}
|
}
|
||||||
// get registered users
|
// get registered users
|
||||||
List<Account> result = database.getLogins();
|
result = database.getLogins();
|
||||||
// download user information
|
// download user information
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
// get all user IDs
|
// get all user IDs
|
||||||
@ -69,13 +70,12 @@ public class AccountLoader extends AsyncTask<Account, Void, List<Account>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
} catch (EngineException err) {
|
} catch (EngineException err) {
|
||||||
this.err = err;
|
this.err = err;
|
||||||
} catch (Exception err) {
|
} catch (Exception err) {
|
||||||
err.printStackTrace();
|
err.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
android:id="@+id/item_login_username"
|
android:id="@+id/item_login_username"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/login_name_textsize"
|
android:singleLine="true"
|
||||||
|
android:textSize="@dimen/login_name_textsize_big"
|
||||||
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/item_login_button_barrier" />
|
app:layout_constraintEnd_toStartOf="@id/item_login_button_barrier" />
|
||||||
@ -41,6 +42,7 @@
|
|||||||
android:id="@+id/item_login_screenname"
|
android:id="@+id/item_login_screenname"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
android:textSize="@dimen/login_name_textsize"
|
android:textSize="@dimen/login_name_textsize"
|
||||||
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
||||||
app:layout_constraintTop_toBottomOf="@id/item_login_username"
|
app:layout_constraintTop_toBottomOf="@id/item_login_username"
|
||||||
@ -53,6 +55,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
app:layout_constraintStart_toEndOf="@id/item_login_image_barrier"
|
||||||
app:layout_constraintTop_toBottomOf="@id/item_login_screenname"
|
app:layout_constraintTop_toBottomOf="@id/item_login_screenname"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/item_login_button_barrier" />
|
app:layout_constraintEnd_toStartOf="@id/item_login_button_barrier" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Barrier
|
<androidx.constraintlayout.widget.Barrier
|
@ -206,4 +206,5 @@
|
|||||||
<string name="settings_follow_req_color">Anfrage Icon</string>
|
<string name="settings_follow_req_color">Anfrage Icon</string>
|
||||||
<string name="settings_follow_color">Follow Icon</string>
|
<string name="settings_follow_color">Follow Icon</string>
|
||||||
<string name="settings_enable_toolbar_overlap">Kompakte Profilansicht</string>
|
<string name="settings_enable_toolbar_overlap">Kompakte Profilansicht</string>
|
||||||
|
<string name="account_user_unnamed">\'unbenannt\'</string>
|
||||||
</resources>
|
</resources>
|
@ -212,8 +212,9 @@
|
|||||||
<dimen name="dialog_linkpreview_padding">5dp</dimen>
|
<dimen name="dialog_linkpreview_padding">5dp</dimen>
|
||||||
<integer name="dialog_description_line_count">10</integer>
|
<integer name="dialog_description_line_count">10</integer>
|
||||||
|
|
||||||
<!--dimens of item_login.xml-->
|
<!--dimens of item_account.xml-->
|
||||||
<dimen name="login_name_textsize">16sp</dimen>
|
<dimen name="login_name_textsize_big">14sp</dimen>
|
||||||
|
<dimen name="login_name_textsize">12sp</dimen>
|
||||||
<dimen name="login_layout_padding">8dp</dimen>
|
<dimen name="login_layout_padding">8dp</dimen>
|
||||||
<dimen name="login_cross_size">36dp</dimen>
|
<dimen name="login_cross_size">36dp</dimen>
|
||||||
<dimen name="login_image_size">64dp</dimen>
|
<dimen name="login_image_size">64dp</dimen>
|
||||||
|
@ -230,5 +230,7 @@
|
|||||||
<string name="confirm_remove_account">Remove account from list?</string>
|
<string name="confirm_remove_account">Remove account from list?</string>
|
||||||
<string name="menu_select_account">select account</string>
|
<string name="menu_select_account">select account</string>
|
||||||
<string name="menu_add_account">add account</string>
|
<string name="menu_add_account">add account</string>
|
||||||
|
<string name="account_user_id_prefix" translatable="false">User ID:</string>
|
||||||
|
<string name="account_user_unnamed">\'unnamed\'</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user