Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-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
xabber-android
Commits
ad9187ca
Commit
ad9187ca
authored
Jul 06, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Blackhole16/xabber-android
into Blackhole16-master
parents
14f86fcb
c0c12250
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
3 deletions
+134
-3
DatabaseManager.java
...rc/main/java/com/xabber/android/data/DatabaseManager.java
+1
-1
SettingsManager.java
...rc/main/java/com/xabber/android/data/SettingsManager.java
+5
-0
RoomChat.java
.../java/com/xabber/android/data/extension/muc/RoomChat.java
+6
-0
ChatManager.java
...ava/com/xabber/android/data/message/chat/ChatManager.java
+45
-2
Suppress100Table.java
...om/xabber/android/data/message/chat/Suppress100Table.java
+62
-0
ChatContactSettingsFragment.java
...r/android/ui/preferences/ChatContactSettingsFragment.java
+5
-0
preference_editor.xml
app/src/main/res/values-de-rDE/preference_editor.xml
+1
-0
preference_editor.xml
app/src/main/res/values/preference_editor.xml
+1
-0
preferences.xml
app/src/main/res/values/preferences.xml
+4
-0
preference_chat_contact.xml
app/src/main/res/xml/preference_chat_contact.xml
+4
-0
No files found.
app/src/main/java/com/xabber/android/data/DatabaseManager.java
View file @
ad9187ca
...
...
@@ -38,7 +38,7 @@ public class DatabaseManager extends SQLiteOpenHelper implements
OnLoadListener
,
OnClearListener
{
private
static
final
String
DATABASE_NAME
=
"xabber.db"
;
private
static
final
int
DATABASE_VERSION
=
6
7
;
private
static
final
int
DATABASE_VERSION
=
6
8
;
private
static
final
SQLiteException
DOWNGRAD_EXCEPTION
=
new
SQLiteException
(
"Database file was deleted"
);
...
...
app/src/main/java/com/xabber/android/data/SettingsManager.java
View file @
ad9187ca
...
...
@@ -227,6 +227,11 @@ public class SettingsManager implements OnInitializedListener,
R
.
bool
.
events_vibro_default
);
}
public
static
boolean
eventsSuppress100
()
{
return
getBoolean
(
R
.
string
.
chat_events_suppress_100_key
,
R
.
bool
.
chat_events_suppress_100_default
);
}
public
static
boolean
eventsIgnoreSystemVibro
()
{
return
getBoolean
(
R
.
string
.
events_ignore_system_vibro_key
,
R
.
bool
.
events_ignore_system_vibro_default
);
...
...
app/src/main/java/com/xabber/android/data/extension/muc/RoomChat.java
View file @
ad9187ca
...
...
@@ -22,6 +22,7 @@ import com.xabber.android.data.account.StatusMode;
import
com.xabber.android.data.message.AbstractChat
;
import
com.xabber.android.data.message.ChatAction
;
import
com.xabber.android.data.message.MessageItem
;
import
com.xabber.android.data.message.chat.ChatManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.xmpp.address.Jid
;
import
com.xabber.xmpp.delay.Delay
;
...
...
@@ -199,6 +200,11 @@ public class RoomChat extends AbstractChat {
onInvitationDeclined
(
mucUser
.
getDecline
().
getFrom
(),
mucUser
.
getDecline
().
getReason
());
return
true
;
}
if
(
mucUser
!=
null
&&
mucUser
.
getStatus
()
!=
null
&&
mucUser
.
getStatus
().
getCode
().
equals
(
"100"
)
&&
ChatManager
.
getInstance
().
isSuppress100
(
account
,
user
))
{
// 'This room is not anonymous'
return
true
;
}
final
String
text
=
message
.
getBody
();
final
String
subject
=
message
.
getSubject
();
if
(
text
==
null
&&
subject
==
null
)
{
...
...
app/src/main/java/com/xabber/android/data/message/chat/ChatManager.java
View file @
ad9187ca
...
...
@@ -71,6 +71,10 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
* Sound, associated with chat for user in account.
*/
private
final
NestedMap
<
Uri
>
sounds
;
/**
* Whether 'This room is not anonymous'-messages (Status Code 100) should be suppressed
*/
private
final
NestedMap
<
Boolean
>
suppress100
;
private
ChatManager
()
{
chatInputs
=
new
NestedMap
<
ChatInput
>();
...
...
@@ -79,6 +83,7 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
showText
=
new
NestedMap
<>();
makeVibro
=
new
NestedMap
<
Boolean
>();
notifyVisible
=
new
NestedMap
<
Boolean
>();
suppress100
=
new
NestedMap
<
Boolean
>();
}
public
static
ChatManager
getInstance
()
{
...
...
@@ -92,6 +97,7 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
final
NestedMap
<
ShowMessageTextInNotification
>
showText
=
new
NestedMap
<>();
final
NestedMap
<
Boolean
>
makeVibro
=
new
NestedMap
<
Boolean
>();
final
NestedMap
<
Uri
>
sounds
=
new
NestedMap
<
Uri
>();
final
NestedMap
<
Boolean
>
suppress100
=
new
NestedMap
<
Boolean
>();
Cursor
cursor
;
cursor
=
PrivateChatTable
.
getInstance
().
list
();
try
{
...
...
@@ -158,18 +164,31 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
cursor
.
close
();
}
cursor
=
Suppress100Table
.
getInstance
().
list
();
try
{
if
(
cursor
.
moveToFirst
())
{
do
{
makeVibro
.
put
(
Suppress100Table
.
getAccount
(
cursor
),
Suppress100Table
.
getUser
(
cursor
),
Suppress100Table
.
getValue
(
cursor
));
}
while
(
cursor
.
moveToNext
());
}
}
finally
{
cursor
.
close
();
}
Application
.
getInstance
().
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
onLoaded
(
privateChats
,
notifyVisible
,
showText
,
makeVibro
,
sounds
);
sounds
,
suppress100
);
}
});
}
private
void
onLoaded
(
Set
<
BaseEntity
>
privateChats
,
NestedMap
<
Boolean
>
notifyVisible
,
NestedMap
<
ShowMessageTextInNotification
>
showText
,
NestedMap
<
Boolean
>
vibro
,
NestedMap
<
Uri
>
sounds
)
{
NestedMap
<
Boolean
>
vibro
,
NestedMap
<
Uri
>
sounds
,
NestedMap
<
Boolean
>
suppress100
)
{
for
(
BaseEntity
baseEntity
:
privateChats
)
this
.
privateChats
.
put
(
baseEntity
.
getAccount
(),
baseEntity
.
getUser
(),
PRIVATE_CHAT
);
...
...
@@ -177,6 +196,7 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
this
.
showText
.
addAll
(
showText
);
this
.
makeVibro
.
addAll
(
vibro
);
this
.
sounds
.
addAll
(
sounds
);
this
.
suppress100
.
addAll
(
suppress100
);
}
@Override
...
...
@@ -187,6 +207,7 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
showText
.
clear
(
accountItem
.
getAccount
());
makeVibro
.
clear
(
accountItem
.
getAccount
());
notifyVisible
.
clear
(
accountItem
.
getAccount
());
suppress100
.
clear
(
accountItem
.
getAccount
());
}
/**
...
...
@@ -391,4 +412,26 @@ public class ChatManager implements OnLoadListener, OnAccountRemovedListener {
});
}
/**
* @param account
* @param user
* @return Whether 'This Room is not Anonymous'-messages (Status Code 100) should be suppressed.
*/
public
boolean
isSuppress100
(
String
account
,
String
user
)
{
Boolean
value
=
suppress100
.
get
(
account
,
user
);
if
(
value
==
null
)
return
SettingsManager
.
eventsSuppress100
();
return
value
;
}
public
void
setSuppress100
(
final
String
account
,
final
String
user
,
final
boolean
value
)
{
suppress100
.
put
(
account
,
user
,
value
);
Application
.
getInstance
().
runInBackground
(
new
Runnable
()
{
@Override
public
void
run
()
{
Suppress100Table
.
getInstance
().
write
(
account
,
user
,
value
);
}
});
}
}
app/src/main/java/com/xabber/android/data/message/chat/Suppress100Table.java
0 → 100644
View file @
ad9187ca
package
com
.
xabber
.
android
.
data
.
message
.
chat
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteStatement
;
import
com.xabber.android.data.DatabaseManager
;
/**
* Storage with suppress100 settings for each chat.
* @author <a href="mailto:jaro.fietz@uniscon.de">Jaro Fietz</a>.
*/
class
Suppress100Table
extends
AbstractChatPropertyTable
<
Boolean
>
{
static
final
String
NAME
=
"chat_suppress_100"
;
private
final
static
Suppress100Table
instance
;
static
{
instance
=
new
Suppress100Table
(
DatabaseManager
.
getInstance
());
DatabaseManager
.
getInstance
().
addTable
(
instance
);
}
public
static
Suppress100Table
getInstance
()
{
return
instance
;
}
private
Suppress100Table
(
DatabaseManager
databaseManager
)
{
super
(
databaseManager
);
}
@Override
protected
String
getTableName
()
{
return
NAME
;
}
@Override
String
getValueType
()
{
return
"INTEGER"
;
}
@Override
void
bindValue
(
SQLiteStatement
writeStatement
,
Boolean
value
)
{
writeStatement
.
bindLong
(
3
,
value
?
1
:
0
);
}
@Override
public
void
migrate
(
SQLiteDatabase
db
,
int
toVersion
)
{
super
.
migrate
(
db
,
toVersion
);
switch
(
toVersion
)
{
case
68
:
initialMigrate
(
db
,
NAME
,
"INTEGER"
);
break
;
default
:
break
;
}
}
static
boolean
getValue
(
Cursor
cursor
)
{
return
cursor
.
getLong
(
cursor
.
getColumnIndex
(
Fields
.
VALUE
))
!=
0
;
}
}
app/src/main/java/com/xabber/android/ui/preferences/ChatContactSettingsFragment.java
View file @
ad9187ca
...
...
@@ -53,6 +53,8 @@ public class ChatContactSettingsFragment extends BaseSettingsFragment {
.
isMakeVibro
(
account
,
user
));
putValue
(
map
,
R
.
string
.
chat_events_sound_key
,
ChatManager
.
getInstance
()
.
getSound
(
account
,
user
));
putValue
(
map
,
R
.
string
.
chat_events_suppress_100_key
,
ChatManager
.
getInstance
()
.
isSuppress100
(
account
,
user
));
return
map
;
}
...
...
@@ -82,6 +84,9 @@ public class ChatContactSettingsFragment extends BaseSettingsFragment {
ChatManager
.
getInstance
().
setSound
(
account
,
user
,
getUri
(
result
,
R
.
string
.
chat_events_sound_key
));
if
(
hasChanges
(
source
,
result
,
R
.
string
.
chat_events_suppress_100_key
))
ChatManager
.
getInstance
().
setSuppress100
(
account
,
user
,
getBoolean
(
result
,
R
.
string
.
chat_events_suppress_100_key
));
return
true
;
}
...
...
app/src/main/res/values-de-rDE/preference_editor.xml
View file @
ad9187ca
...
...
@@ -65,6 +65,7 @@
<string
name=
"events_message_none"
>
Nicht benachrichtigen
</string>
<string
name=
"events_show_text"
>
Nachricht in der Statusleiste anzeigen\nNachricht in der Statusleiste anzeigen
</string>
<string
name=
"events_visible_chat"
>
Benachrichtigung bei offenem Chat\nBenachrichtigung bei eingehender Nachricht im offenen Chat
</string>
<string
name=
"events_suppress_100"
>
Unterdrücke Status Code 100\nUnterdrücke \'Dieser Raum ist nicht anonym\' Meldungen
</string>
<string
name=
"negative_priotiry_summary"
>
%s (Du wirst aus keinem Chat Nachrichten erhalten)
</string>
<string
name=
"preference_accounts"
>
XMPP-Konten\nKonten verwalten
</string>
<string
name=
"preference_security"
>
Sicherheit\nSicherheitseinstellungen
</string>
...
...
app/src/main/res/values/preference_editor.xml
View file @
ad9187ca
...
...
@@ -64,6 +64,7 @@
<string
name=
"events_message_none"
>
Don\'t notify
</string>
<string
name=
"events_show_text"
>
Show message in notification\nShow message text in notification area
</string>
<string
name=
"events_visible_chat"
>
Notify in current chat\nNotify on incoming messages in current chat
</string>
<string
name=
"events_suppress_100"
>
Suppress Status Code 100\nDon\'t get \'This room is not anonymous\' messages
</string>
<string
name=
"negative_priotiry_summary"
>
%s (you won\'t receive messages from any chat)
</string>
<string
name=
"preference_accounts"
>
XMPP accounts\nManage accounts
</string>
<string
name=
"preference_security"
>
Security\nSecurity settings
</string>
...
...
app/src/main/res/values/preferences.xml
View file @
ad9187ca
...
...
@@ -74,6 +74,7 @@
<item>
com.xabber.android.data.extension.otr.OTRTable
</item>
<item>
com.xabber.android.data.message.chat.VibroTable
</item>
<item>
com.xabber.android.data.notification.NotificationTable
</item>
<item>
com.xabber.android.data.message.chat.Suppress100Table
</item>
<item>
com.xabber.android.data.message.phrase.PhraseTable
</item>
</string-array>
...
...
@@ -495,6 +496,9 @@
<string
name=
"chat_events_vibro_key"
>
chat_events_vibro
</string>
<string
name=
"chat_events_visible_chat_key"
>
chat_events_visible_chat
</string>
<string
name=
"chat_events_suppress_100_key"
>
chat_events_suppress_100
</string>
<bool
name=
"chat_events_suppress_100_default"
>
false
</bool>
<!-- preference_xabber -->
<string
name=
"preference_xabber_key"
>
preference_xabber
</string>
...
...
app/src/main/res/xml/preference_chat_contact.xml
View file @
ad9187ca
...
...
@@ -40,4 +40,8 @@
android:key=
"@string/chat_events_visible_chat_key"
android:title=
"@string/events_visible_chat"
/>
<CheckBoxPreference
android:key=
"@string/chat_events_suppress_100_key"
android:title=
"@string/events_suppress_100"
/>
</PreferenceScreen>
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