Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
66266976
Commit
66266976
authored
Dec 22, 2016
by
Tiago Cunha
Committed by
GitHub
Dec 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #107 from RocketChat/fix/external-storage-permission
Ask for permission
parents
c0001283
ce95423e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
104 deletions
+127
-104
build.gradle
app/build.gradle
+97
-94
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+10
-9
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+20
-1
No files found.
app/build.gradle
View file @
66266976
...
@@ -6,123 +6,126 @@ apply plugin: 'com.github.triplet.play'
...
@@ -6,123 +6,126 @@ apply plugin: 'com.github.triplet.play'
apply
from:
'../config/quality/quality.gradle'
apply
from:
'../config/quality/quality.gradle'
buildscript
{
buildscript
{
repositories
{
repositories
{
jcenter
()
jcenter
()
mavenCentral
()
mavenCentral
()
}
}
dependencies
{
dependencies
{
classpath
rootProject
.
ext
.
androidPlugin
classpath
rootProject
.
ext
.
androidPlugin
// NOTE: Do not place your application dependencies here; they belong
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// in the individual module build.gradle files
classpath
rootProject
.
ext
.
retroLambdaPlugin
classpath
rootProject
.
ext
.
retroLambdaPlugin
classpath
rootProject
.
ext
.
retroLambdaPatch
classpath
rootProject
.
ext
.
retroLambdaPatch
classpath
rootProject
.
ext
.
realmPlugin
classpath
rootProject
.
ext
.
realmPlugin
classpath
'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath
'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath
'com.google.gms:google-services:3.0.0'
classpath
'com.google.gms:google-services:3.0.0'
classpath
'com.github.triplet.gradle:play-publisher:1.1.5'
classpath
'com.github.triplet.gradle:play-publisher:1.1.5'
}
}
// Exclude the version that the android plugin depends on.
// Exclude the version that the android plugin depends on.
configurations
.
classpath
.
exclude
group:
'com.android.tools.external.lombok'
configurations
.
classpath
.
exclude
group:
'com.android.tools.external.lombok'
}
}
android
{
android
{
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
defaultConfig
{
defaultConfig
{
applicationId
"chat.rocket.android"
applicationId
"chat.rocket.android"
minSdkVersion
rootProject
.
ext
.
minSdkVersion
minSdkVersion
rootProject
.
ext
.
minSdkVersion
targetSdkVersion
rootProject
.
ext
.
compileSdkVersion
targetSdkVersion
rootProject
.
ext
.
compileSdkVersion
versionCode
3
versionCode
3
versionName
"1.0"
versionName
"1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables
.
useSupportLibrary
=
true
vectorDrawables
.
useSupportLibrary
=
true
multiDexEnabled
true
multiDexEnabled
true
}
}
signingConfigs
{
signingConfigs
{
release
{
release
{
storeFile
project
.
rootProject
.
file
(
'Rocket.jks'
).
getCanonicalFile
()
storeFile
project
.
rootProject
.
file
(
'Rocket.jks'
).
getCanonicalFile
()
storePassword
System
.
getenv
(
"KEYSTORE_PASSWORD"
)
storePassword
System
.
getenv
(
"KEYSTORE_PASSWORD"
)
keyAlias
System
.
getenv
(
"KEY_ALIAS"
)
keyAlias
System
.
getenv
(
"KEY_ALIAS"
)
keyPassword
System
.
getenv
(
"KEY_PASSWORD"
)
keyPassword
System
.
getenv
(
"KEY_PASSWORD"
)
}
}
}
}
buildTypes
{
buildTypes
{
release
{
release
{
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
signingConfig
signingConfigs
.
release
signingConfig
signingConfigs
.
release
}
}
}
}
productFlavors
{
productFlavors
{
qa
{
qa
{
// something - qa builds will have some extra stuff for alpha testers
// something - qa builds will have some extra stuff for alpha testers
}
prod
{
// another
}
}
}
prod
{
packagingOptions
{
// another
exclude
'META-INF/LICENSE.txt'
exclude
'META-INF/NOTICE.txt'
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
lintOptions
{
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig
file
(
"lint.xml"
)
}
}
}
packagingOptions
{
exclude
'META-INF/LICENSE.txt'
exclude
'META-INF/NOTICE.txt'
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
lintOptions
{
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig
file
(
"lint.xml"
)
}
}
}
play
{
play
{
jsonFile
=
file
(
'rocket-chat.json'
)
jsonFile
=
file
(
'rocket-chat.json'
)
track
=
"${track}"
track
=
"${track}"
}
}
repositories
{
repositories
{
mavenCentral
()
mavenCentral
()
maven
{
url
'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo'
}
maven
{
url
'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo'
}
maven
{
url
'http://dl.bintray.com/amulyakhare/maven'
}
maven
{
url
'http://dl.bintray.com/amulyakhare/maven'
}
maven
{
url
"https://clojars.org/repo/"
}
//for icepick.
maven
{
url
"https://clojars.org/repo/"
}
//for icepick.
}
}
dependencies
{
dependencies
{
compile
project
(
':log-wrapper'
)
compile
project
(
':log-wrapper'
)
compile
project
(
':android-ddp'
)
compile
project
(
':android-ddp'
)
compile
project
(
':rocket-chat-android-widgets'
)
compile
project
(
':rocket-chat-android-widgets'
)
compile
project
(
':realm-helpers'
)
compile
project
(
':realm-helpers'
)
compile
rootProject
.
ext
.
supportAppCompat
compile
rootProject
.
ext
.
supportAppCompat
compile
rootProject
.
ext
.
supportDesign
compile
rootProject
.
ext
.
supportDesign
qaCompile
(
'com.instabug.library:instabug:3.1.0'
)
{
exclude
group:
'io.reactivex'
}
compile
'com.android.support:multidex:1.0.1'
qaCompile
(
'com.instabug.library:instabug:3.1.0'
)
{
compile
'com.google.firebase:firebase-core:10.0.0'
exclude
group:
'io.reactivex'
compile
'com.google.firebase:firebase-crash:10.0.0'
}
compile
'com.android.support:multidex:1.0.1'
compile
'com.google.firebase:firebase-core:10.0.0'
compile
rootProject
.
ext
.
okhttp3
compile
'com.google.firebase:firebase-crash:10.0.0'
compile
rootProject
.
ext
.
picasso
compile
rootProject
.
ext
.
okhttp3
compile
'com.facebook.stetho:stetho:1.4.1'
compile
rootProject
.
ext
.
picasso
compile
'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile
'com.uphyca:stetho_realm:2.0.1'
compile
'com.facebook.stetho:stetho:1.4.1'
compile
'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile
'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile
'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile
'com.uphyca:stetho_realm:2.0.1'
compile
'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile
'com.trello:rxlifecycle:1.0'
compile
'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile
'com.trello:rxlifecycle-android:1.0'
compile
'com.trello:rxlifecycle-components:1.0'
compile
'com.trello:rxlifecycle:1.0'
compile
'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile
'com.trello:rxlifecycle-android:1.0'
compile
'com.trello:rxlifecycle-components:1.0'
compile
'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile
'frankiesardo:icepick:3.2.0'
provided
'frankiesardo:icepick-processor:3.2.0'
compile
'frankiesardo:icepick:3.2
.0'
compile
'com.github.hotchemi:permissionsdispatcher:2.3
.0'
provided
'frankiesardo:icepick-processor:3.2
.0'
annotationProcessor
'com.github.hotchemi:permissionsdispatcher-processor:2.3
.0'
}
}
apply
plugin:
'com.google.gms.google-services'
apply
plugin:
'com.google.gms.google-services'
app/src/main/AndroidManifest.xml
View file @
66266976
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"chat.rocket.android"
>
package=
"chat.rocket.android"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<application
<application
android:name=
".RocketChatApplication"
android:name=
".RocketChatApplication"
...
@@ -16,23 +17,23 @@
...
@@ -16,23 +17,23 @@
android:name=
".activity.MainActivity"
android:name=
".activity.MainActivity"
android:windowSoftInputMode=
"adjustResize"
>
android:windowSoftInputMode=
"adjustResize"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
<activity
android:name=
".activity.AddServerActivity"
android:name=
".activity.AddServerActivity"
android:windowSoftInputMode=
"adjustResize"
/>
android:windowSoftInputMode=
"adjustResize"
/>
<activity
<activity
android:name=
".activity.ServerConfigActivity"
android:name=
".activity.ServerConfigActivity"
android:windowSoftInputMode=
"adjustResize"
/>
android:windowSoftInputMode=
"adjustResize"
/>
<service
android:name=
".service.RocketChatService"
/>
<service
android:name=
".service.RocketChatService"
/>
<service
android:name=
".service.notification.NotificationDismissalCallbackService"
/>
<service
android:name=
".service.notification.NotificationDismissalCallbackService"
/>
</application>
</application>
</manifest>
</manifest>
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
66266976
package
chat
.
rocket
.
android
.
fragment
.
chatroom
;
package
chat
.
rocket
.
android
.
fragment
.
chatroom
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v4.widget.DrawerLayout
;
...
@@ -31,6 +33,7 @@ import chat.rocket.android.layouthelper.chatroom.MessageComposerManager;
...
@@ -31,6 +33,7 @@ import chat.rocket.android.layouthelper.chatroom.MessageComposerManager;
import
chat.rocket.android.layouthelper.chatroom.MessageListAdapter
;
import
chat.rocket.android.layouthelper.chatroom.MessageListAdapter
;
import
chat.rocket.android.layouthelper.chatroom.PairedMessage
;
import
chat.rocket.android.layouthelper.chatroom.PairedMessage
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.message.AbstractMessageSpec
;
import
chat.rocket.android.message.AudioUploadMessageSpec
;
import
chat.rocket.android.message.AudioUploadMessageSpec
;
import
chat.rocket.android.message.AbstractUploadMessageSpec
;
import
chat.rocket.android.message.AbstractUploadMessageSpec
;
import
chat.rocket.android.message.ImageUploadMessageSpec
;
import
chat.rocket.android.message.ImageUploadMessageSpec
;
...
@@ -48,10 +51,13 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
...
@@ -48,10 +51,13 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
import
chat.rocket.android.realm_helper.RealmStore
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
chat.rocket.android.service.RocketChatService
;
import
chat.rocket.android.service.RocketChatService
;
import
chat.rocket.android.widget.message.MessageComposer
;
import
chat.rocket.android.widget.message.MessageComposer
;
import
permissions.dispatcher.NeedsPermission
;
import
permissions.dispatcher.RuntimePermissions
;
/**
/**
* Chat room screen.
* Chat room screen.
*/
*/
@RuntimePermissions
public
class
RoomFragment
extends
AbstractChatRoomFragment
public
class
RoomFragment
extends
AbstractChatRoomFragment
implements
OnBackPressListener
,
RealmModelListAdapter
.
OnItemClickListener
<
PairedMessage
>
{
implements
OnBackPressListener
,
RealmModelListAdapter
.
OnItemClickListener
<
PairedMessage
>
{
...
@@ -67,7 +73,8 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -67,7 +73,8 @@ public class RoomFragment extends AbstractChatRoomFragment
private
MessageComposerManager
messageComposerManager
;
private
MessageComposerManager
messageComposerManager
;
private
MessageSelectionDialogFragment
.
ClickListener
messageSelectionClickListener
=
private
MessageSelectionDialogFragment
.
ClickListener
messageSelectionClickListener
=
messageSpec
->
messageSpec
.
onSelect
(
RoomFragment
.
this
);
messageSpec
->
RoomFragmentPermissionsDispatcher
.
onMessageSpecSelectedWithCheck
(
RoomFragment
.
this
,
messageSpec
);
public
RoomFragment
()
{
public
RoomFragment
()
{
}
}
...
@@ -365,4 +372,16 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -365,4 +372,16 @@ public class RoomFragment extends AbstractChatRoomFragment
public
boolean
onBackPressed
()
{
public
boolean
onBackPressed
()
{
return
closeSideMenuIfNeeded
();
return
closeSideMenuIfNeeded
();
}
}
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
RoomFragmentPermissionsDispatcher
.
onRequestPermissionsResult
(
this
,
requestCode
,
grantResults
);
}
@NeedsPermission
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
protected
void
onMessageSpecSelected
(
AbstractMessageSpec
messageSpec
)
{
messageSpec
.
onSelect
(
RoomFragment
.
this
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment