本文整理汇总了Java中org.matrix.androidsdk.MXSession.getCredentials方法的典型用法代码示例。如果您正苦于以下问题:Java MXSession.getCredentials方法的具体用法?Java MXSession.getCredentials怎么用?Java MXSession.getCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.matrix.androidsdk.MXSession
的用法示例。
在下文中一共展示了MXSession.getCredentials方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSession
import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
*Retrieve a session from an user Id.
* The application should be able to manage multi session.
* @param matrixId the matrix id
* @return the MXsession if it exists.
*/
public synchronized MXSession getSession(String matrixId) {
if (null != matrixId) {
ArrayList<MXSession> sessions;
synchronized (this) {
sessions = getSessions();
}
for (MXSession session : sessions) {
Credentials credentials = session.getCredentials();
if ((null != credentials) && (credentials.userId.equals(matrixId))) {
return session;
}
}
}
return getDefaultSession();
}
示例2: getSession
import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
* Retrieve a session from an user Id.
* The application should be able to manage multi session.
*
* @param matrixId the matrix id
* @return the MXsession if it exists.
*/
public synchronized MXSession getSession(String matrixId) {
if (null != matrixId) {
ArrayList<MXSession> sessions;
synchronized (this) {
sessions = getSessions();
}
for (MXSession session : sessions) {
Credentials credentials = session.getCredentials();
if ((null != credentials) && (credentials.userId.equals(matrixId))) {
return session;
}
}
}
return getDefaultSession();
}
示例3: onRegistrationDone
import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
* The account login / creation succeeds so create the dedicated session and store it.
*
* @param appCtx the application context.
* @param hsConfig the homeserver config
* @param credentials the credentials
* @param callback the callback
*/
private void onRegistrationDone(Context appCtx, HomeServerConnectionConfig hsConfig, Credentials credentials, SimpleApiCallback<HomeServerConnectionConfig> callback) {
// sanity check - GA issue
if (TextUtils.isEmpty(credentials.userId)) {
callback.onMatrixError(new MatrixError(MatrixError.FORBIDDEN, "No user id"));
return;
}
Collection<MXSession> sessions = Matrix.getMXSessions(appCtx);
boolean isDuplicated = false;
for (MXSession existingSession : sessions) {
Credentials cred = existingSession.getCredentials();
isDuplicated |= TextUtils.equals(credentials.userId, cred.userId) && TextUtils.equals(credentials.homeServer, cred.homeServer);
}
if (!isDuplicated) {
hsConfig.setCredentials(credentials);
MXSession session = Matrix.getInstance(appCtx).createSession(hsConfig);
Matrix.getInstance(appCtx).addSession(session);
}
callback.onSuccess(hsConfig);
}
示例4: VectorMemberDetailsDevicesAdapter
import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
* Constructor
*
* @param aContext app context
* @param aItemLayoutResourceId layout id to be displayed on each row
* @param aSession session
*/
public VectorMemberDetailsDevicesAdapter(Context aContext, int aItemLayoutResourceId, MXSession aSession) {
super(aContext, aItemLayoutResourceId);
mLayoutInflater = LayoutInflater.from(aContext);
mItemLayoutResourceId = aItemLayoutResourceId;
if (null != aSession.getCredentials()) {
myDeviceId = aSession.getCredentials().deviceId;
} else {
myDeviceId = null;
}
}