show maintenance mode

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-07-05 09:57:39 +02:00
parent 5cc7b5983a
commit c202518506
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
6 changed files with 30 additions and 27 deletions

View file

@ -289,6 +289,9 @@ public class RefreshFolderOperation extends RemoteOperation {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
removeLocalFolder();
}
if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
return result;
}
if (result.isException()) {
Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " +
result.getLogMessage(), result.getException());

View file

@ -1326,21 +1326,21 @@ public class FileDisplayActivity extends HookActivity
!RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
synchResult != null && !synchResult.isSuccess()) {
synchResult != null) {
/// TODO refactor and make common
if (checkForRemoteOperationError(synchResult)) {
requestCredentialsUpdate(context);
} else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(
synchResult.getCode())) {
showUntrustedCertDialog(synchResult);
if (synchResult.isSuccess()) {
setMaintenanceMode(false);
} else {
// TODO refactor and make common
if (checkForRemoteOperationError(synchResult)) {
requestCredentialsUpdate(context);
} else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(
synchResult.getCode())) {
showUntrustedCertDialog(synchResult);
} else if (ResultCode.MAINTENANCE_MODE.equals(synchResult.getCode())) {
setMaintenanceMode(true);
}
}
}
removeStickyBroadcast(intent);
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));

View file

@ -30,6 +30,7 @@ import android.support.annotation.ColorInt;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
@ -73,8 +74,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);
mInfoBox = findViewById(R.id.info_box);
mInfoBoxMessage = findViewById(R.id.info_box_message);
mPreviewImage = findViewById(R.id.preview_image);
@ -158,7 +159,7 @@ public abstract class ToolbarActivity extends BaseActivity {
* @param active flag is mode should be de-/activated
*/
protected final void setMaintenanceMode(boolean active) {
if(active) {
if (active) {
mInfoBox.setVisibility(View.VISIBLE);
mInfoBoxMessage.setText(R.string.maintenance_mode);
} else {
@ -172,7 +173,7 @@ public abstract class ToolbarActivity extends BaseActivity {
* @param active flag is mode should be de-/activated
*/
protected final void setOfflineMode(boolean active) {
if(active) {
if (active) {
mInfoBox.setVisibility(View.VISIBLE);
mInfoBoxMessage.setText(R.string.offline_mode);
} else {

View file

@ -5,4 +5,4 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#757575" android:pathData="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" />
</vector>
</vector>

View file

@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ic_information_outline_18dp"/>
android:src="@drawable/ic_information_outline"/>
<TextView
android:id="@+id/info_box_message"
@ -50,4 +50,4 @@
android:text="@string/offline_mode"
android:textColor="@color/standard_gray"/>
</RelativeLayout>
</RelativeLayout>

View file

@ -19,13 +19,12 @@
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<RelativeLayout
android:layout_width="match_parent"