Improves UX

This commit is contained in:
stom79 2018-09-12 10:50:50 +02:00
parent 2d99e0d9ea
commit 4c96fb1670
2 changed files with 16 additions and 3 deletions

View File

@ -67,6 +67,7 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
private List<TrunkAccount> trunkAccounts;
private RelativeLayout mainLoader;
private String listId, listTitle;
private RelativeLayout no_action;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -87,6 +88,7 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
setTheme(R.style.AppThemeDark_NoActionBar);
}
setContentView(R.layout.activity_who_to_follow);
no_action = findViewById(R.id.no_action);
Toolbar toolbar = findViewById(R.id.toolbar);
progess_action = findViewById(R.id.progess_action);
if( theme == THEME_BLACK)
@ -130,9 +132,14 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
mainLoader.setVisibility(View.GONE);
WhoToFollowAccountsAdapter whoToFollowAccountsAdapter;
if( trunkAccounts != null){
ListView lv_list = findViewById(R.id.lv_list);
whoToFollowAccountsAdapter = new WhoToFollowAccountsAdapter(WhoToFollowActivity.this, trunkAccounts);
lv_list.setAdapter(whoToFollowAccountsAdapter);
if( trunkAccounts.size() > 0) {
ListView lv_list = findViewById(R.id.lv_list);
whoToFollowAccountsAdapter = new WhoToFollowAccountsAdapter(WhoToFollowActivity.this, trunkAccounts);
lv_list.setAdapter(whoToFollowAccountsAdapter);
}else {
no_action.setVisibility(View.VISIBLE);
return;
}
}else{
Toast.makeText(WhoToFollowActivity.this, R.string.toast_error, Toast.LENGTH_SHORT).show();
return;
@ -178,6 +185,11 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
account.setAcct(val[0]);
account.setInstance(val[1]);
new PostActionAsyncTask(WhoToFollowActivity.this, null, account, API.StatusAction.FOLLOW, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}else {
Toast.makeText(WhoToFollowActivity.this,R.string.toast_impossible_to_follow, Toast.LENGTH_LONG).show();
follow_accounts.setEnabled(true);
follow_accounts_select.setEnabled(true);
progess_action.setVisibility(View.GONE);
}
}

View File

@ -599,6 +599,7 @@
<string name="action_remote_instance_add">You don\'t follow any remote instances. Click on the \"+\" button to add a new one.</string>
<string name="about_trunk">Who to follow</string>
<string name="about_trunk_action">Trunk API</string>
<string name="toast_impossible_to_follow">Account(s) can\'t be followed</string>
<string-array translatable="false" name="proxy_type_choice">