mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
add some more logging/tracking.
This commit is contained in:
parent
edf720c58c
commit
7e72cb506d
1 changed files with 45 additions and 18 deletions
|
@ -31,9 +31,11 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
@ -87,25 +89,16 @@ public class LocUtils {
|
||||||
|
|
||||||
public static void xlateView( Context context, View view )
|
public static void xlateView( Context context, View view )
|
||||||
{
|
{
|
||||||
if ( view instanceof ViewGroup ) {
|
DbgUtils.logf( "xlateView() top level" );
|
||||||
ViewGroup asGroup = (ViewGroup)view;
|
HashSet<String> seenClasses = new HashSet<String>();
|
||||||
int count = asGroup.getChildCount();
|
HashSet<String> missedClasses = new HashSet<String>();
|
||||||
for ( int ii = 0; ii < count; ++ii ) {
|
xlateView( context, view, seenClasses, missedClasses );
|
||||||
View child = asGroup.getChildAt( ii );
|
int ii = 0;
|
||||||
xlateView( context, child );
|
for ( Iterator<String> iter = seenClasses.iterator();
|
||||||
}
|
iter.hasNext(); ) {
|
||||||
} else if ( view instanceof Button ) {
|
DbgUtils.logf( "xlateView: seen class[%d]: %s", ii++, iter.next() );
|
||||||
Button button = (Button)view;
|
|
||||||
String str = button.getText().toString();
|
|
||||||
str = xlateString( context, str );
|
|
||||||
button.setText( str );
|
|
||||||
} else if ( view instanceof TextView ) {
|
|
||||||
TextView tv = (TextView)view;
|
|
||||||
String str = tv.getText().toString();
|
|
||||||
str = xlateString( context, str );
|
|
||||||
tv.setText( str );
|
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
DbgUtils.logf( "xlateView() top level DONE" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void xlateMenu( Activity activity, Menu menu )
|
public static void xlateMenu( Activity activity, Menu menu )
|
||||||
|
@ -270,4 +263,38 @@ public class LocUtils {
|
||||||
}
|
}
|
||||||
return s_enabled;
|
return s_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void xlateView( Context context, View view,
|
||||||
|
HashSet<String> seen,
|
||||||
|
HashSet<String> missed )
|
||||||
|
{
|
||||||
|
String name = view.getClass().getName();
|
||||||
|
seen.add( name );
|
||||||
|
if ( view instanceof ViewGroup ) {
|
||||||
|
DbgUtils.logf( "xlateView recursing on %s", name );
|
||||||
|
ViewGroup asGroup = (ViewGroup)view;
|
||||||
|
int count = asGroup.getChildCount();
|
||||||
|
for ( int ii = 0; ii < count; ++ii ) {
|
||||||
|
View child = asGroup.getChildAt( ii );
|
||||||
|
xlateView( context, child, seen, missed );
|
||||||
|
}
|
||||||
|
} else if ( view instanceof Button ) {
|
||||||
|
Button button = (Button)view;
|
||||||
|
String str = button.getText().toString();
|
||||||
|
str = xlateString( context, str );
|
||||||
|
button.setText( str );
|
||||||
|
} else if ( view instanceof TextView ) {
|
||||||
|
TextView tv = (TextView)view;
|
||||||
|
String str = tv.getText().toString();
|
||||||
|
str = xlateString( context, str );
|
||||||
|
tv.setText( str );
|
||||||
|
} else if ( view instanceof CheckBox ) {
|
||||||
|
CheckBox box = (CheckBox)view;
|
||||||
|
String str = box.getText().toString();
|
||||||
|
str = xlateString( context, str );
|
||||||
|
box.setText( str );
|
||||||
|
} else {
|
||||||
|
missed.add( view.getClass().getName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue