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
156897f1
Commit
156897f1
authored
Mar 19, 2013
by
a-iv
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #141 from vkotovv/history_export
Export chat in the background thread
parents
79d1abb6
b53e23a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
12 deletions
+38
-12
ChatViewer.java
src/com/xabber/android/ui/ChatViewer.java
+38
-12
No files found.
src/com/xabber/android/ui/ChatViewer.java
View file @
156897f1
...
...
@@ -21,6 +21,7 @@ import android.app.Dialog;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.text.ClipboardManager
;
import
android.view.ContextMenu
;
...
...
@@ -745,26 +746,51 @@ public class ChatViewer extends ManagedActivity implements
switch
(
dialogBuilder
.
getDialogId
())
{
case
DIALOG_EXPORT_CHAT_ID:
ExportChatDialogBuilder
builder
=
(
ExportChatDialogBuilder
)
dialogBuilder
;
File
file
;
exportChat
(
builder
);
}
}
private
void
exportChat
(
ExportChatDialogBuilder
dialogBuilder
)
{
//TODO: retain AsyncTask via retained fragment
new
ChatExportAsyncTask
(
dialogBuilder
).
execute
();
}
private
class
ChatExportAsyncTask
extends
AsyncTask
<
Void
,
Void
,
File
>
{
private
ExportChatDialogBuilder
builder
;
public
ChatExportAsyncTask
(
ExportChatDialogBuilder
builder
)
{
this
.
builder
=
builder
;
}
@Override
protected
File
doInBackground
(
Void
...
params
)
{
File
file
=
null
;
try
{
file
=
MessageManager
.
getInstance
().
exportChat
(
actionWithAccount
,
actionWithUser
,
builder
.
getName
());
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
return
;
}
if
(
builder
.
isSendChecked
())
{
Intent
intent
=
new
Intent
(
android
.
content
.
Intent
.
ACTION_SEND
);
intent
.
setType
(
"text/plain"
);
Uri
uri
=
Uri
.
fromFile
(
file
);
intent
.
putExtra
(
android
.
content
.
Intent
.
EXTRA_STREAM
,
uri
);
startActivity
(
Intent
.
createChooser
(
intent
,
getString
(
R
.
string
.
export_chat
)));
}
else
{
Toast
.
makeText
(
this
,
R
.
string
.
export_chat_done
,
Toast
.
LENGTH_LONG
).
show
();
return
file
;
}
@Override
public
void
onPostExecute
(
File
result
)
{
if
(
result
!=
null
)
{
if
(
builder
.
isSendChecked
())
{
Intent
intent
=
new
Intent
(
android
.
content
.
Intent
.
ACTION_SEND
);
intent
.
setType
(
"text/plain"
);
Uri
uri
=
Uri
.
fromFile
(
result
);
intent
.
putExtra
(
android
.
content
.
Intent
.
EXTRA_STREAM
,
uri
);
startActivity
(
Intent
.
createChooser
(
intent
,
getString
(
R
.
string
.
export_chat
)));
}
else
{
Toast
.
makeText
(
ChatViewer
.
this
,
R
.
string
.
export_chat_done
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
}
@Override
...
...
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