├── .gitignore ├── AUTHORS.rst ├── CHANGES.rst ├── CONTRIBUTING.rst ├── LICENSE ├── README.md ├── build.gradle ├── build_alpha.sh ├── console ├── .gitignore ├── build.gradle ├── google-services.json ├── libs │ └── matrix-sdk.aar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── org │ │ └── matrix │ │ └── console │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── org │ │ │ └── matrix │ │ │ └── console │ │ │ ├── ConsoleApplication.java │ │ │ ├── ErrorListener.java │ │ │ ├── EventEmitter.java │ │ │ ├── LoginHandler.java │ │ │ ├── Matrix.java │ │ │ ├── MyPresenceManager.java │ │ │ ├── UnrecognizedCertHandler.java │ │ │ ├── ViewedRoomTracker.java │ │ │ ├── activity │ │ │ ├── AccountCreationActivity.java │ │ │ ├── CallViewActivity.java │ │ │ ├── CommonActivityUtils.java │ │ │ ├── FallbackLoginActivity.java │ │ │ ├── HomeActivity.java │ │ │ ├── ImageSliderActivity.java │ │ │ ├── ImageWebViewActivity.java │ │ │ ├── LockScreenActivity.java │ │ │ ├── LoginActivity.java │ │ │ ├── MXCActionBarActivity.java │ │ │ ├── MemberDetailsActivity.java │ │ │ ├── NotificationSettingsActivity.java │ │ │ ├── RoomActivity.java │ │ │ ├── SettingsActivity.java │ │ │ └── SplashActivity.java │ │ │ ├── adapters │ │ │ ├── AccountsAdapter.java │ │ │ ├── AdapterUtils.java │ │ │ ├── ConsoleMessagesAdapter.java │ │ │ ├── ConsoleRoomMembersAdapter.java │ │ │ ├── ConsoleRoomSummaryAdapter.java │ │ │ ├── ContactsListAdapter.java │ │ │ ├── DrawerAdapter.java │ │ │ ├── ImageCompressionDescription.java │ │ │ ├── ImageSizesAdapter.java │ │ │ ├── ImagesSliderAdapter.java │ │ │ ├── MembersInvitationAdapter.java │ │ │ ├── NotificationsRulesAdapter.java │ │ │ └── ReadReceiptsAdapter.java │ │ │ ├── car │ │ │ └── CarBroadcastReceiver.java │ │ │ ├── contacts │ │ │ ├── Contact.java │ │ │ ├── ContactsManager.java │ │ │ └── PIDsRetriever.java │ │ │ ├── db │ │ │ └── ConsoleContentProvider.java │ │ │ ├── fragments │ │ │ ├── AccountsSelectionDialogFragment.java │ │ │ ├── ConsoleMessageListFragment.java │ │ │ ├── ContactsListDialogFragment.java │ │ │ ├── ImageSizeSelectionDialogFragment.java │ │ │ ├── MembersInvitationDialogFragment.java │ │ │ ├── MessageDetailsFragment.java │ │ │ ├── ReadReceiptsDialogFragment.java │ │ │ ├── RoomCreationDialogFragment.java │ │ │ ├── RoomInfoUpdateDialogFragment.java │ │ │ └── RoomMembersDialogFragment.java │ │ │ ├── ga │ │ │ └── Analytics.java │ │ │ ├── gcm │ │ │ ├── GcmRegistrationManager.java │ │ │ ├── MatrixGcmListenerService.java │ │ │ └── MatrixInstanceIDListenerService.java │ │ │ ├── services │ │ │ └── EventStreamService.java │ │ │ ├── store │ │ │ └── LoginStorage.java │ │ │ ├── util │ │ │ ├── LogUtilities.java │ │ │ ├── NotificationUtils.java │ │ │ ├── RageShake.java │ │ │ ├── ResourceUtils.java │ │ │ ├── SlidableImageInfo.java │ │ │ └── UIUtils.java │ │ │ └── view │ │ │ ├── AddAccountAlertDialog.java │ │ │ ├── ConsoleEditText.java │ │ │ └── SwipableWebView.java │ └── res │ │ ├── anim │ │ ├── anim_slide_in_bottom.xml │ │ ├── anim_slide_nothing.xml │ │ └── anim_slide_out_bottom.xml │ │ ├── drawable-hdpi │ │ ├── ic_menu_search.png │ │ └── matrix_ic_launcher.png │ │ ├── drawable-mdpi │ │ ├── ic_menu_search.png │ │ └── matrix_ic_launcher.png │ │ ├── drawable-xhdpi │ │ ├── ic_drawer.png │ │ ├── ic_menu_search.png │ │ ├── logo.png │ │ ├── matrix_console.png │ │ └── matrix_ic_launcher.png │ │ ├── drawable-xxhdpi │ │ ├── ic_material_bug_report.png │ │ ├── ic_material_bug_report_small.png │ │ ├── ic_material_call.png │ │ ├── ic_material_camera.png │ │ ├── ic_material_clear.png │ │ ├── ic_material_copy.png │ │ ├── ic_material_delete.png │ │ ├── ic_material_description.png │ │ ├── ic_material_done_all.png │ │ ├── ic_material_exit_to_app.png │ │ ├── ic_material_exit_to_app_small.png │ │ ├── ic_material_file.png │ │ ├── ic_material_find_in_page.png │ │ ├── ic_material_forward.png │ │ ├── ic_material_group.png │ │ ├── ic_material_group_add.png │ │ ├── ic_material_group_add_small.png │ │ ├── ic_material_group_small.png │ │ ├── ic_material_home.png │ │ ├── ic_material_menu.png │ │ ├── ic_material_message.png │ │ ├── ic_material_paste.png │ │ ├── ic_material_person_add.png │ │ ├── ic_material_person_add_small.png │ │ ├── ic_material_remove_circle_outline.png │ │ ├── ic_material_save.png │ │ ├── ic_material_search.png │ │ ├── ic_material_send.png │ │ ├── ic_material_settings.png │ │ ├── ic_material_settings_applications.png │ │ ├── ic_material_settings_applications_small.png │ │ ├── ic_material_settings_small.png │ │ ├── ic_material_share.png │ │ ├── ic_material_videocam.png │ │ ├── ic_material_volume.png │ │ ├── ic_menu_allfriends.png │ │ ├── ic_menu_block.png │ │ ├── ic_menu_blocked_user.png │ │ ├── ic_menu_btn_add.png │ │ ├── ic_menu_cc_am.png │ │ ├── ic_menu_delete.png │ │ ├── ic_menu_edit.png │ │ ├── ic_menu_friendslist.png │ │ ├── ic_menu_home.png │ │ ├── ic_menu_info_details.png │ │ ├── ic_menu_invite.png │ │ ├── ic_menu_manage.png │ │ ├── ic_menu_mapmode.png │ │ ├── ic_menu_matrix_transparent.png │ │ ├── ic_menu_notifications.png │ │ ├── ic_menu_refresh.png │ │ ├── ic_menu_search.png │ │ ├── ic_menu_settings_holo_light.png │ │ ├── ic_menu_small_matrix.png │ │ ├── ic_menu_small_matrix_transparent.png │ │ ├── ic_menu_start_conversation.png │ │ ├── logo_large.png │ │ ├── matrix_ic_launcher.png │ │ ├── matrix_icon_user.png │ │ ├── notification_add.png │ │ ├── notification_delete.png │ │ ├── notification_pause.png │ │ ├── notification_play.png │ │ ├── video.png │ │ └── voice.png │ │ ├── drawable │ │ ├── avatar_mask.xml │ │ └── black_border.xml │ │ ├── layout │ │ ├── account_section_settings.xml │ │ ├── activity_account_creation.xml │ │ ├── activity_callview.xml │ │ ├── activity_home.xml │ │ ├── activity_image_web_view.xml │ │ ├── activity_images_slider.xml │ │ ├── activity_lock_screen.xml │ │ ├── activity_login.xml │ │ ├── activity_login_fallback.xml │ │ ├── activity_member_details.xml │ │ ├── activity_notification_settings.xml │ │ ├── activity_public_rooms.xml │ │ ├── activity_room.xml │ │ ├── activity_settings.xml │ │ ├── activity_splash.xml │ │ ├── adapter_drawer_header.xml │ │ ├── adapter_drawer_item.xml │ │ ├── adapter_item_account.xml │ │ ├── adapter_item_contact.xml │ │ ├── adapter_item_image_size.xml │ │ ├── adapter_item_members_invitation.xml │ │ ├── adapter_item_read_receipt.xml │ │ ├── adapter_item_waiting_room_members.xml │ │ ├── adapter_notifications_existing_item.xml │ │ ├── adapter_notifications_new_item.xml │ │ ├── adapter_notifications_room_item.xml │ │ ├── dialog_room_selection.xml │ │ ├── fragment_contacts_list.xml │ │ ├── fragment_dialog_accounts_list.xml │ │ ├── fragment_dialog_add_account.xml │ │ ├── fragment_dialog_create_room.xml │ │ ├── fragment_dialog_invitation_member_list.xml │ │ ├── fragment_dialog_member_list.xml │ │ ├── fragment_dialog_room_info.xml │ │ ├── fragment_message_details.xml │ │ ├── large_round_avatar.xml │ │ └── ssl_fingerprint_prompt.xml │ │ ├── menu │ │ ├── home.xml │ │ ├── public_rooms.xml │ │ └── room.xml │ │ ├── raw │ │ ├── all_licenses.txt │ │ ├── callend.ogg │ │ ├── ring.ogg │ │ └── ringback.ogg │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── analytics.xml │ │ ├── colors.xml │ │ ├── colors_materials.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── automotive_app_desc.xml │ └── main0java │ └── org │ └── matrix │ └── matrixandroidsdk │ └── activity │ └── MXCActionBarActivity.java ├── google-services.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | #IDEs 2 | /.idea 3 | *.iml 4 | 5 | #OS 6 | .DS_Store 7 | 8 | #builds 9 | /build 10 | *.apk 11 | 12 | .gradle 13 | /local.properties 14 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Joachim reigle 2 | * First implementations of the android client 3 | 4 | Kegan Dougal 5 | * Developper 6 | 7 | Yannick Le Collen 8 | * Developper 9 | 10 | Leon Handreke 11 | * First implementation of the gcm. 12 | 13 | Friedger Müffke 14 | * Google car implementation 15 | 16 | Matthew Hodgson 17 | * General doc & housekeeping -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Console 2 | ======= 3 | 4 | Console is an android Matrix client. If offers features such as multi-account and a selective control over notifications. 5 | 6 | It uses https://github.com/matrix-org/matrix-android-sdk 7 | 8 | Getting the APK 9 | ================== 10 | 11 | The most recent build can be retrieved from the Jenkins server [here](http://www.matrix.org/jenkins/job/AndroidConsoleDevelop/lastBuild/artifact/console/build/outputs/apk/console-alpha-debug.apk). 12 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.5.0' 9 | classpath 'com.google.gms:google-services:1.5.0' 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /build_alpha.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./gradlew clean build 3 | #cp app/build/outputs/apk/app-alpha-matrixorg.apk ./alpha.apk 4 | cp console/build/outputs/apk/console-alpha-matrixorg.apk ./alpha.apk 5 | -------------------------------------------------------------------------------- /console/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /console/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | 4 | android { 5 | compileSdkVersion 21 6 | buildToolsVersion '21.0.0' 7 | 8 | packagingOptions { 9 | exclude 'META-INF/LICENSE' 10 | exclude 'META-INF/NOTICE' 11 | } 12 | 13 | defaultConfig { 14 | applicationId "org.matrix.console" 15 | minSdkVersion 11 16 | targetSdkVersion 21 17 | versionCode 16 18 | versionName "0.5.4" 19 | } 20 | 21 | signingConfigs { 22 | release { 23 | storeFile file(project.hasProperty("RELEASE_STORE_FILE") ? RELEASE_STORE_FILE : "/dummy/path") 24 | storePassword project.hasProperty("RELEASE_STORE_PASSWORD") ? RELEASE_STORE_PASSWORD : "dummy password" 25 | keyAlias project.hasProperty("RELEASE_KEY_ALIAS") ? RELEASE_KEY_ALIAS : "dummy alias" 26 | keyPassword project.hasProperty("RELEASE_KEY_PASSWORD") ? RELEASE_KEY_PASSWORD : "dummy password" 27 | } 28 | } 29 | 30 | buildTypes { 31 | debug { 32 | resValue "string", "git_revision", "\"${gitRevision()}\"" 33 | resValue "string", "git_revision_unix_date", "\"${gitRevisionUnixDate()}\"" 34 | resValue "string", "git_revision_date", "\"${gitRevisionDate()}\"" 35 | } 36 | 37 | release { 38 | resValue "string", "git_revision", "\"${gitRevision()}\"" 39 | resValue "string", "git_revision_unix_date", "\"${gitRevisionUnixDate()}\"" 40 | resValue "string", "git_revision_date", "\"${gitRevisionDate()}\"" 41 | 42 | minifyEnabled false 43 | shrinkResources true 44 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 45 | } 46 | 47 | matrixorg.initWith(buildTypes.release) 48 | matrixorg { 49 | signingConfig signingConfigs.release 50 | } 51 | } 52 | 53 | productFlavors { 54 | alpha { 55 | applicationId "org.matrix.androidsdk.alpha" 56 | versionCode 16 57 | versionName "0.5.4" 58 | } 59 | } 60 | 61 | lintOptions { 62 | disable 'InvalidPackage' 63 | } 64 | 65 | repositories { 66 | flatDir { 67 | dir 'libs' 68 | } 69 | } 70 | } 71 | 72 | def gitRevision() { 73 | def cmd = "git rev-parse --short HEAD" 74 | return cmd.execute().text.trim() 75 | } 76 | 77 | def gitRevisionUnixDate() { 78 | def cmd = "git show -s --format=%ct HEAD^{commit}" 79 | return cmd.execute().text.trim() 80 | } 81 | 82 | def gitRevisionDate() { 83 | def cmd = "git show -s --format=%ci HEAD^{commit}" 84 | return cmd.execute().text.trim() 85 | } 86 | 87 | dependencies { 88 | compile fileTree(dir: 'libs', include: ['*.jar']) 89 | 90 | compile 'me.leolin:ShortcutBadger:1.1.0+@aar' 91 | 92 | compile 'com.android.support:appcompat-v7:21.0.+' 93 | compile 'com.android.support:cardview-v7:21.0.+' 94 | compile 'com.android.support:recyclerview-v7:21.0.+' 95 | compile 'com.google.android.gms:play-services-gcm:8.3.0' 96 | compile 'com.google.android.gms:play-services-analytics:8.3.0' 97 | 98 | compile 'com.squareup.retrofit:retrofit:1.6.1' 99 | compile 'com.google.code.gson:gson:2.3' 100 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' 101 | compile 'com.squareup.okhttp:okhttp:2.0.0' 102 | compile 'io.pristine:libjingle:9690@aar' 103 | compile 'org.sufficientlysecure:html-textview:1.4' 104 | 105 | compile(name: 'matrix-sdk', ext: 'aar') 106 | } 107 | 108 | -------------------------------------------------------------------------------- /console/google-services.json: -------------------------------------------------------------------------------- 1 | {"project_info":{"project_id":"matrix-console-alpha","project_number":"546327642826","name":"Matrix Console Alpha"},"client":[{"client_info":{"client_id":"android:org.matrix.androidsdk.alpha","client_type":1,"android_client_info":{"package_name":"org.matrix.androidsdk.alpha"}},"oauth_client":[],"services":{"analytics_service":{"status":1},"cloud_messaging_service":{"status":2,"apns_config":[]},"appinvite_service":{"status":1,"other_platform_oauth_client":[]},"google_signin_service":{"status":1},"ads_service":{"status":1}}}]} -------------------------------------------------------------------------------- /console/libs/matrix-sdk.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/libs/matrix-sdk.aar -------------------------------------------------------------------------------- /console/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /console/src/androidTest/java/org/matrix/console/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package org.matrix.console; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/ErrorListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console; 17 | 18 | import android.app.Activity; 19 | import android.util.Log; 20 | import android.widget.Toast; 21 | 22 | import org.matrix.androidsdk.HomeserverConnectionConfig; 23 | import org.matrix.androidsdk.MXSession; 24 | import org.matrix.androidsdk.rest.callback.ApiFailureCallback; 25 | import org.matrix.androidsdk.rest.model.MatrixError; 26 | import org.matrix.androidsdk.ssl.CertUtil; 27 | import org.matrix.androidsdk.ssl.Fingerprint; 28 | import org.matrix.androidsdk.ssl.UnrecognizedCertificateException; 29 | import org.matrix.console.activity.CommonActivityUtils; 30 | import org.matrix.console.store.LoginStorage; 31 | 32 | public class ErrorListener implements ApiFailureCallback { 33 | 34 | private static final String LOG_TAG = "ErrorListener"; 35 | 36 | private Activity mActivity; 37 | private MXSession mSession; 38 | 39 | public ErrorListener(MXSession session, Activity activity) { 40 | mSession = session; 41 | mActivity = activity; 42 | } 43 | 44 | @Override 45 | public void onNetworkError(final Exception e) { 46 | Log.e(LOG_TAG, "Network error: " + e.getMessage()); 47 | 48 | // do not trigger toaster if the application is in background 49 | if (!ConsoleApplication.isAppInBackground()) { 50 | UnrecognizedCertificateException unrecCertEx = CertUtil.getCertificateException(e); 51 | if (unrecCertEx == null) { 52 | handleNetworkError(e); 53 | return; 54 | } 55 | 56 | final Fingerprint fingerprint = unrecCertEx.getFingerprint(); 57 | Log.d(LOG_TAG, "Found fingerprint: SHA-256: " + fingerprint.getBytesAsHexString()); 58 | 59 | mActivity.runOnUiThread(new Runnable() { 60 | @Override 61 | public void run() { 62 | UnrecognizedCertHandler.show(mSession.getHomeserverConfig(), fingerprint, true, new UnrecognizedCertHandler.Callback() { 63 | @Override 64 | public void onAccept() { 65 | LoginStorage loginStorage = Matrix.getInstance(mActivity.getApplicationContext()).getLoginStorage(); 66 | loginStorage.replaceCredentials(mSession.getHomeserverConfig()); 67 | } 68 | 69 | @Override 70 | public void onIgnore() { 71 | handleNetworkError(e); 72 | } 73 | 74 | @Override 75 | public void onReject() { 76 | CommonActivityUtils.logout(mActivity, mSession, true); 77 | } 78 | }); 79 | } 80 | }); 81 | 82 | } 83 | } 84 | 85 | private void handleNetworkError(Exception e) { 86 | if (!ConsoleApplication.isAppInBackground()) { 87 | mActivity.runOnUiThread(new Runnable() { 88 | @Override 89 | public void run() { 90 | Toast.makeText(mActivity, mActivity.getString(R.string.network_error), Toast.LENGTH_SHORT).show(); 91 | } 92 | }); 93 | } 94 | } 95 | 96 | @Override 97 | public void onMatrixError(MatrixError e) { 98 | Log.e(LOG_TAG, "Matrix error: " + e.errcode + " - " + e.error); 99 | // The access token was not recognized: log out 100 | if (MatrixError.UNKNOWN_TOKEN.equals(e.errcode)) { 101 | CommonActivityUtils.logout(mActivity); 102 | } 103 | } 104 | 105 | @Override 106 | public void onUnexpectedError(Exception e) { 107 | Log.e(LOG_TAG, "Unexpected error: " + e.getMessage()); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/EventEmitter.java: -------------------------------------------------------------------------------- 1 | package org.matrix.console; 2 | 3 | 4 | import android.os.Handler; 5 | import android.os.Looper; 6 | import android.util.Log; 7 | 8 | import java.util.HashSet; 9 | import java.util.Set; 10 | 11 | public class EventEmitter { 12 | private static final String LOG_TAG = "EventEmitter"; 13 | 14 | private Set> mCallbacks; 15 | 16 | Handler mUiHandler; 17 | 18 | public EventEmitter() { 19 | mCallbacks = new HashSet<>(); 20 | mUiHandler = new Handler(Looper.getMainLooper()); 21 | } 22 | 23 | public void register(Listener cb) { 24 | mCallbacks.add(cb); 25 | } 26 | 27 | public void unregister(Listener cb) { 28 | mCallbacks.remove(cb); 29 | } 30 | 31 | /** 32 | * Fires all registered callbacks on the UI thread. 33 | * @param t 34 | */ 35 | public void fire(final T t) { 36 | final Set> callbacks = new HashSet<>(mCallbacks); 37 | 38 | mUiHandler.post(new Runnable() { 39 | @Override 40 | public void run() { 41 | for (Listener cb : callbacks) { 42 | try { 43 | cb.onEventFired(EventEmitter.this, t); 44 | } catch (Exception e) { 45 | Log.e(LOG_TAG, "Callback threw: " + e.getMessage(), e); 46 | } 47 | } 48 | } 49 | } 50 | ); 51 | } 52 | 53 | public interface Listener { 54 | void onEventFired(EventEmitter emitter, T t); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/ViewedRoomTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console; 17 | 18 | /** 19 | * Singleton class for tracking the currently viewed room. 20 | */ 21 | public class ViewedRoomTracker { 22 | 23 | private static ViewedRoomTracker instance = null; 24 | 25 | private String mViewedRoomId = null; 26 | private String mMatrixId = null; 27 | 28 | private ViewedRoomTracker(){ 29 | } 30 | 31 | public static synchronized ViewedRoomTracker getInstance() { 32 | if (instance == null) { 33 | instance = new ViewedRoomTracker(); 34 | } 35 | return instance; 36 | } 37 | 38 | public String getViewedRoomId() { 39 | return mViewedRoomId; 40 | } 41 | 42 | public String getMatrixId() { 43 | return mMatrixId; 44 | } 45 | 46 | public void setViewedRoomId(String roomId) { 47 | mViewedRoomId = roomId; 48 | } 49 | 50 | public void setMatrixId(String matrixId) { 51 | mMatrixId = matrixId; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/activity/ImageSliderActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.activity; 18 | 19 | import android.annotation.SuppressLint; 20 | import android.content.Intent; 21 | import android.graphics.Point; 22 | import android.os.Build; 23 | import android.os.Bundle; 24 | import android.support.v4.app.FragmentActivity; 25 | import android.support.v4.view.ViewPager; 26 | import android.util.Log; 27 | import android.view.View; 28 | 29 | import org.matrix.androidsdk.HomeserverConnectionConfig; 30 | import org.matrix.androidsdk.MXSession; 31 | import org.matrix.console.Matrix; 32 | import org.matrix.console.R; 33 | import org.matrix.console.adapters.ImagesSliderAdapter; 34 | import org.matrix.console.util.SlidableImageInfo; 35 | 36 | import java.util.List; 37 | 38 | public class ImageSliderActivity extends FragmentActivity { 39 | 40 | public static final String KEY_INFO_LIST = "org.matrix.console.activity.ImageSliderActivity.KEY_INFO_LIST"; 41 | public static final String KEY_INFO_LIST_INDEX = "org.matrix.console.activity.ImageSliderActivity.KEY_INFO_LIST_INDEX"; 42 | 43 | public static final String KEY_THUMBNAIL_WIDTH = "org.matrix.console.activity.ImageSliderActivity.KEY_THUMBNAIL_WIDTH"; 44 | public static final String KEY_THUMBNAIL_HEIGHT = "org.matrix.console.activity.ImageSliderActivity.KEY_THUMBNAIL_HEIGHT"; 45 | 46 | public static final String EXTRA_MATRIX_ID = "org.matrix.console.activity.ImageSliderActivity.EXTRA_MATRIX_ID"; 47 | 48 | public class DepthPageTransformer implements ViewPager.PageTransformer { 49 | private static final float MIN_SCALE = 0.75f; 50 | 51 | public void transformPage(View view, float position) { 52 | int pageWidth = view.getWidth(); 53 | 54 | if (position < -1) { // [-Infinity,-1) 55 | // This page is way off-screen to the left. 56 | view.setAlpha(0); 57 | 58 | } else if (position <= 0) { // [-1,0] 59 | // Use the default slide transition when moving to the left page 60 | view.setAlpha(1); 61 | view.setTranslationX(0); 62 | view.setScaleX(1); 63 | view.setScaleY(1); 64 | 65 | } else if (position <= 1) { // (0,1] 66 | // Fade the page out. 67 | view.setAlpha(1 - position); 68 | 69 | // Counteract the default slide transition 70 | view.setTranslationX(pageWidth * -position); 71 | 72 | // Scale the page down (between MIN_SCALE and 1) 73 | float scaleFactor = MIN_SCALE 74 | + (1 - MIN_SCALE) * (1 - Math.abs(position)); 75 | view.setScaleX(scaleFactor); 76 | view.setScaleY(scaleFactor); 77 | 78 | } else { // (1,+Infinity] 79 | // This page is way off-screen to the right. 80 | view.setAlpha(0); 81 | } 82 | } 83 | } 84 | 85 | /** 86 | * Return the used MXSession from an intent. 87 | * @param intent 88 | * @return the MXsession if it exists. 89 | */ 90 | private MXSession getSession(Intent intent) { 91 | String matrixId = intent.getStringExtra(EXTRA_MATRIX_ID); 92 | return Matrix.getInstance(getApplicationContext()).getSession(matrixId); 93 | } 94 | 95 | @Override 96 | public void onCreate(Bundle savedInstanceState) { 97 | 98 | if (CommonActivityUtils.shouldRestartApp()) { 99 | CommonActivityUtils.restartApp(this); 100 | } 101 | 102 | super.onCreate(savedInstanceState); 103 | setContentView(R.layout.activity_images_slider); 104 | 105 | ViewPager viewPager = (ViewPager)findViewById(R.id.view_pager); 106 | 107 | final Intent intent = getIntent(); 108 | 109 | List listImageMessages = (List)intent.getSerializableExtra(KEY_INFO_LIST); 110 | int position = intent.getIntExtra(KEY_INFO_LIST_INDEX, 0); 111 | int maxImageWidth = intent.getIntExtra(KEY_THUMBNAIL_WIDTH, 0); 112 | int maxImageHeight = intent.getIntExtra(ImageSliderActivity.KEY_THUMBNAIL_HEIGHT, 0); 113 | 114 | MXSession session = getSession(intent); 115 | HomeserverConnectionConfig hsConfig = session != null ? session.getHomeserverConfig() : null; 116 | 117 | ImagesSliderAdapter adapter = new ImagesSliderAdapter(this, hsConfig, listImageMessages, maxImageWidth, maxImageHeight); 118 | viewPager.setAdapter(adapter); 119 | viewPager.setCurrentItem(position); 120 | viewPager.setPageTransformer(true, new DepthPageTransformer()); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/AccountsAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.text.TextUtils; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.ArrayAdapter; 25 | import android.widget.ImageView; 26 | import android.widget.TextView; 27 | 28 | import org.matrix.androidsdk.MXSession; 29 | import org.matrix.console.R; 30 | 31 | import org.matrix.androidsdk.data.MyUser; 32 | import org.matrix.androidsdk.db.MXMediasCache; 33 | 34 | /** 35 | * An adapter which can display m.room.member content. 36 | */ 37 | public class AccountsAdapter extends ArrayAdapter { 38 | 39 | protected Context mContext; 40 | private LayoutInflater mLayoutInflater; 41 | private int mLayoutResourceId; 42 | 43 | private MXMediasCache mMediasCache = null; 44 | 45 | /** 46 | * Construct an adapter which will display a list of accounst 47 | * @param context Activity context 48 | * @param layoutResourceId The resource ID of the layout for each item. 49 | * the IDs: roomMembersAdapter_name, roomMembersAdap 50 | * @param mediasCache the media cache 51 | */ 52 | public AccountsAdapter(Context context, int layoutResourceId, MXMediasCache mediasCache) { 53 | super(context, layoutResourceId); 54 | mContext = context; 55 | mLayoutResourceId = layoutResourceId; 56 | mLayoutInflater = LayoutInflater.from(mContext); 57 | mMediasCache = mediasCache; 58 | } 59 | 60 | @Override 61 | public View getView(int position, View convertView, ViewGroup parent) { 62 | if (convertView == null) { 63 | convertView = mLayoutInflater.inflate(mLayoutResourceId, parent, false); 64 | } 65 | 66 | MXSession session = getItem(position); 67 | MyUser myUser = session.getMyUser(); 68 | 69 | TextView displayNameTextView = (TextView)convertView.findViewById(R.id.accountAdapter_name); 70 | TextView matrixIdTextView = (TextView)convertView.findViewById(R.id.accountAdapte_userId); 71 | 72 | if (TextUtils.isEmpty(myUser.displayname)) { 73 | displayNameTextView.setText(myUser.user_id); 74 | matrixIdTextView.setText(""); 75 | } else { 76 | displayNameTextView.setText(myUser.displayname); 77 | matrixIdTextView.setText(myUser.user_id); 78 | } 79 | 80 | ImageView avatarView = (ImageView)convertView.findViewById(R.id.avatar_img); 81 | avatarView.setImageResource(R.drawable.ic_contact_picture_holo_light); 82 | 83 | if (!TextUtils.isEmpty(myUser.getAvatarUrl())) { 84 | int size = getContext().getResources().getDimensionPixelSize(R.dimen.member_list_avatar_size); 85 | mMediasCache.loadAvatarThumbnail(session.getHomeserverConfig(), avatarView, myUser.getAvatarUrl(), size); 86 | } 87 | 88 | return convertView; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/AdapterUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.app.Activity; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.content.pm.PackageManager; 23 | import android.content.pm.ResolveInfo; 24 | import android.net.Uri; 25 | import android.util.Log; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * Contains useful functions for adapters. 31 | */ 32 | public class AdapterUtils { 33 | private static final String LOG_TAG = "AdapterUtils"; 34 | 35 | /** Checks if the device can send SMS messages. 36 | * 37 | * @param context Context for obtaining the package manager. 38 | * @return true if you can send SMS, false otherwise. 39 | */ 40 | public static boolean canSendSms(Context context) { 41 | Uri smsUri = Uri.parse("smsto:12345"); 42 | Intent smsIntent = new Intent(Intent.ACTION_SENDTO, smsUri); 43 | PackageManager smspackageManager = context.getPackageManager(); 44 | List smsresolveInfos = smspackageManager.queryIntentActivities(smsIntent, 0); 45 | if(smsresolveInfos.size() > 0) { 46 | return true; 47 | } 48 | else { 49 | return false; 50 | } 51 | } 52 | 53 | /** Launch a SMS intent if the device is capable. 54 | * 55 | * @param activity The parent activity (for context) 56 | * @param number The number to sms (not the full URI) 57 | * @param text The sms body 58 | */ 59 | public static void launchSmsIntent(final Activity activity, String number, String text) { 60 | Log.i(LOG_TAG,"Launch SMS intent to "+number); 61 | // create sms intent 62 | Uri smsUri = Uri.parse("smsto:" + number); 63 | Intent smsIntent = new Intent(Intent.ACTION_SENDTO, smsUri); 64 | smsIntent.putExtra("sms_body", text); 65 | // make sure there is an activity which can handle the intent. 66 | PackageManager smspackageManager = activity.getPackageManager(); 67 | List smsresolveInfos = smspackageManager.queryIntentActivities(smsIntent, 0); 68 | if(smsresolveInfos.size() > 0) { 69 | activity.startActivity(smsIntent); 70 | } 71 | } 72 | 73 | /** Launch an email intent if the device is capable. 74 | * 75 | * @param activity The parent activity (for context) 76 | * @param addr The address to email (not the full URI) 77 | * @param text The email body 78 | */ 79 | public static void launchEmailIntent(final Activity activity, String addr, String text) { 80 | Log.i(LOG_TAG,"Launch email intent from "+activity.getLocalClassName()); 81 | // create email intent 82 | Intent emailIntent = new Intent(Intent.ACTION_SEND); 83 | emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {addr}); 84 | emailIntent.setType("text/plain"); 85 | // make sure there is an activity which can handle the intent. 86 | PackageManager emailpackageManager = activity.getPackageManager(); 87 | List emailresolveInfos = emailpackageManager.queryIntentActivities(emailIntent, 0); 88 | if(emailresolveInfos.size() > 0) { 89 | activity.startActivity(emailIntent); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ConsoleMessagesAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.content.Intent; 21 | import android.os.Handler; 22 | import android.os.Looper; 23 | 24 | import org.matrix.androidsdk.MXSession; 25 | import org.matrix.androidsdk.adapters.MessageRow; 26 | import org.matrix.androidsdk.adapters.MessagesAdapter; 27 | import org.matrix.androidsdk.db.MXMediasCache; 28 | import org.matrix.androidsdk.rest.model.FileMessage; 29 | import org.matrix.androidsdk.rest.model.ImageMessage; 30 | import org.matrix.androidsdk.rest.model.Message; 31 | import org.matrix.androidsdk.rest.model.VideoMessage; 32 | import org.matrix.androidsdk.util.JsonUtils; 33 | import org.matrix.console.ConsoleApplication; 34 | import org.matrix.console.R; 35 | import org.matrix.console.activity.CommonActivityUtils; 36 | import org.matrix.console.activity.ImageSliderActivity; 37 | import org.matrix.console.activity.MemberDetailsActivity; 38 | import org.matrix.console.util.SlidableImageInfo; 39 | 40 | import java.io.File; 41 | import java.util.ArrayList; 42 | 43 | /** 44 | * An adapter which can display room information. 45 | */ 46 | public class ConsoleMessagesAdapter extends MessagesAdapter { 47 | 48 | private Handler mUiHandler; 49 | 50 | public ConsoleMessagesAdapter(MXSession session, Context context, MXMediasCache mediasCache) { 51 | super(session, context, mediasCache); 52 | 53 | // for dispatching data to add to the adapter we need to be on the main thread 54 | mUiHandler = new Handler(Looper.getMainLooper()); 55 | } 56 | 57 | @Override 58 | public void notifyDataSetChanged() { 59 | // do not refresh the room when the application is in background 60 | // on large rooms, it drains a lot of battery 61 | if (!ConsoleApplication.isAppInBackground()) { 62 | super.notifyDataSetChanged(); 63 | } 64 | } 65 | 66 | public int presenceOnlineColor() { 67 | return mContext.getResources().getColor(R.color.presence_online); 68 | } 69 | 70 | public int presenceOfflineColor() { 71 | return mContext.getResources().getColor(R.color.presence_offline); 72 | } 73 | 74 | public int presenceUnavailableColor() { 75 | return mContext.getResources().getColor(R.color.presence_unavailable); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ConsoleRoomMembersAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | 21 | import org.matrix.androidsdk.HomeserverConnectionConfig; 22 | import org.matrix.androidsdk.adapters.RoomMembersAdapter; 23 | import org.matrix.androidsdk.data.RoomState; 24 | import org.matrix.androidsdk.db.MXMediasCache; 25 | 26 | import org.matrix.console.R; 27 | 28 | import java.util.HashMap; 29 | 30 | /** 31 | * An adapter which can display room information. 32 | */ 33 | public class ConsoleRoomMembersAdapter extends RoomMembersAdapter { 34 | 35 | public ConsoleRoomMembersAdapter(Context context, HomeserverConnectionConfig hsConfig, int layoutResourceId, RoomState roomState, MXMediasCache mediasCache, HashMap membershipStrings) { 36 | super(context, hsConfig, layoutResourceId, roomState, mediasCache, membershipStrings); 37 | } 38 | 39 | 40 | public int lastSeenTextColor() { 41 | return mContext.getResources().getColor(R.color.member_list_last_seen_text); 42 | } 43 | 44 | public int presenceOnlineColor() { 45 | return mContext.getResources().getColor(R.color.presence_online); 46 | } 47 | 48 | public int presenceOfflineColor() { 49 | return mContext.getResources().getColor(R.color.presence_offline); 50 | } 51 | 52 | public int presenceUnavailableColor() { 53 | return mContext.getResources().getColor(R.color.presence_unavailable); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ConsoleRoomSummaryAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | import android.preference.PreferenceManager; 22 | import android.text.TextUtils; 23 | 24 | import org.matrix.androidsdk.MXSession; 25 | import org.matrix.androidsdk.data.Room; 26 | import org.matrix.androidsdk.data.RoomSummary; 27 | import org.matrix.androidsdk.rest.model.User; 28 | import org.matrix.console.Matrix; 29 | import org.matrix.console.R; 30 | import org.matrix.androidsdk.adapters.RoomSummaryAdapter; 31 | 32 | import java.util.ArrayList; 33 | import java.util.Collection; 34 | 35 | /** 36 | * An adapter which can display room information. 37 | */ 38 | public class ConsoleRoomSummaryAdapter extends RoomSummaryAdapter { 39 | 40 | private ArrayList mSessions = null; 41 | 42 | public ConsoleRoomSummaryAdapter(Context context, Collection sessions, int layoutResourceId, int headerLayoutResourceId) { 43 | super(context, sessions.size(), layoutResourceId, headerLayoutResourceId); 44 | mSessions = new ArrayList(sessions); 45 | } 46 | 47 | public int getUnreadMessageBackgroundColor() { 48 | return mContext.getResources().getColor(R.color.room_summary_unread_background); 49 | } 50 | 51 | public int getHighlightMessageBackgroundColor() { 52 | return mContext.getResources().getColor(R.color.room_summary_highlight_background); 53 | } 54 | 55 | public int getPublicHighlightMessageBackgroundColor() { 56 | return mContext.getResources().getColor(R.color.room_summary_public_highlight_background); 57 | } 58 | 59 | /** 60 | * Retrieve a Room from a room summary 61 | * @param roomSummary the room roomId to retrieve. 62 | * @return the Room. 63 | */ 64 | public Room roomFromRoomSummary(RoomSummary roomSummary) { 65 | // sanity check 66 | if ((null == roomSummary) || (null == roomSummary.getMatrixId())) { 67 | return null; 68 | } 69 | 70 | MXSession session = Matrix.getMXSession(mContext, roomSummary.getMatrixId()); 71 | 72 | // check if the session is active 73 | if ((null == session) || (!session.isAlive())) { 74 | return null; 75 | } 76 | 77 | return Matrix.getMXSession(mContext, roomSummary.getMatrixId()).getDataHandler().getStore().getRoom(roomSummary.getRoomId()); 78 | } 79 | 80 | public String memberDisplayName(String matrixId, String userId) { 81 | MXSession session = Matrix.getMXSession(mContext, matrixId); 82 | 83 | // check if the session is active 84 | if ((null == session) || (!session.isAlive())) { 85 | return null; 86 | } 87 | 88 | User user = session.getDataHandler().getStore().getUser(userId); 89 | 90 | if ((null != user) && !TextUtils.isEmpty(user.displayname)) { 91 | return user.displayname; 92 | } 93 | 94 | return userId; 95 | } 96 | 97 | public boolean displayPublicRooms() { 98 | // the user can force to clear the public rooms with the recents ones 99 | SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); 100 | return preferences.getBoolean(mContext.getString(R.string.settings_key_display_public_rooms_recents), true); 101 | } 102 | 103 | public String myRoomsTitle(int section) { 104 | if (mSessions.size() == 1) { 105 | return mContext.getResources().getString(R.string.my_rooms); 106 | } else { 107 | if (mSessions.get(section).isAlive()) { 108 | return mSessions.get(section).getMyUserId(); 109 | } else { 110 | return mContext.getResources().getString(R.string.my_rooms); 111 | } 112 | } 113 | } 114 | 115 | public String publicRoomsTitle(int section) { 116 | String title = mContext.getResources().getString(R.string.action_public_rooms); 117 | 118 | if ((null != mPublicRoomsHomeServerLists) && (mPublicRoomsHomeServerLists.size() > 1)) { 119 | title += "\n" + mPublicRoomsHomeServerLists.get(section - mSessions.size()); 120 | } 121 | 122 | return title; 123 | } 124 | 125 | @Override 126 | public void removeSection(int section) { 127 | super.removeSection(section); 128 | mSessions.remove(section); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ContactsListAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.graphics.Bitmap; 21 | import android.net.Uri; 22 | import android.provider.MediaStore; 23 | import android.text.TextUtils; 24 | import android.view.LayoutInflater; 25 | import android.view.View; 26 | import android.view.ViewGroup; 27 | import android.widget.ArrayAdapter; 28 | import android.widget.ImageView; 29 | import android.widget.SectionIndexer; 30 | import android.widget.TextView; 31 | 32 | import org.matrix.console.R; 33 | import org.matrix.console.contacts.Contact; 34 | 35 | import java.util.HashMap; 36 | import java.util.LinkedHashMap; 37 | 38 | /** 39 | * An adapter which can display m.room.member content. 40 | */ 41 | public class ContactsListAdapter extends ArrayAdapter implements SectionIndexer { 42 | 43 | private Context mContext; 44 | private LayoutInflater mLayoutInflater; 45 | private int mLayoutResourceId; 46 | 47 | // SectionIndexer 48 | private HashMap mMapIndex; 49 | private String[] mSections; 50 | 51 | /** 52 | * Construct an adapter which will display a list of room members. 53 | * @param context Activity context 54 | * @param layoutResourceId The resource ID of the layout for each item. Must have TextViews with 55 | * the IDs: roomMembersAdapter_name, roomMembersAdapter_membership, and 56 | * an ImageView with the ID avatar_img. 57 | */ 58 | public ContactsListAdapter(Context context, int layoutResourceId) { 59 | super(context, layoutResourceId); 60 | mContext = context; 61 | mLayoutResourceId = layoutResourceId; 62 | mLayoutInflater = LayoutInflater.from(mContext); 63 | 64 | // let the caller manages the refresh 65 | setNotifyOnChange(false); 66 | } 67 | 68 | @Override 69 | public View getView(int position, View convertView, ViewGroup parent) { 70 | 71 | if (convertView == null) { 72 | convertView = mLayoutInflater.inflate(mLayoutResourceId, parent, false); 73 | } 74 | 75 | final Contact contact = getItem(position); 76 | 77 | // Member name 78 | TextView textView = (TextView) convertView.findViewById(R.id.contact_name); 79 | textView.setText(contact.getDisplayName()); 80 | 81 | // matrix info 82 | ImageView matrixIcon = (ImageView) convertView.findViewById(R.id.imageView_matrix_user); 83 | TextView matrixIDTextView = (TextView) convertView.findViewById(R.id.contact_userId); 84 | 85 | if (contact.hasMatridIds(mContext)) { 86 | matrixIDTextView.setText(contact.getFirstMatrixId().mMatrixId); 87 | matrixIDTextView.setVisibility(View.VISIBLE); 88 | matrixIcon.setVisibility(View.VISIBLE); 89 | } else { 90 | matrixIDTextView.setVisibility(View.GONE); 91 | matrixIcon.setVisibility(View.GONE); 92 | } 93 | 94 | // member thumbnail 95 | ImageView imageView = (ImageView) convertView.findViewById(R.id.avatar_img); 96 | 97 | Bitmap bitmap = contact.mThumbnail; 98 | 99 | if ((null != contact.mThumbnailUri) && (null == bitmap)) { 100 | try { 101 | contact.mThumbnail = bitmap = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), Uri.parse(contact.mThumbnailUri)); 102 | } catch (Exception e) { 103 | } 104 | } 105 | 106 | if (null == bitmap) { 107 | imageView.setImageResource(R.drawable.ic_contact_picture_holo_light); 108 | } else { 109 | imageView.setImageBitmap(bitmap); 110 | } 111 | 112 | return convertView; 113 | } 114 | 115 | public int getPositionForSection(int section) { 116 | return mMapIndex.get(mSections[section]); 117 | } 118 | 119 | public int getSectionForPosition(int position) { 120 | return 0; 121 | } 122 | 123 | public Object[] getSections() { 124 | return mSections; 125 | } 126 | 127 | @Override 128 | public void addAll(java.util.Collection collection) { 129 | super.addAll(collection); 130 | 131 | // compute the sections from the contacts list 132 | // assume that the contacts are displayed by display names 133 | mMapIndex = new LinkedHashMap(); 134 | 135 | int index = 0; 136 | 137 | // list the contacts by display name 138 | for (Contact contact : collection){ 139 | if (!TextUtils.isEmpty(contact.getDisplayName())) { 140 | mMapIndex.put(contact.getDisplayName().substring(0, 1).toUpperCase(), index); 141 | index++; 142 | } 143 | } 144 | 145 | mSections = new String[mMapIndex.size()]; 146 | mMapIndex.keySet().toArray(mSections); 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/DrawerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.ArrayAdapter; 24 | import android.widget.ImageView; 25 | import android.widget.TextView; 26 | 27 | import org.matrix.console.R; 28 | 29 | /** 30 | * An adapter which can display room information. 31 | */ 32 | public class DrawerAdapter extends ArrayAdapter { 33 | 34 | private static final int NUM_ROW_TYPES = 2; 35 | 36 | private static final int ROW_TYPE_HEADER = 0; 37 | private static final int ROW_TYPE_ENTRY = 1; 38 | 39 | public class Entry { 40 | public int mIconResourceId; 41 | public String mText; 42 | 43 | public Entry(int iconResourceId, String text) { 44 | mIconResourceId = iconResourceId; 45 | mText = text; 46 | } 47 | }; 48 | 49 | private LayoutInflater mLayoutInflater; 50 | private int mHeaderLayoutResourceId; 51 | private int mEntryLayoutResourceId; 52 | 53 | private Context mContext; 54 | 55 | /** 56 | * Construct an adapter to display a drawer adapter 57 | * @param context the context 58 | * @param headerLayoutResourceId the header resource id 59 | * @param entryLayoutResourceId the entry layout id 60 | */ 61 | public DrawerAdapter(Context context, int headerLayoutResourceId, int entryLayoutResourceId) { 62 | super(context, headerLayoutResourceId, entryLayoutResourceId); 63 | mContext = context; 64 | mHeaderLayoutResourceId = headerLayoutResourceId; 65 | mEntryLayoutResourceId = entryLayoutResourceId; 66 | mLayoutInflater = LayoutInflater.from(mContext); 67 | 68 | // create a dummy section to insert the header 69 | this.add(new Entry(0, null)); 70 | setNotifyOnChange(true); 71 | } 72 | 73 | /** 74 | * Add a new entry in the adapter 75 | * @param iconResourceId the entry icon 76 | * @param text the entry text 77 | */ 78 | public void add(int iconResourceId, String text) { 79 | this.add(new Entry(iconResourceId, text)); 80 | } 81 | 82 | @Override 83 | public View getView(int position, View convertView, ViewGroup parent) { 84 | 85 | if (0 == position) { 86 | if (convertView == null) { 87 | convertView = mLayoutInflater.inflate(mHeaderLayoutResourceId, parent, false); 88 | } 89 | return convertView; 90 | } else { 91 | if (convertView == null) { 92 | convertView = mLayoutInflater.inflate(mEntryLayoutResourceId, parent, false); 93 | } 94 | 95 | Entry entry = getItem(position); 96 | 97 | TextView textView = (TextView) convertView.findViewById(R.id.adapter_drawer_text); 98 | textView.setText(entry.mText); 99 | 100 | ImageView imageView = (ImageView) convertView.findViewById(R.id.adapter_drawer_thumbnail); 101 | imageView.setImageResource(entry.mIconResourceId); 102 | 103 | return convertView; 104 | } 105 | } 106 | 107 | @Override 108 | public int getViewTypeCount() { 109 | return NUM_ROW_TYPES; 110 | } 111 | 112 | @Override 113 | public int getItemViewType(int position) { 114 | return (position == 0) ? ROW_TYPE_HEADER : ROW_TYPE_ENTRY; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ImageCompressionDescription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | public class ImageCompressionDescription { 20 | public String mCompressionText; 21 | public String mCompressionInfoText; 22 | } 23 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ImageSizesAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.ArrayAdapter; 24 | import android.widget.TextView; 25 | 26 | import org.matrix.console.R; 27 | 28 | /** 29 | * An adapter which can display string 30 | */ 31 | public class ImageSizesAdapter extends ArrayAdapter { 32 | protected Context mContext; 33 | private LayoutInflater mLayoutInflater; 34 | private int mLayoutResourceId; 35 | 36 | /** 37 | * Construct an adapter which will display a list of image size 38 | * @param context Activity context 39 | * @param layoutResourceId The resource ID of the layout for each item. 40 | * 41 | */ 42 | public ImageSizesAdapter(Context context, int layoutResourceId) { 43 | super(context, layoutResourceId); 44 | mContext = context; 45 | mLayoutResourceId = layoutResourceId; 46 | mLayoutInflater = LayoutInflater.from(mContext); 47 | } 48 | 49 | @Override 50 | public View getView(int position, View convertView, ViewGroup parent) { 51 | if (convertView == null) { 52 | convertView = mLayoutInflater.inflate(mLayoutResourceId, parent, false); 53 | } 54 | 55 | ImageCompressionDescription imageSizesDescription = getItem(position); 56 | 57 | TextView textView = (TextView)convertView.findViewById(R.id.ImageSizesAdapter_format); 58 | textView.setText(imageSizesDescription.mCompressionText); 59 | 60 | textView = (TextView)convertView.findViewById(R.id.ImageSizesAdapter_info); 61 | textView.setText(imageSizesDescription.mCompressionInfoText); 62 | return convertView; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/adapters/ReadReceiptsAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.adapters; 18 | 19 | import android.content.Context; 20 | import android.text.Spannable; 21 | import android.text.SpannableStringBuilder; 22 | import android.text.TextUtils; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.widget.ArrayAdapter; 27 | import android.widget.ImageView; 28 | import android.widget.TextView; 29 | 30 | import org.matrix.androidsdk.HomeserverConnectionConfig; 31 | 32 | import org.matrix.androidsdk.data.Room; 33 | import org.matrix.androidsdk.db.MXMediasCache; 34 | import org.matrix.androidsdk.rest.model.ReceiptData; 35 | import org.matrix.androidsdk.rest.model.RoomMember; 36 | import org.matrix.androidsdk.util.ContentManager; 37 | import org.matrix.console.R; 38 | 39 | import java.text.SimpleDateFormat; 40 | import java.util.Date; 41 | import java.util.Locale; 42 | 43 | /** 44 | * An adapter which can display receipts 45 | */ 46 | public class ReadReceiptsAdapter extends ArrayAdapter { 47 | 48 | protected Context mContext; 49 | private LayoutInflater mLayoutInflater; 50 | private int mLayoutResourceId; 51 | private Room mRoom; 52 | private MXMediasCache mMediasCache; 53 | private HomeserverConnectionConfig mHsConfig; 54 | 55 | 56 | public ReadReceiptsAdapter(Context context, HomeserverConnectionConfig hsConfig, int layoutResourceId, Room room, MXMediasCache mediasCache) { 57 | super(context, layoutResourceId); 58 | mContext = context; 59 | mLayoutResourceId = layoutResourceId; 60 | mLayoutInflater = LayoutInflater.from(mContext); 61 | mRoom = room; 62 | mMediasCache = mediasCache; 63 | mHsConfig = hsConfig; 64 | } 65 | 66 | 67 | @Override 68 | public View getView(int position, View convertView, ViewGroup parent) { 69 | if (convertView == null) { 70 | convertView = mLayoutInflater.inflate(mLayoutResourceId, parent, false); 71 | } 72 | 73 | TextView userNameTextView = (TextView) convertView.findViewById(R.id.accountAdapter_name); 74 | 75 | ReceiptData receipt = getItem(position); 76 | RoomMember member = mRoom.getMember(receipt.userId); 77 | 78 | if (null == member) { 79 | userNameTextView.setText(receipt.userId); 80 | } else { 81 | userNameTextView.setText(member.getName()); 82 | } 83 | 84 | TextView tsTextView = (TextView) convertView.findViewById(R.id.read_receipt_ts); 85 | 86 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); 87 | 88 | SpannableStringBuilder body = new SpannableStringBuilder(mContext.getString(org.matrix.console.R.string.read_receipt) + " : " + dateFormat.format(new Date(receipt.originServerTs))); 89 | body.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), 0, mContext.getString(org.matrix.console.R.string.read_receipt).length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 90 | tsTextView.setText(body); 91 | 92 | ImageView imageView = (ImageView) convertView.findViewById(R.id.avatar_img); 93 | imageView.setTag(null); 94 | imageView.setImageResource(R.drawable.ic_contact_picture_holo_light); 95 | String url = member.avatarUrl; 96 | 97 | if (TextUtils.isEmpty(url)) { 98 | url = ContentManager.getIdenticonURL(member.getUserId()); 99 | } 100 | 101 | if (!TextUtils.isEmpty(url)) { 102 | int size = getContext().getResources().getDimensionPixelSize(R.dimen.member_list_avatar_size); 103 | mMediasCache.loadAvatarThumbnail(mHsConfig, imageView, url, size); 104 | } 105 | 106 | // The presence ring 107 | ImageView presenceRing = (ImageView) convertView.findViewById(R.id.imageView_presenceRing); 108 | presenceRing.setColorFilter(mContext.getResources().getColor(android.R.color.transparent)); 109 | 110 | return convertView; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/car/CarBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package org.matrix.console.car; 2 | 3 | import android.app.NotificationManager; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.support.v4.app.RemoteInput; 9 | import android.util.Log; 10 | 11 | import org.matrix.androidsdk.MXSession; 12 | import org.matrix.androidsdk.data.Room; 13 | import org.matrix.androidsdk.rest.callback.ApiCallback; 14 | import org.matrix.androidsdk.rest.model.Event; 15 | import org.matrix.androidsdk.rest.model.MatrixError; 16 | import org.matrix.androidsdk.rest.model.Message; 17 | import org.matrix.console.Matrix; 18 | import org.matrix.console.util.NotificationUtils; 19 | 20 | public class CarBroadcastReceiver extends BroadcastReceiver { 21 | private static final String TAG = CarBroadcastReceiver.class.getSimpleName(); 22 | 23 | @Override 24 | public void onReceive(final Context context, final Intent intent) { 25 | String roomId = intent.getStringExtra(NotificationUtils.EXTRA_ROOM_ID); 26 | if (NotificationUtils.ACTION_MESSAGE_HEARD.equals(intent.getAction())) { 27 | NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); 28 | notificationManager.cancelAll(); 29 | } else if (NotificationUtils.ACTION_MESSAGE_REPLY.equals(intent.getAction())) { 30 | final CharSequence reply = getMessageText(intent); 31 | 32 | final MXSession session = Matrix.getInstance(context).getDefaultSession(); 33 | if (session == null) { 34 | return; 35 | } 36 | 37 | final Room room = session.getDataHandler().getRoom(roomId); 38 | final Message message = new Message(); 39 | message.body = reply.toString(); 40 | message.msgtype = Message.MSGTYPE_TEXT; 41 | 42 | Event event = new Event(message, session.getCredentials().userId, room.getRoomId()); 43 | room.storeOutgoingEvent(event); 44 | 45 | room.sendEvent(event, new ApiCallback() { 46 | @Override 47 | public void onSuccess(final Void info) { 48 | Log.d(TAG, "reply sent!"); 49 | } 50 | 51 | @Override 52 | public void onNetworkError(final Exception e) { 53 | Log.e(TAG, "sending reply failed!", e); 54 | } 55 | 56 | @Override 57 | public void onMatrixError(final MatrixError e) { 58 | Log.e(TAG, "sending reply failed with matrix error " + e.errcode + " " + e.error); 59 | } 60 | 61 | @Override 62 | public void onUnexpectedError(final Exception e) { 63 | Log.e(TAG, "sending reply failed!", e); 64 | } 65 | }); 66 | } 67 | } 68 | 69 | /** 70 | * Get the message text from the intent. 71 | * Note that you should call 72 | * RemoteInput.getResultsFromIntent() to process 73 | * the RemoteInput. 74 | */ 75 | private CharSequence getMessageText(Intent intent) { 76 | Bundle remoteInput = 77 | RemoteInput.getResultsFromIntent(intent); 78 | if (remoteInput != null) { 79 | return remoteInput.getCharSequence(NotificationUtils.CAR_VOICE_REPLY_KEY); 80 | } 81 | return null; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/contacts/Contact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.contacts; 18 | 19 | import android.content.Context; 20 | import android.graphics.Bitmap; 21 | import android.text.TextUtils; 22 | 23 | import java.util.ArrayList; 24 | import java.util.HashMap; 25 | 26 | /** 27 | * A simple contact class 28 | */ 29 | public class Contact { 30 | public static class MXID { 31 | public String mMatrixId; 32 | public String mAccountId; 33 | 34 | public MXID(String matrixId, String accountId) { 35 | mMatrixId = matrixId; 36 | mAccountId = accountId; 37 | } 38 | } 39 | 40 | public String mContactId = ""; 41 | private String mDisplayName; 42 | private String mUpperCaseDisplayName = ""; 43 | private String mLowerCaseDisplayName = ""; 44 | public String mThumbnailUri; 45 | public Bitmap mThumbnail = null; 46 | 47 | public ArrayListmPhoneNumbers = new ArrayList(); 48 | public ArrayListmEmails = new ArrayList(); 49 | private HashMap mMXIDsByElement = null; 50 | 51 | public Contact(String contactId) { 52 | if (null != contactId) { 53 | mContactId = contactId; 54 | } else { 55 | mContactId = "" + System.currentTimeMillis(); 56 | } 57 | } 58 | 59 | /** 60 | * Check if some matrix IDs are linked to emails 61 | * @return true if some matrix IDs have been retrieved 62 | */ 63 | public boolean hasMatridIds(Context context) { 64 | Boolean localUpdateOnly = (null != mMXIDsByElement); 65 | 66 | // the PIDs are not yet retrieved 67 | if (null == mMXIDsByElement) { 68 | mMXIDsByElement = new HashMap(); 69 | } 70 | 71 | if (couldContainMatridIds()) { 72 | PIDsRetriever.getIntance().retrieveMatrixIds(context, this, localUpdateOnly); 73 | } 74 | 75 | return (mMXIDsByElement.size() != 0); 76 | } 77 | 78 | /** 79 | * Defines a matrix identifier for a dedicated pattern 80 | * @param email the pattern 81 | * @param mxid the matrixId 82 | */ 83 | public void put(String email, MXID mxid) { 84 | if ((null != email) && (null != mxid) && !TextUtils.isEmpty(mxid.mMatrixId)) { 85 | mMXIDsByElement.put(email, mxid); 86 | } 87 | } 88 | 89 | /** 90 | * Check if the contact could contain some matrix Ids 91 | * @return true if the contact could contain some matrix IDs 92 | */ 93 | public boolean couldContainMatridIds() { 94 | return (0 != mEmails.size()); 95 | } 96 | 97 | // assume that the search is performed on all the existing contacts 98 | // so apply upper / lower case only once 99 | static String mCurrentPattern = ""; 100 | static String mUpperCasePattern = ""; 101 | static String mLowerCasePattern = ""; 102 | 103 | /** 104 | * test if some fields match with the pattern 105 | * @param pattern 106 | * @return 107 | */ 108 | public boolean matchWithPattern(String pattern) { 109 | // no pattern -> true 110 | if (TextUtils.isEmpty(pattern)) { 111 | mCurrentPattern = ""; 112 | mUpperCasePattern = ""; 113 | mLowerCasePattern = ""; 114 | } 115 | 116 | // no display name 117 | if (TextUtils.isEmpty(mDisplayName)) { 118 | return false; 119 | } 120 | 121 | if (TextUtils.isEmpty(mUpperCaseDisplayName)) { 122 | mUpperCaseDisplayName = mDisplayName.toLowerCase(); 123 | mLowerCaseDisplayName = mDisplayName.toUpperCase(); 124 | } 125 | 126 | if (!pattern.equals(mCurrentPattern)) { 127 | mCurrentPattern = pattern; 128 | mUpperCasePattern = pattern.toUpperCase(); 129 | mLowerCasePattern = pattern.toLowerCase(); 130 | } 131 | 132 | return (mUpperCaseDisplayName.indexOf(mUpperCasePattern) >= 0) || (mLowerCaseDisplayName.indexOf(mUpperCasePattern) >= 0); 133 | } 134 | 135 | /** 136 | * Returns the first retrieved matrix ID. 137 | * @return the first retrieved matrix ID. 138 | */ 139 | public MXID getFirstMatrixId() { 140 | if (mMXIDsByElement.size() != 0) { 141 | return mMXIDsByElement.values().iterator().next(); 142 | } else { 143 | return null; 144 | } 145 | } 146 | 147 | public void setDisplayName(String displayName) { 148 | mDisplayName = displayName; 149 | } 150 | 151 | public String getDisplayName() { 152 | String res = mDisplayName; 153 | 154 | if (TextUtils.isEmpty(res)) { 155 | for(String email : mEmails) { 156 | if (!TextUtils.isEmpty(email)) { 157 | return email; 158 | } 159 | } 160 | } 161 | 162 | if (TextUtils.isEmpty(res)) { 163 | for(String pn : mPhoneNumbers) { 164 | if (!TextUtils.isEmpty(pn)) { 165 | return pn; 166 | } 167 | } 168 | } 169 | 170 | return res; 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/db/ConsoleContentProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.db; 18 | 19 | import android.content.ContentProvider; 20 | import android.content.ContentValues; 21 | import android.content.Context; 22 | import android.database.Cursor; 23 | import android.net.Uri; 24 | import android.os.ParcelFileDescriptor; 25 | import android.webkit.MimeTypeMap; 26 | 27 | import java.io.File; 28 | import java.io.FileNotFoundException; 29 | 30 | public class ConsoleContentProvider extends ContentProvider { 31 | 32 | public static String AUTHORITIES = "org.matrix.console.ConsoleApplication.provider"; 33 | 34 | 35 | /** 36 | * Convert an absolute file path to a Content path 37 | * @param context the application context 38 | * @param path the absolute path to convert. 39 | * @return the content URI. 40 | */ 41 | public static Uri absolutePathToUri(Context context, String path) { 42 | String basePath = context.getFilesDir().getAbsolutePath(); 43 | 44 | if ((null != path) && path.startsWith(basePath)) { 45 | return Uri.parse("content://" + ConsoleContentProvider.AUTHORITIES + path.substring(basePath.length())); 46 | } 47 | 48 | return null; 49 | } 50 | 51 | @Override 52 | public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { 53 | File privateFile = new File(getContext().getFilesDir(), uri.getPath()); 54 | return ParcelFileDescriptor.open(privateFile, ParcelFileDescriptor.MODE_READ_ONLY); 55 | } 56 | 57 | @Override 58 | public int delete(Uri arg0, String arg1, String[] arg2) { 59 | return 0; 60 | } 61 | 62 | @Override 63 | public String getType(Uri arg0) { 64 | String type = null; 65 | String extension = MimeTypeMap.getFileExtensionFromUrl(arg0.toString()); 66 | if (extension != null) { 67 | MimeTypeMap mime = MimeTypeMap.getSingleton(); 68 | type = mime.getMimeTypeFromExtension(extension); 69 | } 70 | 71 | return type; 72 | } 73 | 74 | @Override 75 | public Uri insert(Uri arg0, ContentValues arg1) { 76 | return null; 77 | } 78 | 79 | @Override 80 | public boolean onCreate() { 81 | return false; 82 | } 83 | 84 | @Override 85 | public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3, 86 | String arg4) { 87 | return null; 88 | } 89 | 90 | @Override 91 | public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) { 92 | return 0; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/fragments/AccountsSelectionDialogFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.fragments; 18 | 19 | import android.app.Dialog; 20 | import android.os.Bundle; 21 | import android.support.v4.app.DialogFragment; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.AdapterView; 26 | import android.widget.ListView; 27 | 28 | import org.matrix.androidsdk.MXSession; 29 | import org.matrix.androidsdk.db.MXMediasCache; 30 | import org.matrix.console.Matrix; 31 | import org.matrix.console.R; 32 | import org.matrix.console.adapters.AccountsAdapter; 33 | 34 | import java.util.Collection; 35 | 36 | /** 37 | * A dialog fragment showing a list of room members for a given room. 38 | */ 39 | public class AccountsSelectionDialogFragment extends DialogFragment { 40 | private static final String LOG_TAG = "AccountsSelectionDialogFragment"; 41 | 42 | public static interface AccountsListener { 43 | public void onSelected(MXSession session); 44 | } 45 | 46 | public static AccountsSelectionDialogFragment newInstance(Collection sessions) { 47 | AccountsSelectionDialogFragment f= new AccountsSelectionDialogFragment(); 48 | Bundle args = new Bundle(); 49 | f.setArguments(args); 50 | f.setSessions(sessions); 51 | return f; 52 | } 53 | 54 | private ListView mListView; 55 | private AccountsAdapter mAdapter; 56 | private Collection mSessions = null; 57 | 58 | private AccountsListener mListener = null; 59 | 60 | public void setListener(AccountsListener listener) { 61 | mListener = listener; 62 | } 63 | 64 | public void setSessions(Collection sessions) { 65 | mSessions = sessions; 66 | } 67 | 68 | @Override 69 | public void onCreate(Bundle savedInstanceState) { 70 | super.onCreate(savedInstanceState); 71 | 72 | if (mSessions == null) { 73 | throw new RuntimeException("No MXSession."); 74 | } 75 | } 76 | 77 | @Override 78 | public Dialog onCreateDialog(Bundle savedInstanceState) { 79 | Dialog d = super.onCreateDialog(savedInstanceState); 80 | d.setTitle(getString(R.string.choose_account)); 81 | return d; 82 | } 83 | 84 | /** 85 | * Return the used medias cache. 86 | * This method can be overridden to use another medias cache 87 | * @return the used medias cache 88 | */ 89 | public MXMediasCache getMXMediasCache() { 90 | return Matrix.getInstance(getActivity()).getMediasCache(); 91 | } 92 | 93 | @Override 94 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 95 | Bundle savedInstanceState) { 96 | super.onCreateView(inflater, container, savedInstanceState); 97 | View v = inflater.inflate(R.layout.fragment_dialog_accounts_list, container, false); 98 | mListView = ((ListView)v.findViewById(R.id.listView_accounts)); 99 | 100 | mAdapter = new AccountsAdapter(getActivity(), R.layout.adapter_item_account, getMXMediasCache()); 101 | 102 | mAdapter.addAll(mSessions); 103 | mListView.setAdapter(mAdapter); 104 | 105 | mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 106 | @Override 107 | public void onItemClick(AdapterView parent, View view, int position, long id) { 108 | 109 | if (null != mListener) { 110 | mListener.onSelected(mAdapter.getItem(position)); 111 | } 112 | 113 | // dismiss the list 114 | AccountsSelectionDialogFragment.this.dismiss(); 115 | } 116 | }); 117 | 118 | return v; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/fragments/ImageSizeSelectionDialogFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.fragments; 18 | 19 | import android.app.Dialog; 20 | import android.os.Bundle; 21 | import android.support.v4.app.DialogFragment; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.AdapterView; 26 | import android.widget.ListView; 27 | 28 | import org.matrix.console.R; 29 | import org.matrix.console.adapters.ImageCompressionDescription; 30 | import org.matrix.console.adapters.ImageSizesAdapter; 31 | 32 | import java.util.ArrayList; 33 | import java.util.Collection; 34 | 35 | /** 36 | * A dialog fragment showing a list of image selections string 37 | */ 38 | public class ImageSizeSelectionDialogFragment extends DialogFragment { 39 | private static final String LOG_TAG = "ImageSizeSelectionDialogFragment"; 40 | 41 | private static final String SELECTIONS_LIST = "SELECTIONS_LIST"; 42 | 43 | public static interface ImageSizeListener { 44 | public void onSelected(int pos); 45 | } 46 | 47 | public static ImageSizeSelectionDialogFragment newInstance(Collection entries) { 48 | ImageSizeSelectionDialogFragment f= new ImageSizeSelectionDialogFragment(); 49 | Bundle args = new Bundle(); 50 | f.setArguments(args); 51 | f.setEntries(entries); 52 | return f; 53 | } 54 | 55 | private ListView mListView; 56 | private ImageSizesAdapter mAdapter; 57 | private ArrayList mEntries = null; 58 | private ImageSizeListener mListener = null; 59 | 60 | public void setEntries(Collection entries) { 61 | mEntries = new ArrayList(entries); 62 | } 63 | 64 | public void setListener(ImageSizeListener listener) { 65 | mListener = listener; 66 | } 67 | 68 | @Override 69 | public void onCreate(Bundle savedInstanceState) { 70 | super.onCreate(savedInstanceState); 71 | } 72 | 73 | @Override 74 | public void onSaveInstanceState(Bundle savedInstanceState) { 75 | // Always call the superclass so it can save the view hierarchy state 76 | super.onSaveInstanceState(savedInstanceState); 77 | 78 | if (null != mEntries) { 79 | savedInstanceState.putSerializable(SELECTIONS_LIST, mEntries); 80 | } 81 | } 82 | 83 | @Override 84 | public Dialog onCreateDialog(Bundle savedInstanceState) { 85 | Dialog d = super.onCreateDialog(savedInstanceState); 86 | 87 | if (null != savedInstanceState) { 88 | if (savedInstanceState.containsKey(SELECTIONS_LIST)) { 89 | mEntries = (ArrayList)savedInstanceState.getSerializable(SELECTIONS_LIST); 90 | } 91 | } 92 | 93 | d.setTitle(getString(R.string.compression_options)); 94 | return d; 95 | } 96 | 97 | @Override 98 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 99 | Bundle savedInstanceState) { 100 | super.onCreateView(inflater, container, savedInstanceState); 101 | View v = inflater.inflate(R.layout.fragment_dialog_accounts_list, container, false); 102 | mListView = ((ListView)v.findViewById(R.id.listView_accounts)); 103 | 104 | mAdapter = new ImageSizesAdapter(getActivity(), R.layout.adapter_item_image_size); 105 | 106 | if (null != mEntries) { 107 | mAdapter.addAll(mEntries); 108 | } 109 | mListView.setAdapter(mAdapter); 110 | 111 | mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 112 | @Override 113 | public void onItemClick(AdapterView parent, View view, int position, long id) { 114 | 115 | if (null != mListener) { 116 | mListener.onSelected(position); 117 | } 118 | 119 | // dismiss the list 120 | ImageSizeSelectionDialogFragment.this.dismiss(); 121 | } 122 | }); 123 | 124 | return v; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/fragments/MessageDetailsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.fragments; 18 | 19 | import android.os.Bundle; 20 | import android.support.v4.app.DialogFragment; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.TextView; 25 | 26 | import org.matrix.console.R; 27 | 28 | /** 29 | * A dialog fragment showing the JSON content of a message 30 | */ 31 | public class MessageDetailsFragment extends DialogFragment { 32 | private static final String LOG_TAG = "MessageDetailsFragment"; 33 | public static final String ARG_TEXT = "org.matrix.console.fragments.MessageDetailsFragment.ARG_TEXT"; 34 | 35 | private String mBody = ""; 36 | 37 | public static MessageDetailsFragment newInstance(String text) { 38 | MessageDetailsFragment f = new MessageDetailsFragment(); 39 | Bundle args = new Bundle(); 40 | args.putString(ARG_TEXT, text); 41 | f.setArguments(args); 42 | 43 | f.setStyle(DialogFragment.STYLE_NO_TITLE, 0); 44 | return f; 45 | } 46 | 47 | @Override 48 | public void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | mBody = getArguments().getString(ARG_TEXT); 51 | } 52 | 53 | @Override 54 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 55 | Bundle savedInstanceState) { 56 | super.onCreateView(inflater, container, savedInstanceState); 57 | View v = inflater.inflate(R.layout.fragment_message_details, container, false); 58 | 59 | TextView textView = ((TextView)v.findViewById(R.id.message_details_text)); 60 | textView.setText(mBody); 61 | 62 | return v; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/fragments/ReadReceiptsDialogFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.fragments; 18 | 19 | import android.app.Dialog; 20 | import android.os.Bundle; 21 | import android.support.v4.app.DialogFragment; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.ListView; 26 | 27 | import org.matrix.androidsdk.MXSession; 28 | import org.matrix.androidsdk.data.Room; 29 | import org.matrix.androidsdk.db.MXMediasCache; 30 | import org.matrix.androidsdk.rest.model.ReceiptData; 31 | import org.matrix.console.Matrix; 32 | import org.matrix.console.R; 33 | import org.matrix.console.adapters.ReadReceiptsAdapter; 34 | 35 | import java.util.ArrayList; 36 | 37 | /** 38 | * A dialog fragment showing the read receipts 39 | */ 40 | public class ReadReceiptsDialogFragment extends DialogFragment { 41 | private static final String LOG_TAG = "ReadRctDlgFragment"; 42 | 43 | public static final String ARG_ROOM_ID = "ReadReceiptsDialogFragment.ARG_ROOM_ID"; 44 | public static final String ARG_EVENT_ID = "ReadReceiptsDialogFragment.ARG_EVENT_ID"; 45 | 46 | 47 | public static ReadReceiptsDialogFragment newInstance(MXSession session, String roomId, String eventId) { 48 | ReadReceiptsDialogFragment f = new ReadReceiptsDialogFragment(); 49 | Bundle args = new Bundle(); 50 | args.putString(ARG_ROOM_ID, roomId); 51 | args.putString(ARG_EVENT_ID, eventId); 52 | f.setArguments(args); 53 | f.setSession(session); 54 | return f; 55 | } 56 | 57 | private ListView mListView; 58 | private ReadReceiptsAdapter mAdapter; 59 | private String mRoomId; 60 | private String mEventId; 61 | private MXSession mSession; 62 | 63 | 64 | public void setSession(MXSession session) { 65 | mSession = session; 66 | } 67 | 68 | @Override 69 | public void onCreate(Bundle savedInstanceState) { 70 | super.onCreate(savedInstanceState); 71 | mRoomId = getArguments().getString(ARG_ROOM_ID); 72 | mEventId = getArguments().getString(ARG_EVENT_ID); 73 | 74 | if (mSession == null) { 75 | throw new RuntimeException("No MXSession."); 76 | } 77 | } 78 | 79 | @Override 80 | public Dialog onCreateDialog(Bundle savedInstanceState) { 81 | Dialog d = super.onCreateDialog(savedInstanceState); 82 | d.setTitle(getString(R.string.read_receipts_list)); 83 | return d; 84 | } 85 | 86 | /** 87 | * Return the used medias cache. 88 | * This method can be overridden to use another medias cache 89 | * @return the used medias cache 90 | */ 91 | public MXMediasCache getMXMediasCache() { 92 | return Matrix.getInstance(getActivity()).getMediasCache(); 93 | } 94 | 95 | @Override 96 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 97 | Bundle savedInstanceState) { 98 | super.onCreateView(inflater, container, savedInstanceState); 99 | View v = inflater.inflate(R.layout.fragment_dialog_member_list, container, false); 100 | mListView = ((ListView)v.findViewById(R.id.listView_members)); 101 | 102 | final Room room = mSession.getDataHandler().getRoom(mRoomId); 103 | mAdapter = new ReadReceiptsAdapter(getActivity(), mSession.getHomeserverConfig(), R.layout.adapter_item_read_receipt, room, getMXMediasCache()); 104 | 105 | mAdapter.addAll(new ArrayList(mSession.getDataHandler().getStore().getEventReceipts(mRoomId, mEventId, true, true))); 106 | mListView.setAdapter(mAdapter); 107 | 108 | return v; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/ga/Analytics.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.ga; 18 | 19 | import java.io.PrintWriter; 20 | import java.io.StringWriter; 21 | 22 | import com.google.android.gms.analytics.ExceptionParser; 23 | import com.google.android.gms.analytics.ExceptionReporter; 24 | import com.google.android.gms.analytics.GoogleAnalytics; 25 | import com.google.android.gms.analytics.HitBuilders; 26 | import com.google.android.gms.analytics.Tracker; 27 | 28 | import android.content.Context; 29 | import android.util.Log; 30 | 31 | public class Analytics { 32 | private static final String LOG_TAG = "Analytics"; 33 | 34 | public static GoogleAnalytics mAnalytics; 35 | public static Tracker mTracker; 36 | 37 | /** 38 | * Initialise Google Analytics immediately so it will catch all sorts of errors prior to EasyTracker onStart. Also makes sensible 39 | * exception stack traces if you want. 40 | * @param context App context 41 | * @param trackerId The tracker ID to use. 42 | * @return A GoogleAnalytics reference 43 | */ 44 | public static GoogleAnalytics initialiseGoogleAnalytics(Context context, String trackerId, final ExceptionParser callback) { 45 | mAnalytics = GoogleAnalytics.getInstance(context); 46 | mAnalytics.setLocalDispatchPeriod(1800); 47 | 48 | mTracker = mAnalytics.newTracker(trackerId); 49 | mTracker.enableExceptionReporting(true); 50 | //mTracker.enableAdvertisingIdCollection(true); 51 | mTracker.enableAutoActivityTracking(true); 52 | 53 | // overwrite the exception parser to be more useful. 54 | Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); 55 | if (handler != null && handler instanceof ExceptionReporter) { // this handler is the GA one 56 | ExceptionReporter exceptionReporter = (ExceptionReporter)handler; 57 | exceptionReporter.setExceptionParser(callback); 58 | Thread.setDefaultUncaughtExceptionHandler(exceptionReporter); 59 | 60 | Log.d(LOG_TAG, "Analytics active."); 61 | } 62 | else { 63 | Log.e(LOG_TAG, "Cannot set custom exception parser."); 64 | } 65 | 66 | return mAnalytics; 67 | } 68 | 69 | public static String getStackTrace(Throwable throwable) { 70 | StringWriter sw = new StringWriter(); 71 | PrintWriter pw = new PrintWriter(sw, true); 72 | throwable.printStackTrace(pw); 73 | return sw.getBuffer().toString(); 74 | } 75 | 76 | public static void sendEvent(String category, String action, String label) { 77 | sendEvent(category, action, label, Long.MAX_VALUE); 78 | } 79 | 80 | public static void sendEvent(String category, String action, String label, long value) { 81 | // add sanity check, GA could have been disabled. 82 | if (null != mTracker) { 83 | HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder(category, action); 84 | 85 | if (null != label) { 86 | eventBuilder.setLabel(label); 87 | } 88 | 89 | if (Long.MAX_VALUE != value) { 90 | eventBuilder.setValue(value); 91 | } 92 | 93 | mTracker.send(eventBuilder.build()); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/gcm/MatrixGcmListenerService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.gcm; 18 | 19 | import android.os.Bundle; 20 | import android.util.Log; 21 | 22 | import com.google.android.gms.gcm.GcmListenerService; 23 | 24 | import org.matrix.console.ConsoleApplication; 25 | import org.matrix.console.Matrix; 26 | import org.matrix.console.activity.CommonActivityUtils; 27 | 28 | import java.util.logging.Handler; 29 | 30 | public class MatrixGcmListenerService extends GcmListenerService { 31 | 32 | private static final String LOG_TAG = "GcmListenerService"; 33 | private Boolean mCheckLaunched = false; 34 | private android.os.Handler mUIhandler = null; 35 | 36 | /** 37 | * Called when message is received. 38 | * 39 | * @param from SenderID of the sender. 40 | * @param data Data bundle containing message data as key/value pairs. 41 | * For Set of keys use data.keySet(). 42 | */ 43 | @Override 44 | public void onMessageReceived(final String from, final Bundle data) { 45 | Log.d(LOG_TAG, " onMessageReceived "); 46 | 47 | if (null == mUIhandler) { 48 | mUIhandler = new android.os.Handler(ConsoleApplication.getInstance().getMainLooper()); 49 | } 50 | 51 | mUIhandler.post(new Runnable() { 52 | @Override 53 | public void run() { 54 | for (String key : data.keySet()) { 55 | Log.e(LOG_TAG, " >>> " + key + " : " + data.get(key)); 56 | } 57 | // check if the application has been launched once 58 | // the first GCM event could have been triggered whereas the application is not yet launched. 59 | // so it is required to create the sessions and to start/resume event stream 60 | if (!mCheckLaunched && (null != Matrix.getInstance(getApplicationContext()).getDefaultSession())) { 61 | CommonActivityUtils.startEventStreamService(MatrixGcmListenerService.this); 62 | mCheckLaunched = true; 63 | } 64 | 65 | CommonActivityUtils.catchupEventStream(MatrixGcmListenerService.this); 66 | } 67 | }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/gcm/MatrixInstanceIDListenerService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.matrix.console.gcm; 18 | 19 | import android.content.Intent; 20 | import android.content.SharedPreferences; 21 | import android.preference.PreferenceManager; 22 | import android.util.Log; 23 | 24 | import com.google.android.gms.iid.InstanceID; 25 | import com.google.android.gms.iid.InstanceIDListenerService; 26 | 27 | import org.matrix.console.Matrix; 28 | 29 | public class MatrixInstanceIDListenerService extends InstanceIDListenerService { 30 | 31 | private static final String LOG_TAG = "MatrixInstanceIDLS"; 32 | 33 | /** 34 | * Called if InstanceID token is updated. This may occur if the security of 35 | * the previous token had been compromised. This call is initiated by the 36 | * InstanceID provider. 37 | */ 38 | @Override 39 | public void onTokenRefresh() { 40 | Log.d(LOG_TAG, "onTokenRefresh"); 41 | Matrix.getInstance(this).getSharedGcmRegistrationManager().refreshPushToken(this, null); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/util/ResourceUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console.util; 17 | 18 | import android.app.Activity; 19 | import android.net.Uri; 20 | import android.util.Log; 21 | import android.webkit.MimeTypeMap; 22 | 23 | import java.io.File; 24 | import java.io.FileInputStream; 25 | import java.io.IOException; 26 | import java.io.InputStream; 27 | 28 | /** 29 | * Static resource utility methods. 30 | */ 31 | public class ResourceUtils { 32 | 33 | private static final String LOG_TAG = "ResourceUtils"; 34 | 35 | public static class Resource { 36 | public final InputStream contentStream; 37 | public final String mimeType; 38 | 39 | public Resource(InputStream contentStream, String mimeType) { 40 | this.contentStream = contentStream; 41 | this.mimeType = mimeType; 42 | } 43 | } 44 | 45 | /** 46 | * Get a resource stream and metadata about it given its URI returned from onActivityResult. 47 | * 48 | * @param activity the activity 49 | * @param uri the URI 50 | * @return a {@link Resource} encapsulating the opened resource stream and associated metadata 51 | * or {@code null} if opening the resource stream failed. 52 | */ 53 | public static Resource openResource(Activity activity, Uri uri) { 54 | try { 55 | String mimetype = activity.getContentResolver().getType(uri); 56 | 57 | // try to find the mimetype from the filename 58 | if (null == mimetype) { 59 | String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString()); 60 | if (extension != null) { 61 | mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 62 | } 63 | } 64 | 65 | return new Resource( 66 | activity.getContentResolver().openInputStream(uri), 67 | mimetype); 68 | 69 | } catch (Exception e) { 70 | Log.e(LOG_TAG, "Failed to open resource input stream", e); 71 | } 72 | 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/util/SlidableImageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console.util; 17 | 18 | 19 | import java.io.Serializable; 20 | 21 | public class SlidableImageInfo implements Serializable { 22 | public String midentifier; 23 | public String mImageUrl = null; 24 | public int mRotationAngle = 0; 25 | public int mOrientation = 0; 26 | public String mMimeType = null; 27 | 28 | // default constructor 29 | public SlidableImageInfo() { 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/util/UIUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console.util; 17 | 18 | import android.app.Activity; 19 | import android.widget.Toast; 20 | 21 | import org.matrix.androidsdk.rest.callback.ApiCallback; 22 | import org.matrix.androidsdk.rest.callback.SimpleApiCallback; 23 | import org.matrix.androidsdk.rest.model.MatrixError; 24 | import org.matrix.console.R; 25 | 26 | public class UIUtils { 27 | 28 | public static boolean hasFieldChanged(String oldVal, String newVal) { 29 | if (oldVal == null) { 30 | return (newVal != null) && (newVal.length() != 0); 31 | } 32 | else { 33 | return !oldVal.equals(newVal); 34 | } 35 | } 36 | 37 | public static ApiCallback buildOnChangeCallback(final Activity activity) { 38 | return new SimpleApiCallback(activity) { 39 | @Override 40 | public void onSuccess(Void info) { 41 | if (null != activity) { 42 | activity.runOnUiThread(new Runnable() { 43 | @Override 44 | public void run() { 45 | Toast.makeText(activity, R.string.message_changes_successful, Toast.LENGTH_LONG).show(); 46 | } 47 | }); 48 | } 49 | } 50 | 51 | @Override 52 | public void onMatrixError(final MatrixError e) { 53 | if (null != activity) { 54 | activity.runOnUiThread(new Runnable() { 55 | @Override 56 | public void run() { 57 | Toast.makeText(activity, e.error, Toast.LENGTH_LONG).show(); 58 | } 59 | }); 60 | } 61 | } 62 | }; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/view/ConsoleEditText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console.view; 17 | 18 | import android.content.ClipData; 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.widget.EditText; 22 | 23 | public class ConsoleEditText extends EditText { 24 | 25 | Context mConsoleContext = null; 26 | 27 | public ConsoleEditText(Context context) { 28 | super(context); 29 | mConsoleContext = context; 30 | } 31 | 32 | public ConsoleEditText(Context context, AttributeSet attrs) { 33 | super(context, attrs); 34 | mConsoleContext = context; 35 | } 36 | 37 | public ConsoleEditText(Context context, AttributeSet attrs, int defStyleAttr) { 38 | super(context, attrs, defStyleAttr); 39 | mConsoleContext = context; 40 | } 41 | 42 | @Override 43 | public boolean onTextContextMenuItem(int id) { 44 | 45 | if (android.R.id.paste == id) { 46 | android.content.ClipboardManager clipboardManager = (android.content.ClipboardManager) mConsoleContext.getSystemService(Context.CLIPBOARD_SERVICE); 47 | 48 | ClipData aClipData = clipboardManager.getPrimaryClip(); 49 | 50 | aClipData = aClipData; 51 | //android.content.ClipData clip = android.content.ClipData.newPlainText("text label","text to clip"); 52 | //clipboard.setPrimaryClip(clip); 53 | 54 | 55 | 56 | 57 | } 58 | 59 | 60 | return super.onTextContextMenuItem(id); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /console/src/main/java/org/matrix/console/view/SwipableWebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 OpenMarket Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.matrix.console.view; 17 | 18 | import android.content.ClipData; 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.webkit.WebView; 22 | 23 | public class SwipableWebView extends WebView { 24 | 25 | static int THRESHOLD = 100; 26 | 27 | 28 | /** 29 | * Construct a new WebView with layout parameters and a default style. 30 | * @param context A Context object used to access application assets. 31 | * @param attrs An AttributeSet passed to our parent. 32 | * @param defStyle The default style resource ID. 33 | */ 34 | public SwipableWebView(Context context, AttributeSet attrs, int defStyle) { 35 | super(context, attrs, defStyle); 36 | } 37 | 38 | 39 | @Override 40 | protected void onOverScrolled (int scrollX, int scrollY, boolean clampedX, boolean clampedY) { 41 | if (scrollX > (getWidth() + THRESHOLD) && clampedX) { 42 | int left = 0; 43 | left++; 44 | //onSwipeLeft(); 45 | } 46 | if (scrollX < - THRESHOLD && clampedX) { 47 | int right = 0; 48 | right++; 49 | } 50 | super.onOverScrolled(scrollX, scrollY, clampedX, clampedY); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /console/src/main/res/anim/anim_slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /console/src/main/res/anim/anim_slide_nothing.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /console/src/main/res/anim/anim_slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /console/src/main/res/drawable-hdpi/ic_menu_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-hdpi/ic_menu_search.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-hdpi/matrix_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-hdpi/matrix_ic_launcher.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-mdpi/ic_menu_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-mdpi/ic_menu_search.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-mdpi/matrix_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-mdpi/matrix_ic_launcher.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xhdpi/ic_menu_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xhdpi/ic_menu_search.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xhdpi/matrix_console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xhdpi/matrix_console.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xhdpi/matrix_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xhdpi/matrix_ic_launcher.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_bug_report.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_bug_report_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_bug_report_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_call.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_camera.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_clear.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_copy.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_delete.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_description.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_description.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_done_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_done_all.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_exit_to_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_exit_to_app.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_exit_to_app_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_exit_to_app_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_file.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_find_in_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_find_in_page.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_forward.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_group.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_group_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_group_add.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_group_add_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_group_add_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_group_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_group_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_home.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_menu.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_message.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_paste.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_person_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_person_add.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_person_add_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_person_add_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_remove_circle_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_remove_circle_outline.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_save.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_search.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_send.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_settings.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_settings_applications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_settings_applications.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_settings_applications_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_settings_applications_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_settings_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_settings_small.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_share.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_videocam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_videocam.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_material_volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_material_volume.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_allfriends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_allfriends.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_block.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_blocked_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_blocked_user.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_btn_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_btn_add.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_cc_am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_cc_am.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_delete.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_edit.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_friendslist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_friendslist.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_home.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_info_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_info_details.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_invite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_invite.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_manage.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_mapmode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_mapmode.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_matrix_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_matrix_transparent.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_notifications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_notifications.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_refresh.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_search.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_settings_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_settings_holo_light.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_small_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_small_matrix.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_small_matrix_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_small_matrix_transparent.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/ic_menu_start_conversation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/ic_menu_start_conversation.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/logo_large.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/matrix_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/matrix_ic_launcher.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/matrix_icon_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/matrix_icon_user.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/notification_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/notification_add.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/notification_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/notification_delete.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/notification_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/notification_pause.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/notification_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/notification_play.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/video.png -------------------------------------------------------------------------------- /console/src/main/res/drawable-xxhdpi/voice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/matrix-android-console/c1b20395a97d83c5992729292cecca0f119a7d27/console/src/main/res/drawable-xxhdpi/voice.png -------------------------------------------------------------------------------- /console/src/main/res/drawable/avatar_mask.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /console/src/main/res/drawable/black_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /console/src/main/res/layout/account_section_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 17 | 18 | 21 | 22 | 31 | 32 | 40 | 41 |