diff --git a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java index 894a9599f9..10580caa8a 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java @@ -32,6 +32,8 @@ import android.support.v7.app.ActionBar; import android.support.v7.widget.Toolbar; import android.widget.ImageView; import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.widget.TextView; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -44,6 +46,8 @@ import com.owncloud.android.utils.ThemeUtils; public abstract class ToolbarActivity extends BaseActivity { private ProgressBar mProgressBar; private ImageView mPreviewImage; + private RelativeLayout mInfoBox; + private TextView mInfoBoxMessage; @Override protected void onCreate(Bundle savedInstanceState) { @@ -69,6 +73,8 @@ public abstract class ToolbarActivity extends BaseActivity { ThemeUtils.colorToolbarProgressBar(this, ThemeUtils.primaryColor(this, false)); } + mInfoBox = (RelativeLayout) findViewById(R.id.info_box); + mInfoBoxMessage = (TextView) findViewById(R.id.info_box_message); mPreviewImage = findViewById(R.id.preview_image); @@ -146,6 +152,34 @@ public abstract class ToolbarActivity extends BaseActivity { return file == null || (file.isFolder() && file.getParentId() == FileDataStorageManager.ROOT_PARENT_ID); } + /** + * de-/activates the maintenance message within the toolbar. + * + * @param active flag is mode should be de-/activated + */ + protected final void setMaintenanceMode(boolean active) { + if(active) { + mInfoBox.setVisibility(View.VISIBLE); + mInfoBoxMessage.setText(R.string.maintenance_mode); + } else { + mInfoBox.setVisibility(View.GONE); + } + } + + /** + * de-/activates the offline message within the toolbar. + * + * @param active flag is mode should be de-/activated + */ + protected final void setOfflineMode(boolean active) { + if(active) { + mInfoBox.setVisibility(View.VISIBLE); + mInfoBoxMessage.setText(R.string.offline_mode); + } else { + mInfoBox.setVisibility(View.GONE); + } + } + /** * Change the indeterminate mode for the toolbar's progress bar. * diff --git a/src/main/res/drawable/ic_information_outline_18dp.xml b/src/main/res/drawable/ic_information_outline_18dp.xml new file mode 100644 index 0000000000..6d30d7af33 --- /dev/null +++ b/src/main/res/drawable/ic_information_outline_18dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/src/main/res/layout/info_box.xml b/src/main/res/layout/info_box.xml new file mode 100644 index 0000000000..7adcd47e66 --- /dev/null +++ b/src/main/res/layout/info_box.xml @@ -0,0 +1,53 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/res/layout/toolbar_standard.xml b/src/main/res/layout/toolbar_standard.xml index 6b18fb92ee..a51e4a6543 100644 --- a/src/main/res/layout/toolbar_standard.xml +++ b/src/main/res/layout/toolbar_standard.xml @@ -19,7 +19,8 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> - + + diff --git a/src/main/res/layout/toolbar_user_information.xml b/src/main/res/layout/toolbar_user_information.xml index cd036d2f74..177e48e072 100644 --- a/src/main/res/layout/toolbar_user_information.xml +++ b/src/main/res/layout/toolbar_user_information.xml @@ -115,7 +115,9 @@ - + + + - \ No newline at end of file + diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml index 23143f058f..bc768e7cf0 100644 --- a/src/main/res/values/colors.xml +++ b/src/main/res/values/colors.xml @@ -32,6 +32,7 @@ #00000000 #a0a0a0 #e53935 + #757575 #757575 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 9d850c1607..d450fb514a 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -537,6 +537,7 @@ Do you really want to delete the selected items? Do you really want to delete the selected items and their contents? Server in maintenance mode + No internet connection Awaiting charge Search