mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
fragments branch initial commit
This commit is contained in:
parent
a038e0c55b
commit
17455f57d2
12 changed files with 328 additions and 77 deletions
|
@ -21,11 +21,11 @@
|
||||||
android:name="android.permission.READ_SYNC_SETTINGS" />
|
android:name="android.permission.READ_SYNC_SETTINGS" />
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.WRITE_SYNC_SETTINGS" />
|
android:name="android.permission.WRITE_SYNC_SETTINGS" />
|
||||||
<uses-sdk android:minSdkVersion="7"></uses-sdk>
|
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="10" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
|
||||||
|
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
<activity android:name=".OwnCloudMainScreen"
|
<activity android:name=".MainScreen"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -70,5 +70,6 @@
|
||||||
<activity android:name=".authenticator.AuthenticatorActivity"></activity>
|
<activity android:name=".authenticator.AuthenticatorActivity"></activity>
|
||||||
<service android:name="FileDownloader">
|
<service android:name="FileDownloader">
|
||||||
</service>
|
</service>
|
||||||
|
<activity android:name="FileDetailActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
26
res/layout-port/main.xml
Normal file
26
res/layout-port/main.xml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:background="#F7F7F7"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/actionBar"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
class="eu.alefzero.owncloud.ui.ActionBar">
|
||||||
|
<!-- Preview: layout=@layout/action_bar -->
|
||||||
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/fileList"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
class="eu.alefzero.owncloud.FileList" >
|
||||||
|
|
||||||
|
<!-- Preview: layout=@layout/list_layout -->
|
||||||
|
</fragment>
|
||||||
|
<!-- </LinearLayout> -->
|
||||||
|
|
||||||
|
</LinearLayout>
|
39
res/layout/action_bar.xml
Normal file
39
res/layout/action_bar.xml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#F7F7F7"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout1"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout7"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:background="@drawable/main_header_bg"
|
||||||
|
android:gravity="top"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/main_header_small"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|left"
|
||||||
|
android:src="@drawable/icon" >
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
<eu.alefzero.owncloud.PathLayout
|
||||||
|
android:id="@+id/pathLayout1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical" >
|
||||||
|
</eu.alefzero.owncloud.PathLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
13
res/layout/file_activity_details.xml
Normal file
13
res/layout/file_activity_details.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/fileDetail"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
class="eu.alefzero.owncloud.FileDetail" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -2,9 +2,6 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
android:orientation="vertical" android:background="#F7F7F7">
|
android:orientation="vertical" android:background="#F7F7F7">
|
||||||
<LinearLayout android:id="@+id/linearLayout7" android:paddingBottom="2pt" android:gravity="center_vertical|top" android:layout_gravity="top" android:layout_height="wrap_content" android:paddingTop="2pt" android:orientation="vertical" android:layout_width="fill_parent" android:background="#1D2D44">
|
|
||||||
<ImageView android:id="@+id/main_header_small" android:src="@drawable/owncloud_logo_small_white" android:layout_gravity="center|center_vertical|center_horizontal" android:layout_height="wrap_content" android:layout_width="wrap_content" android:focusable="true"></ImageView>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout android:layout_width="fill_parent"
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
android:id="@+id/linearLayout1" android:layout_height="wrap_content">
|
android:id="@+id/linearLayout1" android:layout_height="wrap_content">
|
||||||
<LinearLayout android:layout_width="wrap_content"
|
<LinearLayout android:layout_width="wrap_content"
|
|
@ -1,20 +1,49 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:background="#F7F7F7"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" android:layout_height="fill_parent">
|
android:layout_height="fill_parent"
|
||||||
<LinearLayout android:layout_width="fill_parent"
|
android:background="#F7F7F7"
|
||||||
android:id="@+id/linearLayout7" android:background="@drawable/main_header_bg" android:gravity="top"
|
android:orientation="vertical" >
|
||||||
android:layout_gravity="center_vertical" android:layout_height="wrap_content" android:orientation="horizontal">
|
|
||||||
<ImageView android:layout_height="wrap_content"
|
<LinearLayout
|
||||||
android:src="@drawable/icon"
|
android:id="@+id/linearLayout1"
|
||||||
android:layout_width="wrap_content" android:layout_gravity="center_vertical|left"
|
android:layout_width="fill_parent"
|
||||||
android:id="@+id/main_header_small"></ImageView>
|
android:layout_height="fill_parent"
|
||||||
<eu.alefzero.owncloud.PathLayout android:id="@+id/pathLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical"></eu.alefzero.owncloud.PathLayout>
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/actionBar"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
class="eu.alefzero.owncloud.ui.ActionBar">
|
||||||
|
<!-- Preview: layout=@layout/action_bar -->
|
||||||
|
</fragment>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout2"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/fileList"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
class="eu.alefzero.owncloud.FileList" >
|
||||||
|
|
||||||
|
<!-- Preview: layout=@layout/list_layout -->
|
||||||
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/fileDetail"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="2"
|
||||||
|
class="eu.alefzero.owncloud.FileDetail" >
|
||||||
|
|
||||||
|
<!-- Preview: layout=@layout/file_details -->
|
||||||
|
</fragment>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<FrameLayout android:layout_height="fill_parent"
|
</LinearLayout>
|
||||||
android:layout_width="fill_parent" android:id="@+id/frameLayout1">
|
|
||||||
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent" android:divider="@drawable/uploader_list_separator"
|
|
||||||
android:dividerHeight="1dip" android:fadingEdge="none"></ListView>
|
|
||||||
</FrameLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
38
src/eu/alefzero/owncloud/FileDetail.java
Normal file
38
src/eu/alefzero/owncloud/FileDetail.java
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package eu.alefzero.owncloud;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class FileDetail extends Fragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
Log.e("TEST", "TEST");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View v = inflater.inflate(R.layout.file_details, container, false);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void use(CharSequence text) {
|
||||||
|
Toast.makeText(getActivity(), text, Toast.LENGTH_LONG).show();
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
23
src/eu/alefzero/owncloud/FileDetailActivity.java
Normal file
23
src/eu/alefzero/owncloud/FileDetailActivity.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package eu.alefzero.owncloud;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.view.Window;
|
||||||
|
|
||||||
|
public class FileDetailActivity extends FragmentActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
setContentView(R.layout.file_activity_details);
|
||||||
|
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.add(R.id.fileDetail, new FileDetail());
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +1,9 @@
|
||||||
package eu.alefzero.owncloud;
|
package eu.alefzero.owncloud;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.http.HttpHost;
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.auth.AuthScope;
|
|
||||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
|
||||||
import org.apache.http.client.ClientProtocolException;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.apache.http.impl.auth.BasicScheme;
|
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
|
||||||
import org.apache.http.protocol.BasicHttpContext;
|
|
||||||
|
|
||||||
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
|
||||||
import eu.alefzero.webdav.HttpPropFind;
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.accounts.AuthenticatorException;
|
|
||||||
import android.accounts.OperationCanceledException;
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -34,7 +13,7 @@ import android.net.Uri;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.FrameLayout;
|
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
||||||
|
|
||||||
public class FileDownloader extends Service {
|
public class FileDownloader extends Service {
|
||||||
static final String EXTRA_ACCOUNT = "ACCOUNT";
|
static final String EXTRA_ACCOUNT = "ACCOUNT";
|
||||||
|
@ -78,7 +57,7 @@ public class FileDownloader extends Service {
|
||||||
wdc.allowUnsignedCertificates();
|
wdc.allowUnsignedCertificates();
|
||||||
|
|
||||||
Notification n = new Notification(R.drawable.icon, "Downloading file", System.currentTimeMillis());
|
Notification n = new Notification(R.drawable.icon, "Downloading file", System.currentTimeMillis());
|
||||||
PendingIntent pi = PendingIntent.getActivity(this, 1, new Intent(this, OwnCloudMainScreen.class), 0);
|
PendingIntent pi = PendingIntent.getActivity(this, 1, new Intent(this, MainScreen.class), 0);
|
||||||
n.setLatestEventInfo(this, "A", "B", pi);
|
n.setLatestEventInfo(this, "A", "B", pi);
|
||||||
nm.notify(1, n);
|
nm.notify(1, n);
|
||||||
|
|
||||||
|
@ -92,4 +71,5 @@ public class FileDownloader extends Service {
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
65
src/eu/alefzero/owncloud/FileList.java
Normal file
65
src/eu/alefzero/owncloud/FileList.java
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
package eu.alefzero.owncloud;
|
||||||
|
|
||||||
|
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
||||||
|
import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
|
||||||
|
import android.accounts.Account;
|
||||||
|
import android.accounts.AccountManager;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Service;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v4.app.ListFragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class FileList extends ListFragment {
|
||||||
|
private Cursor mCursor;
|
||||||
|
private Account mAccount;
|
||||||
|
private AccountManager mAccountManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
mAccountManager = (AccountManager)getActivity().getSystemService(Service.ACCOUNT_SERVICE);
|
||||||
|
mAccount = mAccountManager.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[0];
|
||||||
|
populateFileList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
FileDetail fd = (FileDetail) getFragmentManager().findFragmentById(R.id.fileDetail);
|
||||||
|
if (fd != null) {
|
||||||
|
fd.use(((TextView)v.findViewById(R.id.Filename)).getText());
|
||||||
|
} else {
|
||||||
|
Intent i = new Intent(getActivity(), FileDetailActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
super.onListItemClick(l, v, position, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateFileList() {
|
||||||
|
mCursor = getActivity().getContentResolver().query(ProviderTableMeta.CONTENT_URI,
|
||||||
|
null,
|
||||||
|
ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
|
||||||
|
new String[]{mAccount.name},
|
||||||
|
null);
|
||||||
|
|
||||||
|
setListAdapter(new FileListListAdapter(mCursor, getActivity()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,8 @@ import android.graphics.Matrix;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -54,7 +56,7 @@ import android.widget.TextView;
|
||||||
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
||||||
import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
|
import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
|
||||||
|
|
||||||
public class OwnCloudMainScreen extends ListActivity {
|
public class MainScreen extends FragmentActivity {
|
||||||
private DbHandler mDBHandler;
|
private DbHandler mDBHandler;
|
||||||
private Stack<String> mParents;
|
private Stack<String> mParents;
|
||||||
private LinkedList<String> mPath;
|
private LinkedList<String> mPath;
|
||||||
|
@ -64,10 +66,25 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
|
|
||||||
private static final int DIALOG_CHOOSE_ACCOUNT = 0;
|
private static final int DIALOG_CHOOSE_ACCOUNT = 0;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.add(R.id.fileList, new FileList());
|
||||||
|
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
ft.add(R.id.fileDetail, new FileDetail());
|
||||||
|
}
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
|
/*getSupportFragmentManager().beginTransaction().add(arg0, arg1);
|
||||||
|
FileList fl = new FileList();
|
||||||
|
ft.add(R.id.fileList, fl);
|
||||||
|
ft.commit();
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mParents = (Stack<String>)savedInstanceState.getSerializable("parentsStack");
|
mParents = (Stack<String>)savedInstanceState.getSerializable("parentsStack");
|
||||||
|
@ -98,7 +115,7 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
} else {
|
} else {
|
||||||
mAccount = accounts[0];
|
mAccount = accounts[0];
|
||||||
populateFileList();
|
populateFileList();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,12 +146,6 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
mDBHandler.close();
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dialog createChooseAccountDialog() {
|
private Dialog createChooseAccountDialog() {
|
||||||
final AccountManager accMan = AccountManager.get(this);
|
final AccountManager accMan = AccountManager.get(this);
|
||||||
CharSequence[] items = new CharSequence[accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE).length];
|
CharSequence[] items = new CharSequence[accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE).length];
|
||||||
|
@ -155,16 +166,16 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
});
|
});
|
||||||
builder.setOnCancelListener(new OnCancelListener() {
|
builder.setOnCancelListener(new OnCancelListener() {
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
OwnCloudMainScreen.this.finish();
|
MainScreen.this.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public void onBackPressed() {
|
//public void onBackPressed() {
|
||||||
PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
/*PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
||||||
if (mIsDisplayingFile) {
|
if (mIsDisplayingFile) {
|
||||||
mIsDisplayingFile = false;
|
mIsDisplayingFile = false;
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
@ -215,13 +226,13 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
setListAdapter(new FileListListAdapter(mCursor, this));
|
setListAdapter(new FileListListAdapter(mCursor, this));
|
||||||
getListView().invalidate();
|
getListView().invalidate();*/
|
||||||
}
|
//}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
/* protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
super.onListItemClick(l, v, position, id);
|
super.onListItemClick(l, v, position, id);
|
||||||
PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
/*PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
||||||
if (!mCursor.moveToPosition(position)) {
|
if (!mCursor.moveToPosition(position)) {
|
||||||
throw new IndexOutOfBoundsException("Incorrect item selected");
|
throw new IndexOutOfBoundsException("Incorrect item selected");
|
||||||
}
|
}
|
||||||
|
@ -291,10 +302,10 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
} else {
|
} else {
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}*/
|
}*/
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
//}
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void populateFileList() {
|
private void populateFileList() {
|
||||||
if (mParents.empty()) {
|
if (mParents.empty()) {
|
||||||
|
@ -309,18 +320,18 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
|
ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
|
||||||
new String[]{mAccount.name}, null);
|
new String[]{mAccount.name}, null);
|
||||||
if (!mIsDisplayingFile) {
|
if (!mIsDisplayingFile) {
|
||||||
PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
//PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
|
||||||
for (String s : mPath) {
|
//for (String s : mPath) {
|
||||||
pl.push(s);
|
// pl.push(s);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// setListAdapter(new FileListListAdapter(mCursor, this));
|
||||||
setListAdapter(new FileListListAdapter(mCursor, this));
|
// getListView().invalidate();
|
||||||
getListView().invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
/*protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +341,6 @@ public class OwnCloudMainScreen extends ListActivity {
|
||||||
outState.putSerializable("parentsStack", mParents);
|
outState.putSerializable("parentsStack", mParents);
|
||||||
outState.putSerializable("path", mPath);
|
outState.putSerializable("path", mPath);
|
||||||
outState.putBoolean("isDisplayingFile", mIsDisplayingFile);
|
outState.putBoolean("isDisplayingFile", mIsDisplayingFile);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
29
src/eu/alefzero/owncloud/ui/ActionBar.java
Normal file
29
src/eu/alefzero/owncloud/ui/ActionBar.java
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.alefzero.owncloud.ui;
|
||||||
|
|
||||||
|
import eu.alefzero.owncloud.R;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
public class ActionBar extends Fragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View v = inflater.inflate(R.layout.action_bar, container, false);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue