本文整理匯總了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;
}
}