Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
c184458d
Commit
c184458d
authored
12 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Added app sharing button to contact list activity.
parent
a2b3af87
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
briar-android/res/values/strings.xml
+1
-0
1 addition, 0 deletions
briar-android/res/values/strings.xml
briar-android/src/net/sf/briar/android/contact/ContactListActivity.java
+23
-2
23 additions, 2 deletions
...src/net/sf/briar/android/contact/ContactListActivity.java
with
24 additions
and
2 deletions
briar-android/res/values/strings.xml
+
1
−
0
View file @
c184458d
...
...
@@ -19,6 +19,7 @@
<string
name=
"quit_button"
>
Quit
</string>
<string
name=
"new_identity_item"
>
New identity\u2026
</string>
<string
name=
"contact_list_title"
>
Contacts
</string>
<string
name=
"share_app"
>
Share the Briar App
</string>
<string
name=
"contact_connected"
>
Connected
</string>
<string
name=
"format_last_connected"
>
Last connected
<
br /
>
%1$s
</string>
<string
name=
"add_contact_title"
>
Add a Contact
</string>
...
...
This diff is collapsed.
Click to expand it.
briar-android/src/net/sf/briar/android/contact/ContactListActivity.java
+
23
−
2
View file @
c184458d
package
net.sf.briar.android.contact
;
import
static
android
.
content
.
Intent
.
ACTION_SEND
;
import
static
android
.
content
.
Intent
.
EXTRA_STREAM
;
import
static
android
.
view
.
Gravity
.
CENTER
;
import
static
android
.
view
.
Gravity
.
CENTER_HORIZONTAL
;
import
static
android
.
widget
.
LinearLayout
.
HORIZONTAL
;
...
...
@@ -10,6 +12,7 @@ import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
import
static
net
.
sf
.
briar
.
android
.
widgets
.
CommonLayoutParams
.
MATCH_WRAP
;
import
static
net
.
sf
.
briar
.
android
.
widgets
.
CommonLayoutParams
.
MATCH_WRAP_1
;
import
java.io.File
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.Map
;
...
...
@@ -35,6 +38,7 @@ import net.sf.briar.api.db.event.DatabaseListener;
import
net.sf.briar.api.transport.ConnectionListener
;
import
net.sf.briar.api.transport.ConnectionRegistry
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
...
...
@@ -56,6 +60,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
@Inject
private
ConnectionRegistry
connectionRegistry
;
private
ContactListAdapter
adapter
=
null
;
private
ListView
list
=
null
;
private
ImageButton
addContactButton
=
null
,
shareButton
=
null
;
// Fields that are accessed from background threads must be volatile
@Inject
private
volatile
DatabaseComponent
db
;
...
...
@@ -85,12 +90,19 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
footer
.
setGravity
(
CENTER
);
footer
.
addView
(
new
HorizontalSpace
(
this
));
ImageButton
addContactButton
=
new
ImageButton
(
this
);
addContactButton
=
new
ImageButton
(
this
);
addContactButton
.
setBackgroundResource
(
0
);
addContactButton
.
setImageResource
(
R
.
drawable
.
social_add_person
);
addContactButton
.
setOnClickListener
(
this
);
footer
.
addView
(
addContactButton
);
footer
.
addView
(
new
HorizontalSpace
(
this
));
shareButton
=
new
ImageButton
(
this
);
shareButton
.
setBackgroundResource
(
0
);
shareButton
.
setImageResource
(
R
.
drawable
.
social_share
);
shareButton
.
setOnClickListener
(
this
);
footer
.
addView
(
shareButton
);
footer
.
addView
(
new
HorizontalSpace
(
this
));
layout
.
addView
(
footer
);
setContentView
(
layout
);
...
...
@@ -163,7 +175,16 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
}
public
void
onClick
(
View
view
)
{
startActivity
(
new
Intent
(
this
,
AddContactActivity
.
class
));
if
(
view
==
addContactButton
)
{
startActivity
(
new
Intent
(
this
,
AddContactActivity
.
class
));
}
else
if
(
view
==
shareButton
)
{
String
apkPath
=
getPackageCodePath
();
Intent
i
=
new
Intent
(
ACTION_SEND
);
i
.
setType
(
"application/*"
);
i
.
putExtra
(
EXTRA_STREAM
,
Uri
.
fromFile
(
new
File
(
apkPath
)));
String
shareApp
=
getResources
().
getString
(
R
.
string
.
share_app
);
startActivity
(
Intent
.
createChooser
(
i
,
shareApp
));
}
}
public
void
eventOccurred
(
DatabaseEvent
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment