mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 09:07:48 -04:00
Bug fix: remove wrong view index when remove acc
This commit is contained in:
parent
1954f9633e
commit
7c530d41be
@ -710,7 +710,9 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
LinearLayout accountListLayout = accountDialog.findViewById(R.id.accountListLayout);
|
LinearLayout accountListLayout = accountDialog.findViewById(R.id.accountListLayout);
|
||||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
for (String s : new File(Tools.DIR_ACCOUNT_NEW).list()) {
|
String[] accountArr = new File(Tools.DIR_ACCOUNT_NEW).list();
|
||||||
|
for (int accountIndex = 0; accountIndex < accountArr.length; accountIndex++) {
|
||||||
|
String s = accountArr[accountIndex];
|
||||||
View child = inflater.inflate(R.layout.simple_account_list_item, null);
|
View child = inflater.inflate(R.layout.simple_account_list_item, null);
|
||||||
ImageView accountIcon = child.findViewById(R.id.accountitem_image_icon);
|
ImageView accountIcon = child.findViewById(R.id.accountitem_image_icon);
|
||||||
TextView accountName = child.findViewById(R.id.accountitem_text_name);
|
TextView accountName = child.findViewById(R.id.accountitem_text_name);
|
||||||
@ -783,7 +785,7 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface p1, int p2) {
|
public void onClick(DialogInterface p1, int p2) {
|
||||||
new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName);
|
new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName);
|
||||||
accountListLayout.removeViewsInLayout(0, 1);
|
accountListLayout.removeViewsInLayout(accountIndex, 1);
|
||||||
//Resize the window
|
//Resize the window
|
||||||
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int) Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*55)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) ));
|
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int) Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*55)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) ));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user