Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-client-android
Commits
150352e2
Commit
150352e2
authored
12 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
#15273: Add setOnPageChangeListener in preference activity
parent
1bcaf53d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
res/values/strings.xml
+2
-0
2 additions, 0 deletions
res/values/strings.xml
src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
+33
-6
33 additions, 6 deletions
...airelinux/sflphone/client/SFLPhonePreferenceActivity.java
with
35 additions
and
6 deletions
res/values/strings.xml
+
2
−
0
View file @
150352e2
...
...
@@ -37,4 +37,6 @@ as that of the covered work.
<string
name=
"title_section3"
>
Test
</string>
<string
name=
"menu_settings"
>
Settings
</string>
<string
name=
"title_activity_sflphone_home"
>
SFLPhone
</string>
<string
name=
"preference_section1"
>
Accounts
</string>
<string
name=
"preference_section2"
>
Preferences
</string>
</resources>
This diff is collapsed.
Click to expand it.
src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
+
33
−
6
View file @
150352e2
...
...
@@ -51,7 +51,8 @@ import android.widget.TextView;
import
com.savoirfairelinux.sflphone.R
;
public
class
SFLPhonePreferenceActivity
extends
Activity
implements
ActionBar
.
TabListener
{
public
class
SFLPhonePreferenceActivity
extends
Activity
implements
ActionBar
.
TabListener
{
static
final
int
NUM_PAGES
=
2
;
static
final
String
TAG
=
"SFLPhonePreferenceActivity"
;
PreferencesPagerAdapter
mPreferencesPagerAdapter
;
...
...
@@ -74,9 +75,17 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
mViewPager
=
(
ViewPager
)
findViewById
(
R
.
id
.
preferences_pager
);
mViewPager
.
setAdapter
(
mPreferencesPagerAdapter
);
mViewPager
.
setOnPageChangeListener
(
new
ViewPager
.
SimpleOnPageChangeListener
()
{
@Override
public
void
onPageSelected
(
int
position
)
{
actionBar
.
setSelectedNavigationItem
(
position
);
}
});
for
(
int
i
=
0
;
i
<
mPreferencesPagerAdapter
.
getCount
();
i
++)
{
actionBar
.
addTab
(
actionBar
.
newTab
().
setTabListener
(
this
));
actionBar
.
addTab
(
actionBar
.
newTab
().
setText
(
mPreferencesPagerAdapter
.
getPageTitle
(
i
)).
setTabListener
(
this
));
}
...
...
@@ -98,21 +107,39 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
{
}
public
static
class
PreferencesPagerAdapter
extends
FragmentStatePagerAdapter
{
public
class
PreferencesPagerAdapter
extends
FragmentStatePagerAdapter
{
public
PreferencesPagerAdapter
(
FragmentManager
fm
)
{
public
PreferencesPagerAdapter
(
FragmentManager
fm
)
{
super
(
fm
);
}
@Override
public
int
getCount
()
{
public
int
getCount
()
{
return
NUM_PAGES
;
}
@Override
public
Fragment
getItem
(
int
position
)
{
public
Fragment
getItem
(
int
position
)
{
return
ArrayListFragment
.
newInstance
(
position
);
}
@Override
public
CharSequence
getPageTitle
(
int
position
)
{
switch
(
position
)
{
case
0
:
return
getString
(
R
.
string
.
preference_section1
).
toUpperCase
();
case
1
:
return
getString
(
R
.
string
.
preference_section2
).
toUpperCase
();
default
:
Log
.
e
(
TAG
,
"getPreferencePageTitle: unknown tab position "
+
position
);
break
;
}
return
null
;
}
}
public
static
class
ArrayListFragment
extends
ListFragment
{
...
...
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