Added resource id to ScrollView in file browser. Set it up to scroll to the top of the list automatically on directory navigation instead of showing the previous directory scroll location.

This commit is contained in:
Shaun Thompson 2013-12-22 09:15:10 -07:00
parent 8856b1e5bc
commit f7ad678d3b
2 changed files with 5 additions and 3 deletions

View File

@ -39,6 +39,7 @@
</LinearLayout>
<ScrollView
android:id="@+id/game_scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="6dp"

View File

@ -13,7 +13,6 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
@ -21,7 +20,6 @@ import android.os.Environment;
import android.os.Vibrator;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
@ -30,6 +28,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
public class FileBrowser extends Fragment {
@ -208,7 +207,7 @@ public class FileBrowser extends Fragment {
if (list.get(i)!=null && !list.get(i).isDirectory())
continue;
}
View childview=parentActivity.getLayoutInflater().inflate(R.layout.app_list_item, null, false);
final View childview=parentActivity.getLayoutInflater().inflate(R.layout.app_list_item, null, false);
if (list.get(i)==null){
if(ImgBrowse==true)
@ -244,6 +243,8 @@ public class FileBrowser extends Fragment {
if (f != null && f.isDirectory())
{
navigate(f);
ScrollView sv = (ScrollView)parentActivity.findViewById(R.id.game_scroller);
sv.scrollTo(0,0);
vib.vibrate(50);
}else if(f == null && !ImgBrowse){
vib.vibrate(50);