mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
use view instead of dialog about no setup account
This commit is contained in:
parent
b735fc9458
commit
63f68f1020
4 changed files with 55 additions and 18 deletions
|
@ -20,7 +20,8 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/owncloud_white"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/file_list_view">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/fileList"
|
||||
|
|
33
res/layout/no_account_available.xml
Normal file
33
res/layout/no_account_available.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" android:gravity="center_vertical|center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical" android:gravity="center_vertical|center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_wrn_accsetup"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/setup_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/main_tit_accsetup" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -12,7 +12,7 @@
|
|||
<string name="main_calendar">Calendar</string>
|
||||
<string name="main_bookmarks">Bookmarks</string>
|
||||
<string name="main_settings">Settings</string>
|
||||
<string name="main_tit_accsetup">Account Setup</string>
|
||||
<string name="main_tit_accsetup">Setup Account</string>
|
||||
<string name="main_wrn_accsetup">There are no ownCloud accounts on your device. In order to use this App, you need to create one.</string>
|
||||
|
||||
<string name="actionbar_sync">Sync account</string>
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.util.Log;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -73,7 +74,7 @@ import eu.alefzero.webdav.WebdavClient;
|
|||
*/
|
||||
|
||||
public class FileDisplayActivity extends SherlockFragmentActivity implements
|
||||
OnNavigationListener, OnClickListener {
|
||||
OnNavigationListener, OnClickListener, android.view.View.OnClickListener {
|
||||
private ArrayAdapter<String> mDirectories;
|
||||
private DataStorageManager mStorageManager;
|
||||
private FileListFragment mFileList;
|
||||
|
@ -93,19 +94,12 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!accountsAreSetup()) {
|
||||
showDialog(DIALOG_SETUP_ACCOUNT);
|
||||
return;
|
||||
}
|
||||
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
|
||||
if(savedInstanceState != null){
|
||||
mCurrentDir = (OCFile) savedInstanceState.getParcelable(KEY_CURRENT_DIR);
|
||||
}
|
||||
|
||||
setContentView(R.layout.files);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -209,7 +203,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mDirectories.getCount() == 1) {
|
||||
if (mDirectories == null || mDirectories.getCount() == 1) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
@ -226,10 +220,6 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
// Check, if there are ownCloud accounts
|
||||
if (!accountsAreSetup()) {
|
||||
showDialog(DIALOG_SETUP_ACCOUNT);
|
||||
}
|
||||
mDirs = savedInstanceState.getStringArray(KEY_DIR_ARRAY);
|
||||
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
|
||||
mDirectories.add("/");
|
||||
|
@ -241,7 +231,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if(mDirectories != null){
|
||||
if(mDirectories != null && mDirectories.getCount() != 0){
|
||||
mDirs = new String[mDirectories.getCount()-1];
|
||||
for (int j = mDirectories.getCount() - 2, i = 0; j >= 0; --j, ++i) {
|
||||
mDirs[i] = mDirectories.getItem(j);
|
||||
|
@ -257,8 +247,13 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
|
||||
//TODO: Dialog useless -> get rid of this
|
||||
if (!accountsAreSetup()) {
|
||||
showDialog(DIALOG_SETUP_ACCOUNT);
|
||||
setContentView(R.layout.no_account_available);
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
getSupportActionBar().setNavigationMode(ActionBar.DISPLAY_SHOW_TITLE);
|
||||
findViewById(R.id.setup_account).setOnClickListener(this);
|
||||
return;
|
||||
} else if (findViewById(R.id.file_list_view) == null) {
|
||||
setContentView(R.layout.files);
|
||||
}
|
||||
|
||||
// Listen for sync messages
|
||||
|
@ -324,7 +319,6 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
action_bar.setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
// List dir here
|
||||
mFileList.listDirectory(mCurrentDir);
|
||||
}
|
||||
|
@ -558,4 +552,13 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.setup_account) {
|
||||
Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
|
||||
intent.putExtra("authorities", new String[] { AccountAuthenticator.AUTH_TOKEN_TYPE });
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue