Permalink
Browse files

The former matrixandroidsdk is now split into two parts

-> matrix-android-sdk is now the android matrix SDK repository
-> matrix-android-console is now the sample application which uses the matrix sdk.
  • Loading branch information...
1 parent eb270e5 commit 84be2fbc3ffd20c13a1022d85ab0574a31679574 @ylecollen ylecollen committed Jun 2, 2015
Showing 318 changed files with 24 additions and 14,181 deletions.
View
@@ -1 +0,0 @@
-/build
View
@@ -1,62 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 21
- buildToolsVersion '21.0.0'
-
- packagingOptions {
- exclude 'META-INF/LICENSE'
- exclude 'META-INF/NOTICE'
- }
-
- defaultConfig {
- applicationId "org.matrix.matrixandroidsdk"
- minSdkVersion 11
- targetSdkVersion 21
- versionCode 1
- versionName "0.3.1"
- }
-
- signingConfigs {
- release {
- storeFile file(project.hasProperty("RELEASE_STORE_FILE") ? RELEASE_STORE_FILE : "/dummy/path")
- storePassword project.hasProperty("RELEASE_STORE_PASSWORD") ? RELEASE_STORE_PASSWORD : "dummy password"
- keyAlias project.hasProperty("RELEASE_KEY_ALIAS") ? RELEASE_KEY_ALIAS : "dummy alias"
- keyPassword project.hasProperty("RELEASE_KEY_PASSWORD") ? RELEASE_KEY_PASSWORD : "dummy password"
- }
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
-
- matrixorg.initWith(buildTypes.release)
- matrixorg {
- signingConfig signingConfigs.release
- }
- }
-
- productFlavors {
- alpha {
- applicationId "org.matrix.androidsdk.alpha"
- versionCode 4
- versionName "0.3.2-alpha"
- }
- }
-
- lintOptions {
- disable 'InvalidPackage'
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile project(':sdk')
- compile 'com.android.support:appcompat-v7:21.0.+'
- compile 'com.android.support:cardview-v7:21.0.+'
- compile 'com.android.support:recyclerview-v7:21.0.+'
- compile 'com.google.android.gms:play-services:3.1.+'
-}
-
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Android\android-sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">Matrix Console (Alpha)</string>
- <string name="settings_config_build_number">Alpha Build: %s</string>
-</resources>
@@ -1,13 +0,0 @@
-package org.matrix.matrixandroidsdk;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
- */
-public class ApplicationTest extends ApplicationTestCase<Application> {
- public ApplicationTest() {
- super(Application.class);
- }
-}
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.matrix.matrixandroidsdk"
- android:versionName="0.3.1">
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.VIBRATE" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.SEND_SMS" />
- <uses-permission android:name="android.permission.READ_LOGS" />
-
- <!-- Google Cloud Messaging -->
- <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
- <uses-permission android:name="android.permission.WAKE_LOCK" />
- <permission
- android:name="${applicationId}.permission.C2D_MESSAGE"
- android:protectionLevel="signature" />
- <uses-permission
- android:name="${applicationId}.permission.C2D_MESSAGE" />
-
- <application
- android:allowBackup="true"
- android:name="org.matrix.matrixandroidsdk.ConsoleApplication"
- android:icon="@drawable/ic_launcher"
- android:logo="@drawable/logo"
- android:label="@string/app_name"
- android:largeHeap="true"
- android:theme="@style/AppTheme" >
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.LoginActivity"
- android:screenOrientation="portrait"
- android:theme="@style/AppTheme.NoActionBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.AccountCreationActivity"
- android:label="@string/create_account" >
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.SplashActivity"
- android:theme="@style/AppTheme.NoActionBar">
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.HomeActivity"
- android:label="@string/title_activity_home" >
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.RoomActivity"
- android:label="@string/title_activity_room"
- android:parentActivityName="org.matrix.matrixandroidsdk.activity.HomeActivity"
- android:launchMode="singleTop"
- android:windowSoftInputMode="stateHidden">
-
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="org.matrix.matrixandroidsdk.activity.HomeActivity"/>
-
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.RoomInfoActivity"
- android:label="@string/title_activity_room_info"
- android:parentActivityName="org.matrix.matrixandroidsdk.activity.RoomActivity">
-
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="org.matrix.matrixandroidsdk.activity.RoomActivity"/>
-
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.SettingsActivity"
- android:label="@string/title_activity_settings"
- android:windowSoftInputMode="stateHidden"
- android:parentActivityName="org.matrix.matrixandroidsdk.activity.HomeActivity">
-
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="org.matrix.matrixandroidsdk.activity.HomeActivity"/>
-
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.MemberDetailsActivity"
- android:label="@string/title_activity_member_details"
- android:parentActivityName="org.matrix.matrixandroidsdk.activity.RoomActivity">
-
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="org.matrix.matrixandroidsdk.activity.RoomActivity"/>
- </activity>
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.LockScreenActivity"
- android:theme="@android:style/Theme.Holo.Light.Dialog"
- android:excludeFromRecents="true"
- android:clearTaskOnLaunch="true"
- android:taskAffinity=""
- android:configChanges="orientation|screenSize"
- android:launchMode="singleTop"/>
-
- <activity
- android:name="org.matrix.matrixandroidsdk.activity.ImageWebViewActivity"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
-
- <receiver
- android:name=".gcm.GcmBroadcastReceiver"
- android:permission="com.google.android.c2dm.permission.SEND" >
- <intent-filter>
- <action android:name="com.google.android.c2dm.intent.RECEIVE" />
- <category android:name="org.matrix.matrixandroidsdk.gcm" />
- </intent-filter>
- </receiver>
-
- <service android:name=".gcm.GcmIntentService" />
-
- <service android:name="org.matrix.matrixandroidsdk.services.EventStreamService" />
-
- <provider
- android:authorities="org.matrix.matrixandroidsdk.ConsoleApplication.provider"
- android:name="org.matrix.matrixandroidsdk.db.ConsoleContentProvider"
- android:exported="true" />
-
- </application>
-
-</manifest>
@@ -1,95 +0,0 @@
-/*
- * Copyright 2014 OpenMarket Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.matrix.matrixandroidsdk;
-import android.app.Activity;
-import android.app.Application;
-
-import org.matrix.matrixandroidsdk.contacts.ContactsManager;
-import org.matrix.matrixandroidsdk.contacts.PIDsRetriever;
-import org.matrix.matrixandroidsdk.services.EventStreamService;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * The main application injection point
- */
-public class ConsoleApplication extends Application {
- private Timer mActivityTransitionTimer;
- private TimerTask mActivityTransitionTimerTask;
- public boolean isInBackground = true;
- private final long MAX_ACTIVITY_TRANSITION_TIME_MS = 2000;
-
- @Override
- public void onCreate() {
- super.onCreate();
- mActivityTransitionTimer = null;
- mActivityTransitionTimerTask = null;
-
- // get the contact update at application launch
- ContactsManager.refreshLocalContactsSnapshot(this);
-
- isInBackground = false;
- }
-
- public void startActivityTransitionTimer() {
- this.mActivityTransitionTimer = new Timer();
- this.mActivityTransitionTimerTask = new TimerTask() {
- public void run() {
- ConsoleApplication.this.isInBackground = true;
- PIDsRetriever.getIntance().onAppBackgrounded();
- }
- };
-
- this.mActivityTransitionTimer.schedule(mActivityTransitionTimerTask, MAX_ACTIVITY_TRANSITION_TIME_MS);
- }
-
- public void stopActivityTransitionTimer() {
- if (this.mActivityTransitionTimerTask != null) {
- this.mActivityTransitionTimerTask.cancel();
- }
-
- if (this.mActivityTransitionTimer != null) {
- this.mActivityTransitionTimer.cancel();
- }
-
- if (isInBackground) {
- // get the contact update at application launch
- ContactsManager.refreshLocalContactsSnapshot(this);
- }
-
- this.isInBackground = false;
- }
-
- static private Activity mCurrentActivity = null;
- public static void setCurrentActivity(Activity activity) {
- mCurrentActivity = activity;
- }
- public static Activity getCurrentActivity() { return mCurrentActivity; }
-
- /**
- * Return true if the application is in background.
- */
- public static boolean isAppInBackground() {
- if (mCurrentActivity != null) {
- return ((ConsoleApplication)(mCurrentActivity.getApplication())).isInBackground;
- }
-
- return true;
- }
-}
-
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 OpenMarket Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.matrix.matrixandroidsdk;
-
-import android.app.Activity;
-import android.util.Log;
-import android.widget.Toast;
-
-import org.matrix.androidsdk.rest.callback.ApiFailureCallback;
-import org.matrix.androidsdk.rest.model.MatrixError;
-import org.matrix.matrixandroidsdk.activity.CommonActivityUtils;
-
-public class ErrorListener implements ApiFailureCallback {
-
- private static final String LOG_TAG = "ErrorListener";
-
- private Activity mActivity;
-
- public ErrorListener(Activity activity) {
- mActivity = activity;
- }
-
- @Override
- public void onNetworkError(Exception e) {
- Log.e(LOG_TAG, "Network error: " + e.getMessage());
-
- // do not trigger toaster if the application is in background
- if (!ConsoleApplication.isAppInBackground()) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(mActivity, mActivity.getString(R.string.network_error), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
-
- @Override
- public void onMatrixError(MatrixError e) {
- Log.e(LOG_TAG, "Matrix error: " + e.errcode + " - " + e.error);
- // The access token was not recognized: log out
- if (MatrixError.UNKNOWN_TOKEN.equals(e.errcode)) {
- CommonActivityUtils.logout(mActivity);
- }
- }
-
- @Override
- public void onUnexpectedError(Exception e) {
- Log.e(LOG_TAG, "Unexpected error: " + e.getMessage());
- }
-}
Oops, something went wrong.

0 comments on commit 84be2fb

Please sign in to comment.