diff --git a/.idea/misc.xml b/.idea/misc.xml
index 1278d25..c1aa594 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,14 +4,17 @@
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 02da4c5..eaf719f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,10 +1,11 @@
+ package="org.ntlab.acanthus_client" >
-
-
+
+
+
-
-
-
+ android:usesCleartextTraffic="true" >
+
+
+
+
-
-
-
-
+
+
+
animationJsonList = new ArrayList<>();
@@ -74,6 +75,11 @@
return aid;
}
+ public Integer getEditingPageNo() {
+ if (editingPageNo == null) editingPageNo = 0;
+ return editingPageNo;
+ }
+
public Animation getCurrentAnimation() {
return currentAnimation;
}
@@ -127,6 +133,10 @@
editor.commit();
}
+ public void setEditingPageNo(Integer editingPageNo) {
+ this.editingPageNo = editingPageNo;
+ }
+
public void setCurrentAnimation(Animation currentAnimation) {
this.currentAnimation = currentAnimation;
}
@@ -143,6 +153,7 @@
this.animationJsonList.add(animationJson);
}
//-----------------------------------------------------------------
+ //-----------------------------------------------------------------
}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/entities/Animation.java b/app/src/main/java/org/ntlab/acanthus_client/entities/Animation.java
index 60336d4..b0a2b7d 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/entities/Animation.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/entities/Animation.java
@@ -15,21 +15,21 @@
//-----------------------------------------------------------------
// 作品
public class Animation {
- private Integer aid;
- private Integer likes;
- private Integer views;
+ private int aid;
private String name;
private String description;
- private Account owner;
- private Boolean isPublic;
- private String createdDate;
- private String lastUpdate;
+// private Boolean isPublic;
+ private String createdDate = new String();
+ private String lastUpdate = new String();
+ private Integer likes;
+ private Integer views;
private ArrayList hashTag = new ArrayList<>();
- private ArrayList editors = new ArrayList<>();
- private ArrayList invites = new ArrayList<>();
private HashMap pageMap = new HashMap<>();
+// private Account owner;
+// private ArrayList editors = new ArrayList<>();
+// private ArrayList invites = new ArrayList<>();
private ArrayList pages = new ArrayList<>();
- private boolean isDummy;
+// private boolean isDummy;
//-----------------------------------------------------------------
public Animation() {
@@ -38,7 +38,7 @@
public Animation(Integer aid, String name, Account owner) {
this.aid = aid;
this.name = name;
- this.owner = owner;
+// this.owner = owner;
}
//-----------------------------------------------------------------
@@ -63,17 +63,15 @@
return this.description;
}
- public Account getOwner() {
- return this.owner;
- }
+// public Account getOwner() {
+// return this.owner;
+// }
- public Boolean getPublic() {
- return this.isPublic;
- }
+// public Boolean getPublic() {
+// return this.isPublic;
+// }
- public String getCreatedDate() {
- return this.createdDate;
- }
+ public String getCreatedDate() { return this.createdDate; }
public String getLastUpdate() {
return this.lastUpdate;
@@ -83,18 +81,22 @@
return this.hashTag;
}
- public ArrayList getInvites() {
- return this.invites;
- }
-
- public ArrayList getEditors() {
- return this.editors;
- }
+// public ArrayList getInvites() {
+// return this.invites;
+// }
+//
+// public ArrayList getEditors() {
+// return this.editors;
+// }
public HashMap getPageMap() {
return this.pageMap;
}
+ public ArrayList getPages() {
+ return (this.pages);
+ }
+
//-----------------------------------------------------------------
// setter
public void setAid(Integer aid) {
@@ -117,22 +119,22 @@
this.description = description;
}
- public void setPublic(Boolean aPublic) {
- this.isPublic = aPublic;
- }
+// public void setPublic(Boolean aPublic) {
+// this.isPublic = aPublic;
+// }
//-----------------------------------------------------------------
//-----------------------------------------------------------------
// 招待するアカウントの追加
- public void addInviteAccount(Account account){
- this.invites.add(account);
- }
- //-----------------------------------------------------------------
- // 編集者の追加
- public void addEditor(Editor editor){
- this.editors.add(editor);
- }
- //-----------------------------------------------------------------
+// public void addInviteAccount(Account account){
+// this.invites.add(account);
+// }
+// //-----------------------------------------------------------------
+// // 編集者の追加
+// public void addEditor(Editor editor){
+// this.editors.add(editor);
+// }
+// //-----------------------------------------------------------------
// 新規ページの追加
public void addPage(Integer page){
diff --git a/app/src/main/java/org/ntlab/acanthus_client/entities/AnimationJson.java b/app/src/main/java/org/ntlab/acanthus_client/entities/AnimationJson.java
index fe23182..66cea59 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/entities/AnimationJson.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/entities/AnimationJson.java
@@ -22,7 +22,7 @@
public String getAnimationName(){return this.animationName;}
- public Integer getAid() {return this.aid;}
+ public int getAid() {return this.aid;}
//public ArrayList getEditor(){return this.editors;}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/entities/Page.java b/app/src/main/java/org/ntlab/acanthus_client/entities/Page.java
index e5283cd..10340b0 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/entities/Page.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/entities/Page.java
@@ -1,21 +1,18 @@
package org.ntlab.acanthus_client.entities;
+import java.util.ArrayList;
+
//-----------------------------------------------------------------
// ページ情報
public class Page {
- private Layer layers = new Layer();
+ private ArrayList layers = new ArrayList<>();
- //-----------------------------------------------------------------
- // getter
- public Layer getLayers() {
- return layers;
+ public ArrayList getLayers() {
+ return this.layers;
}
- //-----------------------------------------------------------------
- // setter
- public void setLayers(Layer layers) {
+ public void setLayers(ArrayList layers) {
this.layers = layers;
}
- //-----------------------------------------------------------------
-
}
+
diff --git a/app/src/main/java/org/ntlab/acanthus_client/entities/Position.java b/app/src/main/java/org/ntlab/acanthus_client/entities/Position.java
index 7d254be..ca9913d 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/entities/Position.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/entities/Position.java
@@ -3,6 +3,7 @@
//-----------------------------------------------------------------
// ペン座標
public class Position {
+ private int i;
private Float x;
private Float y;
@@ -18,7 +19,8 @@
//-----------------------------------------------------------------
// setter
- public void setPosition(float x, float y) {
+ public void setPosition(int i, float x, float y) {
+ this.i = i;
this.x = x;
this.y = y;
}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/entities/Stroke.java b/app/src/main/java/org/ntlab/acanthus_client/entities/Stroke.java
index a1a7c92..893dbe8 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/entities/Stroke.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/entities/Stroke.java
@@ -5,11 +5,11 @@
//-----------------------------------------------------------------
// 筆跡
public class Stroke {
- private static int strokeNoCount; //strokeNoを数えるためだけ
- private int strokeNo = 0;
- private int pen = 0;
- private int color = 0;
- private int thickness = 0;
+// private static int strokeNoCount; //strokeNoを数えるためだけ
+ private int strokeNo;
+ private int pen;
+ private int color;
+ private int thickness;
private ArrayList positions = new ArrayList<>();
public int getStrokeNo() {
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/SendScreenShotActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/SendScreenShotActivity.java
deleted file mode 100644
index c775d31..0000000
--- a/app/src/main/java/org/ntlab/acanthus_client/views/SendScreenShotActivity.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.ntlab.acanthus_client.views;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.CompressFormat;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-import org.ntlab.acanthus_client.R;
-
-public class SendScreenShotActivity extends Activity implements OnClickListener {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_paint);
- // 全体キャプチャ
- Button captureAll = (Button)findViewById(R.id.capture_all);
- captureAll.setOnClickListener(this);
-
- // アイコン画像のみキャプチャ
- Button captureIcon = (Button)findViewById(R.id.capture_icon);
- captureIcon.setOnClickListener(this);
-
- // キャプチャした画像を添付してメールを送る
- Button sendMail = (Button)findViewById(R.id.send_mail);
- sendMail.setOnClickListener(this);
-
- }
-
- @Override
- public void onClick(View v) {
- // 読み書きするファイル名を指定
- File file = new File(Environment.getExternalStorageDirectory() + "/capture.jpeg");
- // 指定したファイル名が無ければ作成する。
- file.getParentFile().mkdir();
-
- switch(v.getId()) {
- case R.id.capture_all:
- // 全体を撮る
- saveCapture(findViewById(android.R.id.content),file);
- break;
- case R.id.capture_icon:
- // View1を撮る
- saveCapture(findViewById(R.id.icon),file);
- break;
- case R.id.send_mail:
- Intent intent = new Intent();
- intent.setAction(Intent.ACTION_SEND);
- intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"s1871104@s.konan-u.ac.jp"});
- intent.setType("message/rfc822");
- intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
- startActivity(intent);
-
- break;
- }
- }
-
- /**
- * 撮ったキャプチャを保存
- * @param view
- * @param 書き込み先ファイルfile
- */
- public void saveCapture(View view, File file) {
- // キャプチャを撮る
- Bitmap capture = getViewCapture(view);
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(file, false);
- // 画像のフォーマットと画質と出力先を指定して保存
- capture.compress(CompressFormat.JPEG, 100, fos);
- fos.flush();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (fos != null) {
- try {
- fos.close();
- } catch (IOException ie) {
- fos = null;
- }
- }
- }
- }
-
- /**
- * キャプチャを撮る
- * @param 撮りたいview
- * @return 撮ったキャプチャ(Bitmap)
- */
- public Bitmap getViewCapture(View view) {
- view.setDrawingCacheEnabled(true);
-
- // Viewのキャプチャを取得
- Bitmap cache = view.getDrawingCache();
- if(cache == null){
- return null;
- }
- Bitmap screenShot = Bitmap.createBitmap(cache);
- view.setDrawingCacheEnabled(false);
- return screenShot;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/home/HomeViewModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/home/HomeViewModel.java
index f59a968..8cb2ea0 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/home/HomeViewModel.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/home/HomeViewModel.java
@@ -1,5 +1,6 @@
package org.ntlab.acanthus_client.views.main_menu_ui.home;
+import android.util.Log;
import android.widget.EditText;
import org.ntlab.acanthus_client.Acanthus;
@@ -47,7 +48,7 @@
- public void setCurrentAnimation(Integer aid, Acanthus acanthus) throws IOException {
+ public void setCurrentAnimation(int aid, Acanthus acanthus) throws IOException {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/")
@@ -55,23 +56,25 @@
.build();
final GalleryRest galleryRest = retrofit.create(GalleryRest.class);
Call call = galleryRest.getAnimationInformation(aid);
- Response response = call.execute();
- animation = response.body();
- acanthus.setCurrentAnimation(animation);
-// call.enqueue(new Callback() {
-// @Override
-// public void onResponse(Call call, Response response) {
-// if(response.isSuccessful()){
-// animation = response.body();
-// acanthus.setCurrentAnimation(animation);
-// }
-// }
-//
-// @Override
-// public void onFailure(Call call, Throwable t) {
-//
-// }
-// });
+// Response response = call.execute();
+// animation = response.body();
+// acanthus.setCurrentAnimation(animation);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if(response.isSuccessful()){
+ animation = response.body();
+ acanthus.setCurrentAnimation(animation);
+ Log.d(acanthus.getCurrentAnimation().getName(), toString());
+ }
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ Log.d("aa", t.toString());
+
+ }
+ });
}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintActivity.java
index 16f5e75..6126816 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintActivity.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintActivity.java
@@ -7,6 +7,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.widget.Button;
import android.widget.TextView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
@@ -39,6 +40,14 @@
init();
initView();
+ Button button = findViewById(R.id.button_keep);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getApplication(), SendScreenShotActivity.class);
+ startActivity(intent);
+ }
+ });
}
//-----------------------------------------------------------------
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintModelContainer.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintModelContainer.java
index c4d21e3..2ea0c4f 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintModelContainer.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintModelContainer.java
@@ -1,9 +1,11 @@
package org.ntlab.acanthus_client.views.paint;
import org.ntlab.acanthus_client.Acanthus;
+import org.ntlab.acanthus_client.entities.Page;
import org.ntlab.acanthus_client.resources.gallery.PagesRest;
import org.ntlab.acanthus_client.views.paint.models.InvitesConnectionModel;
import org.ntlab.acanthus_client.views.paint.models.PageConnectionModel;
+import org.ntlab.acanthus_client.views.paint.models.PageOperationModel;
import org.ntlab.acanthus_client.views.paint.models.PaintConnectionModel;
//-----------------------------------------------------------------
@@ -12,6 +14,7 @@
private PaintConnectionModel paintConnectionModel;
private InvitesConnectionModel invitesConnectionModel;
private PageConnectionModel pageConnectionModel;
+ private PageOperationModel pageOperationModel;
//-----------------------------------------------------------------
//-----------------------------------------------------------------
@@ -20,6 +23,7 @@
this.paintConnectionModel = new PaintConnectionModel(acanthus);
this.invitesConnectionModel = new InvitesConnectionModel(acanthus);
this.pageConnectionModel = new PageConnectionModel(acanthus);
+ this.pageOperationModel = new PageOperationModel(acanthus);
}
//-----------------------------------------------------------------
@@ -36,5 +40,8 @@
return pageConnectionModel;
}
+ public PageOperationModel getPageOperationModel() {
+ return pageOperationModel;
+ }
//-----------------------------------------------------------------
}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintToolBar.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintToolBar.java
index 6ea82bf..31a5821 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintToolBar.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintToolBar.java
@@ -1,7 +1,6 @@
package org.ntlab.acanthus_client.views.paint;
import android.content.Intent;
-import android.graphics.Paint;
import android.view.MenuItem;
import androidx.annotation.NonNull;
@@ -12,6 +11,7 @@
import org.ntlab.acanthus_client.Acanthus;
import org.ntlab.acanthus_client.R;
import org.ntlab.acanthus_client.views.MainActivity;
+import org.ntlab.acanthus_client.views.paint.page.PageActivity;
//-----------------------------------------------------------------
// 描画シーンの下部のツールバー
@@ -45,6 +45,12 @@
case R.id.navigation_invite:
transitionInviteActivity(appCompatActivity);
return true;
+
+ //-----------------------------------------------------------------
+ case R.id.navigation_page:
+ transitionPageActivity(appCompatActivity);
+ return true;
+
}
return true;
@@ -61,6 +67,15 @@
Intent intent = new Intent(acanthus, MainActivity.class);
appCompatActivity.startActivity(intent);
}
+
+ //-----------------------------------------------------------------
+ // 編集へ移動
+ private void transitionPageActivity(AppCompatActivity appCompatActivity) {
+ Acanthus acanthus = (Acanthus) appCompatActivity.getApplication();
+ Intent intent = new Intent(acanthus, PageActivity.class);
+ appCompatActivity.startActivity(intent);
+ }
+
//-----------------------------------------------------------------
}
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintViewModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintViewModel.java
index 0670a5a..a279ac3 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintViewModel.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/PaintViewModel.java
@@ -1,16 +1,12 @@
package org.ntlab.acanthus_client.views.paint;
-import android.util.Log;
import android.view.MotionEvent;
-import android.view.VelocityTracker;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
-import org.jetbrains.annotations.NotNull;
import org.ntlab.acanthus_client.Acanthus;
-import org.ntlab.acanthus_client.entities.Position;
import org.ntlab.acanthus_client.entities.Stroke;
import java.util.ArrayList;
@@ -25,9 +21,11 @@
private PaintModelContainer paintModelContainer;
+ private MutableLiveData mPageLength = new MutableLiveData<>();
private MutableLiveData mPageNo = new MutableLiveData<>();
private MutableLiveData mStrokeNo = new MutableLiveData<>();
private MutableLiveData> mStrokes = new MutableLiveData<>();
+
private ScheduledThreadPoolExecutor thread = new ScheduledThreadPoolExecutor(1);
//-----------------------------------------------------------------
@@ -40,10 +38,18 @@
return this.mStrokeNo;
}
+ public LiveData getPageLength() {
+ return this.mPageLength;
+ }
+
public LiveData getPageNo() {
return this.mPageNo;
}
+ public PaintModelContainer getPaintModelContainer() {
+ return paintModelContainer;
+ }
+
//-----------------------------------------------------------------
//-----------------------------------------------------------------
// init
@@ -81,9 +87,15 @@
}
//-----------------------------------------------------------------
+ //
+ public void updatePageNo(MotionEvent event) {
+ paintModelContainer.getPageOperationModel().updatePageNo(event, mPageNo);
+ }
+
+ //-----------------------------------------------------------------
// ページの追加通信リクエスト
public void addPageRequest() {
- paintModelContainer.getPageConnectionModel().addPage(mPageNo);
+ paintModelContainer.getPageConnectionModel().addPage(mPageLength);
}
//-----------------------------------------------------------------
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/SendScreenShotActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/SendScreenShotActivity.java
new file mode 100644
index 0000000..732e525
--- /dev/null
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/SendScreenShotActivity.java
@@ -0,0 +1,113 @@
+package org.ntlab.acanthus_client.views.paint;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.View;
+import android.widget.Button;
+
+import org.ntlab.acanthus_client.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class SendScreenShotActivity extends Activity implements View.OnClickListener {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_send_screen_shot);
+ // 全体キャプチャ
+ Button captureAll = (Button)findViewById(R.id.capture_all);
+ captureAll.setOnClickListener(this);
+
+ // アイコン画像のみキャプチャ
+ Button captureIcon = (Button)findViewById(R.id.capture_icon);
+ captureIcon.setOnClickListener(this);
+
+ // キャプチャした画像を添付してメールを送る
+ Button sendMail = (Button)findViewById(R.id.send_mail);
+ sendMail.setOnClickListener(this);
+
+ }
+
+ @Override
+ public void onClick(View v) {
+ // 読み書きするファイル名を指定
+ File file = new File(Environment.getExternalStorageDirectory() + "/capture.jpeg");
+ // 指定したファイル名が無ければ作成する。
+ file.getParentFile().mkdir();
+
+ switch(v.getId()) {
+ case R.id.capture_all:
+ // 全体を撮る
+ saveCapture(findViewById(android.R.id.content),file);
+ break;
+ case R.id.capture_icon:
+ // View1を撮る
+ saveCapture(findViewById(R.id.icon),file);
+ break;
+ case R.id.send_mail:
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_SEND);
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"s1871104@s.konan-u.ac.jp"});
+ intent.setType("message/rfc822");
+ intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
+ startActivity(intent);
+
+ break;
+ }
+ }
+
+ /**
+ * 撮ったキャプチャを保存
+ * @param view
+ * @param 書き込み先ファイルfile
+ */
+ public void saveCapture(View view, File file) {
+ // キャプチャを撮る
+ Bitmap capture = getViewCapture(view);
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file, false);
+ // 画像のフォーマットと画質と出力先を指定して保存
+ capture.compress(Bitmap.CompressFormat.JPEG, 100, fos);
+ fos.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException ie) {
+ fos = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * キャプチャを撮る
+ * @param 撮りたいview
+ * @return 撮ったキャプチャ(Bitmap)
+ */
+ public Bitmap getViewCapture(View view) {
+ view.setDrawingCacheEnabled(true);
+
+ // Viewのキャプチャを取得
+ Bitmap cache = view.getDrawingCache();
+ if(cache == null){
+ return null;
+ }
+ Bitmap screenShot = Bitmap.createBitmap(cache);
+ view.setDrawingCacheEnabled(false);
+ return screenShot;
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/paint/models/PageOperationModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/paint/models/PageOperationModel.java
index 61d23a6..7f2940d 100644
--- a/app/src/main/java/org/ntlab/acanthus_client/views/paint/models/PageOperationModel.java
+++ b/app/src/main/java/org/ntlab/acanthus_client/views/paint/models/PageOperationModel.java
@@ -1,4 +1,77 @@
package org.ntlab.acanthus_client.views.paint.models;
+import android.preference.SwitchPreference;
+import android.view.MotionEvent;
+import android.view.VelocityTracker;
+
+import androidx.lifecycle.MutableLiveData;
+
+import org.ntlab.acanthus_client.Acanthus;
+
+//-----------------------------------------------------------------
+//
+
public class PageOperationModel {
+ //-----------------------------------------------------------------
+ // スワイプの向き
+ public enum SwipeDirectionType {
+ LEFT, RIGHT
+ }
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ private Acanthus acanthus;
+ private VelocityTracker velocityTracker;
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ public PageOperationModel(Acanthus acanthus) {
+ this.acanthus = acanthus;
+ }
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ public void updatePageNo(MotionEvent event, MutableLiveData mPageNo) {
+ if (getVelocityDirection(event).equals(SwipeDirectionType.RIGHT)) incrementPageNo(mPageNo);
+ if (getVelocityDirection(event).equals(SwipeDirectionType.LEFT)) decrementPageNo(mPageNo);
+ }
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //
+ public void incrementPageNo(MutableLiveData mPageNo) {
+// if(acanthus.getEditingPageNo())
+ Integer editingNo = acanthus.getEditingPageNo();
+
+ acanthus.setEditingPageNo(editingNo + 1);
+ mPageNo.setValue(acanthus.getEditingPageNo());
+ }
+
+ //-----------------------------------------------------------------s
+ //
+ private void decrementPageNo(MutableLiveData mPageNo) {
+ Integer editingNo = acanthus.getEditingPageNo();
+ if (0 < editingNo ) {
+ acanthus.setEditingPageNo(acanthus.getEditingPageNo() - 1);
+ mPageNo.setValue(acanthus.getEditingPageNo());
+ }
+ }
+
+
+ //-----------------------------------------------------------------
+ // 操作からスワイプの向きを取得する
+ private SwipeDirectionType getVelocityDirection(MotionEvent event) {
+ if (velocityTracker == null) velocityTracker = VelocityTracker.obtain();
+ else velocityTracker.clear();
+
+ velocityTracker.addMovement(event);
+ velocityTracker.computeCurrentVelocity(1000);
+
+ if (velocityTracker.getXVelocity() < 0) return SwipeDirectionType.LEFT;
+ else return SwipeDirectionType.RIGHT;
+ }
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+
}
diff --git a/app/src/main/res/layout/activity_page.xml b/app/src/main/res/layout/activity_page.xml
new file mode 100644
index 0000000..ea819b4
--- /dev/null
+++ b/app/src/main/res/layout/activity_page.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_paint.xml b/app/src/main/res/layout/activity_paint.xml
index e7ac474..9fb5a4c 100644
--- a/app/src/main/res/layout/activity_paint.xml
+++ b/app/src/main/res/layout/activity_paint.xml
@@ -104,70 +104,4 @@
app:layout_constraintVertical_bias="1.0" />
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_send_screen_shot.xml b/app/src/main/res/layout/activity_send_screen_shot.xml
new file mode 100644
index 0000000..5bef23e
--- /dev/null
+++ b/app/src/main/res/layout/activity_send_screen_shot.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index ea59ed3..ad1915f 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -5,4 +5,11 @@
+
+
+
\ No newline at end of file