Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MobileScreenReadersApi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
public_accessibility_software
MobileScreenReadersApi
Commits
b2c7a6fc
Commit
b2c7a6fc
authored
Apr 08, 2020
by
Paolo Pecis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some useless code
parent
6d5cd79b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
75 deletions
+72
-75
MainActivity.java
...example/paolo/androidaccessibilityorder/MainActivity.java
+72
-75
No files found.
FocusOrder/ANDROIDAccessibilityOrder/app/src/main/java/com/example/paolo/androidaccessibilityorder/MainActivity.java
View file @
b2c7a6fc
package
com
.
example
.
paolo
.
androidaccessibilityorder
;
package
com
.
example
.
paolo
.
androidaccessibilityorder
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.accessibility.AccessibilityEvent
;
import
android.view.accessibility.AccessibilityEvent
;
import
android.view.accessibility.AccessibilityManager
;
import
android.view.accessibility.AccessibilityManager
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
Button
b1
,
b2
,
b3
,
changeorder
;
Button
b1
,
b2
,
b3
,
changeorder
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
LinearLayout
linearlayout
=
findViewById
(
R
.
id
.
linearlayout
);
LinearLayout
linearlayout
=
findViewById
(
R
.
id
.
linearlayout
);
changeorder
=
new
Button
(
this
);
changeorder
=
new
Button
(
this
);
changeorder
.
setId
(
R
.
id
.
changeOrderButton
);
// Add the ID so that accessibility traversal can identify this view
changeorder
.
setId
(
R
.
id
.
changeOrderButton
);
// Add the ID so that accessibility traversal can identify this view
changeorder
.
setText
(
"Presso to change order"
);
changeorder
.
setText
(
"Presso to change order"
);
changeorder
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
changeorder
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
Log
.
i
(
"BUTTON"
,
"Clicked change order button"
);
Log
.
i
(
"BUTTON"
,
"Clicked change order button"
);
b3
.
invalidate
();
//changeorder.setAccessibilityTraversalBefore(b3.getId());
b1
.
invalidate
();
b3
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b2
.
invalidate
();
b3
.
setAccessibilityTraversalAfter
(
changeorder
.
getId
());
//changeorder.setAccessibilityTraversalBefore(b3.getId());
//b3.setAccessibilityTraversalBefore(b1.getId());
b3
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b1
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b3
.
setAccessibilityTraversalAfter
(
changeorder
.
getId
());
b1
.
setAccessibilityTraversalAfter
(
b3
.
getId
());
//b3.setAccessibilityTraversalBefore(b1.getId());
//b1.setAccessibilityTraversalBefore(b2.getId());
b1
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b2
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b1
.
setAccessibilityTraversalAfter
(
b3
.
getId
());
b2
.
setAccessibilityTraversalAfter
(
b1
.
getId
());
//b1.setAccessibilityTraversalBefore(b2.getId());
changeorder
.
setText
(
"Order changed b3,b1,b2"
);
b2
.
setImportantForAccessibility
(
View
.
IMPORTANT_FOR_ACCESSIBILITY_YES
);
b2
.
setAccessibilityTraversalAfter
(
b1
.
getId
());
changeorder
.
setText
(
"Order changed b3,b1,b2"
);
}
});
linearlayout
.
addView
(
changeorder
);
}
});
AccessibilityManager
am
=
((
AccessibilityManager
)
getSystemService
(
ACCESSIBILITY_SERVICE
));
linearlayout
.
addView
(
changeorder
);
if
(
am
.
isEnabled
()){
Log
.
i
(
"PIPPO"
,
"ciao"
);
Log
.
i
(
"SCREENREADER"
,
"talkback is enabled"
);
AccessibilityManager
am
=
((
AccessibilityManager
)
getSystemService
(
ACCESSIBILITY_SERVICE
));
}
if
(
am
.
isEnabled
()){
if
(
am
.
isTouchExplorationEnabled
()){
Log
.
i
(
"PIPPO"
,
"talkback attivo"
);
Log
.
i
(
"SCREENREADER"
,
"Exploration is enabled"
);
}
}
if
(
am
.
isTouchExplorationEnabled
()){
Log
.
i
(
"PIPPO"
,
"Exploration attiva"
);
b1
=
new
Button
(
this
);
}
b1
.
setId
(
R
.
id
.
button1
);
// Add the ID so that accessibility traversal can identify this view
b1
.
setText
(
"BUTTON 1"
);
b1
=
new
Button
(
this
);
linearlayout
.
addView
(
b1
);
b1
.
setId
(
R
.
id
.
button1
);
// Add the ID so that accessibility traversal can identify this view
b1
.
setText
(
"BUTTON 1"
);
linearlayout
.
addView
(
b1
);
b2
=
new
Button
(
this
);
b2
.
setId
(
R
.
id
.
button2
);
// Add the ID so that accessibility traversal can identify this view
b2
.
setText
(
"BUTTON 2"
);
b2
=
new
Button
(
this
);
linearlayout
.
addView
(
b2
);
b2
.
setId
(
R
.
id
.
button2
);
// Add the ID so that accessibility traversal can identify this view
b2
.
setText
(
"BUTTON 2"
);
linearlayout
.
addView
(
b2
);
b3
=
new
Button
(
this
);
b3
.
setId
(
R
.
id
.
button3
);
// Add the ID so that accessibility traversal can identify this view
b3
.
setText
(
"BUTTON 3"
);
b3
=
new
Button
(
this
);
linearlayout
.
addView
(
b3
);
b3
.
setId
(
R
.
id
.
button3
);
// Add the ID so that accessibility traversal can identify this view
b3
.
setText
(
"BUTTON 3"
);
linearlayout
.
addView
(
b3
);
}
}
}
}
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