|
@@ -30,13 +30,18 @@ import androidx.viewpager2.adapter.FragmentStateAdapter;
|
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
|
|
|
|
|
|
import com.bumptech.glide.Priority;
|
|
import com.bumptech.glide.Priority;
|
|
|
|
|
+import com.dar.nbook.api.HttpCallback;
|
|
|
|
|
+import com.dar.nbook.api.HttpClient;
|
|
|
|
|
+import com.dar.nbook.api.HttpError;
|
|
|
import com.dar.nbook.api.components.GenericGallery;
|
|
import com.dar.nbook.api.components.GenericGallery;
|
|
|
|
|
+import com.dar.nbook.api.response.HasInviteResponse;
|
|
|
import com.dar.nbook.async.database.Queries;
|
|
import com.dar.nbook.async.database.Queries;
|
|
|
import com.dar.nbook.components.activities.GeneralActivity;
|
|
import com.dar.nbook.components.activities.GeneralActivity;
|
|
|
import com.dar.nbook.components.views.ZoomFragment;
|
|
import com.dar.nbook.components.views.ZoomFragment;
|
|
|
import com.dar.nbook.files.GalleryFolder;
|
|
import com.dar.nbook.files.GalleryFolder;
|
|
|
import com.dar.nbook.settings.DefaultDialogs;
|
|
import com.dar.nbook.settings.DefaultDialogs;
|
|
|
import com.dar.nbook.settings.Global;
|
|
import com.dar.nbook.settings.Global;
|
|
|
|
|
+import com.dar.nbook.settings.Login;
|
|
|
import com.dar.nbook.utility.LogUtility;
|
|
import com.dar.nbook.utility.LogUtility;
|
|
|
import com.dar.nbook.utility.Utility;
|
|
import com.dar.nbook.utility.Utility;
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|
@@ -139,14 +144,20 @@ public class ZoomActivity extends GeneralActivity {
|
|
|
pageCounter++;
|
|
pageCounter++;
|
|
|
if (pageCounter >= pageThreshold) {
|
|
if (pageCounter >= pageThreshold) {
|
|
|
pageCounter = 0;
|
|
pageCounter = 0;
|
|
|
- MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ZoomActivity.this);
|
|
|
|
|
- builder.setTitle(R.string.share_to_your_friends);
|
|
|
|
|
- builder.setMessage(R.string.share_to_your_friends_message);
|
|
|
|
|
- builder.setPositiveButton(R.string.ok, (dialog, which) -> {
|
|
|
|
|
- Global.invite(ZoomActivity.this);
|
|
|
|
|
|
|
+ HttpClient.request(HttpClient.getApiService().hasInvite(Login.getNUser().getId()), new HttpCallback<HasInviteResponse>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onSuccess(HasInviteResponse data) {
|
|
|
|
|
+ if (!data.isHasInvite()) {
|
|
|
|
|
+ showInviteDialog();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onFailure(HttpError<HasInviteResponse> error) {
|
|
|
|
|
+ showInviteDialog();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
- builder.setCancelable(false);
|
|
|
|
|
- builder.show();
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -188,6 +199,17 @@ public class ZoomActivity extends GeneralActivity {
|
|
|
seekBar.setProgress(page);
|
|
seekBar.setProgress(page);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void showInviteDialog() {
|
|
|
|
|
+ MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ZoomActivity.this);
|
|
|
|
|
+ builder.setTitle(R.string.share_to_your_friends);
|
|
|
|
|
+ builder.setMessage(R.string.share_to_your_friends_message);
|
|
|
|
|
+ builder.setPositiveButton(R.string.ok, (dialog, which) -> {
|
|
|
|
|
+ Global.invite(ZoomActivity.this);
|
|
|
|
|
+ });
|
|
|
|
|
+ builder.setCancelable(false);
|
|
|
|
|
+ builder.show();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void setUserInput(boolean enabled) {
|
|
private void setUserInput(boolean enabled) {
|
|
|
mViewPager.setUserInputEnabled(enabled);
|
|
mViewPager.setUserInputEnabled(enabled);
|
|
|
}
|
|
}
|