Skip to content

Commit

Permalink
Support for local file browsing added.
Browse files Browse the repository at this point in the history
  • Loading branch information
rb28z2 committed Feb 16, 2016
1 parent 005bcc3 commit 03dcbb3
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionName "1.1"
}
buildTypes {
release {
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

<activity
android:name="ca.currybox.yaya.main"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation|screenSize">
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down Expand Up @@ -133,5 +133,13 @@
android:value=".main" />
</activity>

<activity android:name=".FileExplore">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


</application>
</manifest>
33 changes: 32 additions & 1 deletion app/src/main/java/ca/currybox/yaya/NavigationDrawerFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@


import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;


/**
Expand All @@ -21,6 +25,10 @@ public class NavigationDrawerFragment extends android.support.v4.app.Fragment {
private DrawerLayout mDrawerLayout;

private View containerView;
private ListView mDrawerList;
private ArrayAdapter<String> mAdapter;



public NavigationDrawerFragment() {
// Required empty public constructor
Expand All @@ -36,9 +44,32 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
View view = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
mDrawerList = (ListView) view.findViewById(R.id.navList);
addDrawerItems();
return view;
}

private void addDrawerItems() {
String[] items = {"File chooser", "Settings"};
mAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, items);
mDrawerList.setAdapter(mAdapter);

mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int ID = ((int) id);
switch (ID) {
case 0:
Intent fileExplorer = new Intent(getActivity(), FileExplore.class);
startActivity(fileExplorer);
}
}
});
}




public void setUp(int fragmentId, DrawerLayout drawerLayout, final Toolbar toolbar, boolean firstLaunch) {
containerView = getActivity().findViewById(fragmentId);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/ca/currybox/yaya/animeListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ public void onRefresh() {
String url = "http://myanimelist.net/malappinfo.php?u=" + username + "&status=all&type=anime"; //creates a valid url


task.execute(new String[]{url}); //get data asynchronously
task.execute(url); //get data asynchronously


}
});


return view;
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/ca/currybox/yaya/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ protected void onCreate(Bundle savedInstanceState) {
playMatch play = new playMatch();
play.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.body, play).commit();
Log.i("file to play", i.getDataString());
} else {
Log.i("mainview", "returning here");
getSupportFragmentManager().beginTransaction().replace(R.id.body, new mainFragment()).commit();
}
Log.i("INTENT", i.getAction());



}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_navigation_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
tools:context="ca.currybox.yaya.NavigationDrawerFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
<ListView
android:id="@+id/navList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
android:layout_height="match_parent" />

</RelativeLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="drawer_open">Open</string>
<string name="drawer_close">Close</string>
<string name="hello">Hello World, FileExplore!</string>


</resources>

0 comments on commit 03dcbb3

Please sign in to comment.