Search in sources :

Example 1 with User

use of pl.plajer.villagedefense3.User in project Douya by DreaminginCodeZH.

the class NavigationAccountListLayout method bind.

public void bind() {
    List<Account> accountList = new ArrayList<>(Arrays.asList(AccountUtils.getAccounts()));
    accountList.remove(AccountUtils.getActiveAccount());
    Account recentOneAccount = AccountUtils.getRecentOneAccount();
    if (recentOneAccount != null) {
        accountList.remove(recentOneAccount);
    }
    Account recentTwoAccount = AccountUtils.getRecentTwoAccount();
    if (recentTwoAccount != null) {
        accountList.remove(recentTwoAccount);
    }
    if (recentOneAccount != null) {
        accountList.add(recentOneAccount);
    }
    if (recentTwoAccount != null) {
        accountList.add(recentTwoAccount);
    }
    int i = 0;
    for (final Account account : accountList) {
        if (i >= mAccountList.getChildCount()) {
            ViewUtils.inflateInto(R.layout.navigation_account_item, mAccountList);
        }
        View accountLayout = mAccountList.getChildAt(i);
        accountLayout.setVisibility(VISIBLE);
        AccountLayoutHolder holder = (AccountLayoutHolder) accountLayout.getTag();
        if (holder == null) {
            holder = new AccountLayoutHolder(accountLayout);
            accountLayout.setTag(holder);
        }
        User user = mAdapter.getUser(account);
        if (user != null) {
            ImageUtils.loadNavigationAccountListAvatar(holder.avatarImage, user.getLargeAvatarOrAvatar());
        } else {
            holder.avatarImage.setImageResource(R.drawable.avatar_icon_grey600_40dp);
        }
        holder.nameText.setText(mAdapter.getPartialUser(account).name);
        accountLayout.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                if (mListener != null) {
                    mListener.switchToAccount(account);
                }
            }
        });
        ++i;
    }
    ViewUtils.setVisibleOrGone(mDividerView, i > 0);
    for (int count = mAccountList.getChildCount(); i < count; ++i) {
        mAccountList.getChildAt(i).setVisibility(GONE);
    }
}
Also used : Account(android.accounts.Account) User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView)

Example 2 with User

use of pl.plajer.villagedefense3.User in project Douya by DreaminginCodeZH.

the class ProfileActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(0, 0);
    // Calls ensureSubDecor().
    findViewById(android.R.id.content);
    if (savedInstanceState == null) {
        Intent intent = getIntent();
        String userIdOrUid = intent.getStringExtra(EXTRA_USER_ID_OR_UID);
        SimpleUser simpleUser = intent.getParcelableExtra(EXTRA_SIMPLE_USER);
        User user = intent.getParcelableExtra(EXTRA_USER_INFO);
        mProfileFragment = ProfileFragment.newInstance(userIdOrUid, simpleUser, user);
        FragmentUtils.add(mProfileFragment, this, android.R.id.content);
    } else {
        mProfileFragment = FragmentUtils.findById(this, android.R.id.content);
    }
}
Also used : SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) User(me.zhanghai.android.douya.network.api.info.apiv2.User) Intent(android.content.Intent)

Example 3 with User

use of pl.plajer.villagedefense3.User in project Douya by DreaminginCodeZH.

the class UserResource method onDestroy.

@Override
public void onDestroy() {
    super.onDestroy();
    if (has()) {
        User user = get();
        setArguments(user.getIdOrUid(), user, user);
    }
}
Also used : User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)

Example 4 with User

use of pl.plajer.villagedefense3.User in project camel by apache.

the class UserProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final User in = messageToUser(msg);
    final User out = osV3Client.identity().users().update(in);
    msg.setBody(out);
}
Also used : User(org.openstack4j.model.identity.v3.User) Message(org.apache.camel.Message)

Example 5 with User

use of pl.plajer.villagedefense3.User in project camel by apache.

the class UserProducerTest method setUp.

@Before
public void setUp() {
    producer = new UserProducer(endpoint, client);
    when(userService.create(any(User.class))).thenReturn(testOSuser);
    when(userService.get(anyString())).thenReturn(testOSuser);
    List<User> getAllList = new ArrayList<>();
    getAllList.add(testOSuser);
    getAllList.add(testOSuser);
    doReturn(getAllList).when(userService).list();
    dummyUser = createUser();
    when(testOSuser.getName()).thenReturn(dummyUser.getName());
    when(testOSuser.getDescription()).thenReturn(dummyUser.getDescription());
    when(testOSuser.getPassword()).thenReturn(dummyUser.getPassword());
    when(testOSuser.getDomainId()).thenReturn(dummyUser.getDomainId());
    when(testOSuser.getEmail()).thenReturn(dummyUser.getEmail());
}
Also used : User(org.openstack4j.model.identity.v3.User) ArrayList(java.util.ArrayList) UserProducer(org.apache.camel.component.openstack.keystone.producer.UserProducer) Before(org.junit.Before)

Aggregations

User (pl.plajer.villagedefense3.User)30 Player (org.bukkit.entity.Player)19 User (org.gluu.oxtrust.model.scim2.User)17 EventHandler (org.bukkit.event.EventHandler)11 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)10 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)10 User (org.openstack4j.model.identity.v3.User)10 Arena (pl.plajer.villagedefense3.arena.Arena)9 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)8 ArrayList (java.util.ArrayList)7 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)7 Date (java.util.Date)6 SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)6 User (me.zhanghai.android.douya.network.api.info.apiv2.User)6 ItemStack (org.bukkit.inventory.ItemStack)5 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)5 Test (org.junit.Test)5 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)4 BigDecimal (java.math.BigDecimal)4 URI (java.net.URI)4