| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="CompilerConfiguration"> | |||
| <bytecodeTargetLevel target="1.8" /> | |||
| </component> | |||
| </project> | |||
| @@ -15,6 +15,7 @@ | |||
| </set> | |||
| </option> | |||
| <option name="resolveModulePerSourceSet" value="false" /> | |||
| <option name="useQualifiedModuleNames" value="true" /> | |||
| </GradleProjectSettings> | |||
| </option> | |||
| </component> | |||
| @@ -0,0 +1,25 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="RemoteRepositoriesConfiguration"> | |||
| <remote-repository> | |||
| <option name="id" value="central" /> | |||
| <option name="name" value="Maven Central repository" /> | |||
| <option name="url" value="https://repo1.maven.org/maven2" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="jboss.community" /> | |||
| <option name="name" value="JBoss Community repository" /> | |||
| <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="BintrayJCenter" /> | |||
| <option name="name" value="BintrayJCenter" /> | |||
| <option name="url" value="https://jcenter.bintray.com/" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="Google" /> | |||
| <option name="name" value="Google" /> | |||
| <option name="url" value="https://dl.google.com/dl/android/maven2/" /> | |||
| </remote-repository> | |||
| </component> | |||
| </project> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |||
| <output url="file://$PROJECT_DIR$/build/classes" /> | |||
| </component> | |||
| <component name="ProjectType"> | |||
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="VcsDirectoryMappings"> | |||
| <mapping directory="" vcs="Git" /> | |||
| </component> | |||
| </project> | |||
| @@ -11,8 +11,8 @@ android { | |||
| applicationId "com.yzx.webebook" | |||
| minSdkVersion 26 | |||
| targetSdkVersion 29 | |||
| versionCode 1 | |||
| versionName "1.0" | |||
| versionCode 2 | |||
| versionName "2.0" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| } | |||
| signingConfigs { | |||
| @@ -9,34 +9,39 @@ | |||
| <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |||
| <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_STORAGE"/> | |||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |||
| <uses-permission android:name="android.permission.READ_MEDIA_STORAGE" /> | |||
| <uses-permission android:name="android.permission.WAKE_LOCK" /> | |||
| <application | |||
| android:name=".App" | |||
| android:allowBackup="true" | |||
| android:icon="@mipmap/ic_launcher" | |||
| android:label="@string/app_name" | |||
| android:roundIcon="@mipmap/ic_launcher_round" | |||
| android:supportsRtl="true" | |||
| android:name=".App" | |||
| android:theme="@style/AppTheme"> | |||
| <activity android:name=".MainActivity" | |||
| android:screenOrientation="portrait" | |||
| <activity | |||
| android:name=".activity.WebActivity" | |||
| android:configChanges="orientation|keyboard" | |||
| android:launchMode="singleTask" | |||
| android:configChanges="orientation|keyboard"> | |||
| android:screenOrientation="portrait"> | |||
| <intent-filter> | |||
| <action android:name="android.intent.action.MAIN" /> | |||
| <category android:name="android.intent.category.LAUNCHER" /> | |||
| </intent-filter> | |||
| </activity> | |||
| <activity android:name=".activity.WebActivity" | |||
| android:screenOrientation="portrait" | |||
| android:configChanges="orientation|keyboard"/> | |||
| <activity android:name=".activity.BookActivity" | |||
| android:screenOrientation="portrait" | |||
| android:configChanges="orientation|keyboard"/> | |||
| <activity | |||
| android:name=".MainActivity" | |||
| android:configChanges="orientation|keyboard" | |||
| android:launchMode="singleTask" | |||
| android:screenOrientation="portrait" /> | |||
| <activity | |||
| android:name=".activity.BookActivity" | |||
| android:configChanges="orientation|keyboard" | |||
| android:screenOrientation="portrait" /> | |||
| <provider | |||
| android:name=".utils.YzxFileProvider" | |||
| android:authorities="${applicationId}.fileProvider" | |||
| @@ -94,7 +94,7 @@ public class BookActivity extends Activity { | |||
| private TextView mIndexTv; | |||
| private Button mDeleteBtn; | |||
| private Button mPicBtn; | |||
| private Button mClearBtn; | |||
| private View mClearBtn; | |||
| private Button mUndoBtn; | |||
| private Button mRedoBtn; | |||
| private Button mPenWidthBtn; | |||
| @@ -103,6 +103,8 @@ public class BookActivity extends Activity { | |||
| private Button mCancelBtn; | |||
| private CheckBox mCBEraser; | |||
| private CheckBox mCBStrokes; | |||
| private TextView mPenBtn; | |||
| private TextView mRubberBtn; | |||
| private static int mScreenH; | |||
| private static int mScreenW; | |||
| @@ -234,7 +236,8 @@ public class BookActivity extends Activity { | |||
| } | |||
| }); | |||
| mClearBtn = (Button) findViewById(R.id.clear); | |||
| // mClearBtn = findViewById(R.id.clear); | |||
| mClearBtn = findViewById(R.id.new_clear); | |||
| mClearBtn.setOnClickListener(new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View view) { | |||
| @@ -377,12 +380,36 @@ public class BookActivity extends Activity { | |||
| filter.addAction(SCREEN_OFF); | |||
| mContext.registerReceiver(mReceiver, filter); | |||
| mPenBtn = findViewById(R.id.pen); | |||
| mPenBtn.setOnClickListener(new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| if(mView.isEraserEnable()){ | |||
| mView.setEraserEnable(false); | |||
| mPenBtn.setCompoundDrawablesWithIntrinsicBounds(0,R.mipmap.ic_book_pen_select,0,0); | |||
| mRubberBtn.setCompoundDrawablesWithIntrinsicBounds(0,R.mipmap.ic_book_rubber,0,0); | |||
| } | |||
| } | |||
| }); | |||
| mRubberBtn = findViewById(R.id.new_eraser); | |||
| mRubberBtn.setOnClickListener(new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View v) { | |||
| if(!mView.isEraserEnable()){ | |||
| mView.setEraserEnable(true); | |||
| mPenBtn.setCompoundDrawablesWithIntrinsicBounds(0,R.mipmap.ic_book_pen,0,0); | |||
| mRubberBtn.setCompoundDrawablesWithIntrinsicBounds(0,R.mipmap.ic_book_rubber_select,0,0); | |||
| } | |||
| } | |||
| }); | |||
| initTabBar(); | |||
| } | |||
| private void initNoteView() { | |||
| //宽度 | |||
| mView.setPenWidth(5); | |||
| mView.setPenWidth(3); | |||
| mPenWidthBtn.setText("+宽度5"); | |||
| mPenWidthSubBtn.setText("-宽度5"); | |||
| //橡皮擦 | |||
| @@ -439,11 +466,11 @@ public class BookActivity extends Activity { | |||
| } | |||
| }); | |||
| if (mType == 2) { | |||
| mPicBtn.setVisibility(View.VISIBLE); | |||
| } else { | |||
| mPicBtn.setVisibility(View.GONE); | |||
| } | |||
| // if (mType == 2) { | |||
| // mPicBtn.setVisibility(View.VISIBLE); | |||
| // } else { | |||
| // mPicBtn.setVisibility(View.GONE); | |||
| // } | |||
| } | |||
| @@ -13,6 +13,7 @@ import android.view.ViewGroup | |||
| import android.webkit.* | |||
| import android.widget.LinearLayout | |||
| import androidx.annotation.RequiresApi | |||
| import com.yzx.webebook.MainActivity | |||
| import com.yzx.webebook.R | |||
| import com.yzx.webebook.activity.base.BaseActivity | |||
| import com.yzx.webebook.presenter.base.BasePresenter | |||
| @@ -42,13 +43,29 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||
| private val webView: WebView by lazy { WebView(this) } | |||
| private var url: String = "" | |||
| private var count = 0 | |||
| private val run = Runnable { | |||
| count = 0 | |||
| } | |||
| override val inflateId: Int | |||
| get() = R.layout.activity_web | |||
| override fun onNewIntent(intent: Intent?) { | |||
| super.onNewIntent(intent) | |||
| url = intent?.getStringExtra("link") ?: "https://m.qbjjyyun.net/" | |||
| this.initData() | |||
| } | |||
| @SuppressLint("SetJavaScriptEnabled") | |||
| override fun initView() { | |||
| url = intent?.getStringExtra("link") ?: "https://m.ykj.qbjjyyun.net/" | |||
| url = intent?.getStringExtra("link") ?: "https://m.qbjjyyun.net/" | |||
| titleTv.setOnClickListener { | |||
| count++ | |||
| titleTv.removeCallbacks(run) | |||
| titleTv.postDelayed(run, 1000) | |||
| if (count >= 5) { | |||
| startActivity<MainActivity>() | |||
| } | |||
| } | |||
| btnBack.setOnClickListener { onBackPressed() } | |||
| btnClose.setOnClickListener { | |||
| finish() | |||
| @@ -119,11 +136,11 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||
| view?.post { | |||
| progressbar.visibility = View.GONE | |||
| if (view.canGoBack()) { | |||
| btnClose.visibility = View.VISIBLE | |||
| //btnBack.visibility = View.VISIBLE | |||
| //btnClose.visibility = View.VISIBLE | |||
| btnBack.visibility = View.VISIBLE | |||
| } else { | |||
| btnClose.visibility = View.GONE | |||
| //btnBack.visibility = View.GONE | |||
| //btnClose.visibility = View.GONE | |||
| btnBack.visibility = View.GONE | |||
| } | |||
| } | |||
| } else { | |||
| @@ -210,8 +227,8 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||
| obj.put("key", mKey) | |||
| obj.put("identity", mIdentity) | |||
| obj.put("name", data?.getStringExtra("name") ?: "") | |||
| obj.put("index", data?.getIntExtra("index",0)) | |||
| obj.put("type", data?.getIntExtra("type",1)) | |||
| obj.put("index", data?.getIntExtra("index", 0)) | |||
| obj.put("type", data?.getIntExtra("type", 1)) | |||
| evaluateJavascript("onImageUploadSuccess", obj.toString()) | |||
| } | |||
| } | |||
| @@ -239,7 +256,7 @@ class YzxJavascriptInterface(var ctx: Activity) { | |||
| index: Int, | |||
| type: Int | |||
| ) { | |||
| BookActivity.active(ctx, title, key, identity,name,index,type) | |||
| BookActivity.active(ctx, title, key, identity, name, index, type) | |||
| } | |||
| /** | |||
| @@ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <size android:width="1px" /> | |||
| <solid android:color="#000" /> | |||
| </shape> | |||
| @@ -0,0 +1,4 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <solid android:color="#fff"/> | |||
| </shape> | |||
| @@ -51,8 +51,9 @@ | |||
| android:layout_centerVertical="true" | |||
| android:background="@drawable/btn_select" | |||
| android:paddingHorizontal="15dp" | |||
| android:drawableLeft="@mipmap/icon_save_btn" | |||
| android:drawablePadding="5dp" | |||
| android:textSize="@dimen/title_text_size" | |||
| android:textStyle="bold" | |||
| android:text="保存" /> | |||
| <LinearLayout | |||
| @@ -107,6 +108,12 @@ | |||
| android:progress="0" | |||
| android:progressDrawable="@drawable/progress_horizontal" | |||
| android:visibility="visible" /> | |||
| <View | |||
| android:layout_width="match_parent" | |||
| android:layout_height="1px" | |||
| android:layout_alignParentBottom="true" | |||
| android:background="#000"/> | |||
| </RelativeLayout> | |||
| </com.google.android.material.appbar.AppBarLayout> | |||
| @@ -115,8 +122,42 @@ | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_alignParentTop="true" | |||
| android:orientation="horizontal" | |||
| android:paddingTop="4dp"> | |||
| android:divider="@drawable/linearlayout_vertical_divider" | |||
| android:showDividers="middle|end" | |||
| android:orientation="horizontal"> | |||
| <androidx.appcompat.widget.AppCompatTextView | |||
| android:id="@+id/pen" | |||
| android:layout_width="118px" | |||
| android:layout_height="match_parent" | |||
| android:text="笔" | |||
| android:textAlignment="center" | |||
| android:drawableTop="@mipmap/ic_book_pen_select" | |||
| android:drawablePadding="5dp" | |||
| android:textColor="#000" | |||
| android:paddingVertical="10dp"/> | |||
| <androidx.appcompat.widget.AppCompatTextView | |||
| android:id="@+id/new_eraser" | |||
| android:layout_width="118px" | |||
| android:layout_height="match_parent" | |||
| android:text="橡皮" | |||
| android:textAlignment="center" | |||
| android:drawableTop="@mipmap/ic_book_rubber" | |||
| android:drawablePadding="5dp" | |||
| android:textColor="#000" | |||
| android:paddingVertical="10dp"/> | |||
| <androidx.appcompat.widget.AppCompatTextView | |||
| android:id="@+id/new_clear" | |||
| android:layout_width="118px" | |||
| android:layout_height="match_parent" | |||
| android:text="清除" | |||
| android:textAlignment="center" | |||
| android:drawableTop="@mipmap/ic_book_clear" | |||
| android:drawablePadding="5dp" | |||
| android:textColor="#000" | |||
| android:paddingVertical="10dp"/> | |||
| <Button | |||
| android:id="@+id/delete" | |||
| @@ -133,6 +174,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="背景0" /> | |||
| <Button | |||
| @@ -141,7 +183,8 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:text="清除" /> | |||
| android:text="清除" | |||
| android:visibility="gone"/> | |||
| <Button | |||
| android:id="@+id/redo" | |||
| @@ -149,6 +192,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="ReDo" /> | |||
| <Button | |||
| @@ -157,6 +201,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="UnDo" /> | |||
| <Button | |||
| android:id="@+id/pen_width_sub" | |||
| @@ -164,6 +209,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="-宽度3" /> | |||
| <Button | |||
| android:id="@+id/pen_width" | |||
| @@ -171,6 +217,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="+宽度3" /> | |||
| <Button | |||
| @@ -179,6 +226,7 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:visibility="gone" | |||
| android:text="橡皮宽15" /> | |||
| <CheckBox | |||
| @@ -186,6 +234,7 @@ | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:visibility="gone" | |||
| android:background="@drawable/btn_select" | |||
| android:text="笔锋" /> | |||
| @@ -195,7 +244,8 @@ | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/btn_select" | |||
| android:text="橡皮擦" /> | |||
| android:text="橡皮擦" | |||
| android:visibility="gone"/> | |||
| <Button | |||
| android:id="@+id/cancel" | |||
| @@ -62,7 +62,7 @@ | |||
| android:layout_marginTop="@dimen/d_20" | |||
| android:hint="输入网址" | |||
| android:paddingHorizontal="15dp" | |||
| android:text="http://192.168.69.200:8098/"/> | |||
| android:text="http://192.168.69.113:8098/"/> | |||
| <androidx.appcompat.widget.AppCompatButton | |||
| android:id="@+id/btn3" | |||
| @@ -21,7 +21,7 @@ | |||
| android:layout_height="@dimen/title_height" | |||
| android:scaleType="centerInside" | |||
| android:src="@mipmap/ic_back_def" | |||
| android:visibility="visible"/> | |||
| android:visibility="gone"/> | |||
| <ImageView | |||
| android:id="@+id/btnClose" | |||
| @@ -30,7 +30,7 @@ | |||
| android:layout_toEndOf="@+id/btnBack" | |||
| android:scaleType="centerInside" | |||
| android:src="@mipmap/ic_close" | |||
| android:visibility="gone" /> | |||
| android:visibility="visible" /> | |||
| <ImageView | |||
| android:id="@+id/btnRefresh" | |||
| @@ -59,12 +59,18 @@ | |||
| android:id="@+id/progressbar" | |||
| style="?android:attr/progressBarStyleHorizontal" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="2dp" | |||
| android:layout_height="1dp" | |||
| android:layout_alignParentBottom="true" | |||
| android:max="100" | |||
| android:progress="0" | |||
| android:progressDrawable="@drawable/progress_horizontal" | |||
| android:visibility="visible" /> | |||
| <View | |||
| android:layout_width="match_parent" | |||
| android:layout_height="1px" | |||
| android:layout_alignParentBottom="true" | |||
| android:background="#000"/> | |||
| </RelativeLayout> | |||
| </com.google.android.material.appbar.AppBarLayout> | |||