@ -0,0 +1,14 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
@ -0,0 +1 @@
|
|||||||
|
NetCloudSharing
|
@ -0,0 +1,134 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="PLATFORM" />
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?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">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
/build
|
@ -0,0 +1,43 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 30
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.example.netcloudsharing"
|
||||||
|
minSdkVersion 25
|
||||||
|
targetSdkVersion 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useLibrary 'org.apache.http.legacy'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||||
|
implementation 'com.android.support:cardview-v7:28.0.0'
|
||||||
|
implementation 'com.github.xujiaji:happy-bubble:1.1.4'
|
||||||
|
|
||||||
|
implementation "androidx.cardview:cardview:1.0.0"
|
||||||
|
implementation 'com.android.support:design:28.0.0'
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.10.0'
|
||||||
|
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1 @@
|
|||||||
|
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.netcloudsharing;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("com.example.netcloudsharing", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.netcloudsharing">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/login_icon"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
|
android:roundIcon="@drawable/login_icon"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity android:name=".Music.MusicDownload"></activity>
|
||||||
|
<activity android:name=".Music.HttpGetDemoActivity" />
|
||||||
|
<activity android:name=".Music.MusicSearch" />
|
||||||
|
<service
|
||||||
|
android:name=".service.MusicService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity android:name="Fragment.MainActivity">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="Fragment.ActivityMusicHome" />
|
||||||
|
<activity android:name=".activity.RegisterActivity" />
|
||||||
|
<activity android:name=".activity.LoginActivity" />
|
||||||
|
<activity android:name=".diary.MainActivity" />
|
||||||
|
<activity android:name=".diary.AddContent" />
|
||||||
|
<activity android:name=".NetStart">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="com.example.netcloudsharing.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/provider_paths" />
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<uses-library
|
||||||
|
android:name="org.apache.http.legacy"
|
||||||
|
android:required="false" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,92 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
import com.example.netcloudsharing.game.WhitePiecesView;
|
||||||
|
|
||||||
|
public class FragmentCommunity extends Fragment implements WhitePiecesView.WhitePiecesListener {
|
||||||
|
private WhitePiecesView whitePiecesView;
|
||||||
|
private TextView scoreText;
|
||||||
|
private Activity mActivity;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.game, container, false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
whitePiecesView = view.findViewById(R.id.write_pieces);
|
||||||
|
scoreText = (TextView) view.findViewById(R.id.score);
|
||||||
|
whitePiecesView.setWhitePiecesListener(this);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getScore(int score, int grade) {
|
||||||
|
scoreText.setText("" + score + " 等级为" + grade);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gameOver() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||||
|
builder.setTitle("Game Over")
|
||||||
|
.setMessage("您获得的分数为" + scoreText.getText() + "是否重新开始")
|
||||||
|
.setNegativeButton("是", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
whitePiecesView.restart();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setPositiveButton("否", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mActivity.finish();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gameWin() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||||
|
builder.setTitle("Game Wining")
|
||||||
|
.setMessage("您获得的分数为" + scoreText.getText() + " 是否重新开始")
|
||||||
|
.setNegativeButton("是", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
whitePiecesView.restart();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setPositiveButton("否", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mActivity.finish();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
this.mActivity = (Activity) context;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
public class FragmentMessage extends Fragment {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_message,container,false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,219 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.LocalMusicBean;
|
||||||
|
import com.example.netcloudsharing.Music.MusicSearch;
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
import static Fragment.MainActivity.binder;
|
||||||
|
import static com.example.netcloudsharing.service.MusicService.currentPlayPosition;
|
||||||
|
|
||||||
|
public class FragmentMusic extends Fragment implements View.OnClickListener {
|
||||||
|
FragmentMusic_NewSong fragmentMusic_newSong;
|
||||||
|
FragmentMusic_RankingList fragmentMusic_rankingList;
|
||||||
|
FragmentMusic_SongList fragmentMusic_songList;
|
||||||
|
|
||||||
|
private Button btnNewSong;
|
||||||
|
private Button btnRankingList;
|
||||||
|
private Button btnSongList;
|
||||||
|
|
||||||
|
private TextView tvNewSong;
|
||||||
|
private TextView tvRankingList;
|
||||||
|
private TextView tvSongList;
|
||||||
|
|
||||||
|
private View thisView;
|
||||||
|
//三个播放歌曲按钮
|
||||||
|
private ImageView nextIv, playIv, lastIv, album;
|
||||||
|
//歌曲歌手
|
||||||
|
private TextView singerTv, songTv;
|
||||||
|
private boolean firstOpen = true;
|
||||||
|
|
||||||
|
private ImageButton ibSearch;
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
initView();
|
||||||
|
selectTab(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义控件
|
||||||
|
*/
|
||||||
|
private void initView() {
|
||||||
|
btnNewSong = thisView.findViewById(R.id.fragment_music_btnNewSong);
|
||||||
|
btnRankingList = thisView.findViewById(R.id.fragment_music_btnRankingList);
|
||||||
|
btnSongList = thisView.findViewById(R.id.fragment_music_btnSongList);
|
||||||
|
|
||||||
|
ibSearch = thisView.findViewById(R.id.fragment_music_ibSearch);
|
||||||
|
|
||||||
|
tvNewSong = thisView.findViewById(R.id.fragment_music_tvNewSong);
|
||||||
|
tvRankingList = thisView.findViewById(R.id.fragment_music_tvRankingList);
|
||||||
|
tvSongList = thisView.findViewById(R.id.fragment_music_tvSongList);
|
||||||
|
singerTv = thisView.findViewById(R.id.local_music_bottom_tvSinger);
|
||||||
|
songTv = thisView.findViewById(R.id.local_music_bottom_tvSong);
|
||||||
|
|
||||||
|
btnNewSong.setOnClickListener(this);
|
||||||
|
btnRankingList.setOnClickListener(this);
|
||||||
|
btnSongList.setOnClickListener(this);
|
||||||
|
|
||||||
|
nextIv = thisView.findViewById(R.id.local_music_bottom_ivNext);
|
||||||
|
playIv = thisView.findViewById(R.id.local_music_bottom_ivPlay);
|
||||||
|
lastIv = thisView.findViewById(R.id.local_music_bottom_ivLast);
|
||||||
|
|
||||||
|
nextIv.setOnClickListener(this);
|
||||||
|
lastIv.setOnClickListener(this);
|
||||||
|
playIv.setOnClickListener(this);
|
||||||
|
|
||||||
|
ibSearch.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_music, container, false);
|
||||||
|
this.thisView = view;
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
resetTab();
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.fragment_music_btnNewSong:
|
||||||
|
selectTab(0);
|
||||||
|
break;
|
||||||
|
case R.id.fragment_music_btnSongList:
|
||||||
|
selectTab(1);
|
||||||
|
break;
|
||||||
|
case R.id.fragment_music_btnRankingList:
|
||||||
|
selectTab(2);
|
||||||
|
break;
|
||||||
|
case R.id.local_music_bottom_ivPlay:
|
||||||
|
if (firstOpen) {
|
||||||
|
if (currentPlayPosition == -1) {
|
||||||
|
//如果没有音乐在播放
|
||||||
|
binder.playMusicPosition(null);
|
||||||
|
setMusicBean(binder.getMusicBean());
|
||||||
|
playIv.setImageResource(R.mipmap.icon_pause);
|
||||||
|
} else {
|
||||||
|
binder.playMusicPosition(currentPlayPosition);
|
||||||
|
}
|
||||||
|
firstOpen = false;
|
||||||
|
} else {
|
||||||
|
if (binder.isMusicPlaying()) {
|
||||||
|
//如果音乐正在播放,则暂停
|
||||||
|
binder.pauseMusic();
|
||||||
|
playIv.setImageResource(R.mipmap.icon_play);
|
||||||
|
} else {
|
||||||
|
//如果音乐正在暂停,则播放
|
||||||
|
binder.playMusic();
|
||||||
|
playIv.setImageResource(R.mipmap.icon_pause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setMusicBean(binder.getMusicBean());
|
||||||
|
|
||||||
|
break;
|
||||||
|
case R.id.local_music_bottom_ivLast:
|
||||||
|
binder.playLastMusic();
|
||||||
|
setMusicBean(binder.getMusicBean());
|
||||||
|
break;
|
||||||
|
case R.id.local_music_bottom_ivNext:
|
||||||
|
binder.playNextMusic();
|
||||||
|
setMusicBean(binder.getMusicBean());
|
||||||
|
break;
|
||||||
|
case R.id.fragment_music_ibSearch:
|
||||||
|
Intent intent = new Intent(getActivity(), MusicSearch.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMusicBean(LocalMusicBean bean) {
|
||||||
|
singerTv.setText(bean.getSinger());
|
||||||
|
songTv.setText(bean.getSong());
|
||||||
|
if (binder.isMusicPlaying()) {
|
||||||
|
playIv.setImageResource(R.mipmap.icon_pause);
|
||||||
|
} else {
|
||||||
|
playIv.setImageResource(R.mipmap.icon_play);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetTab() {
|
||||||
|
tvNewSong.setBackgroundColor(Color.WHITE);
|
||||||
|
tvSongList.setBackgroundColor(Color.WHITE);
|
||||||
|
tvRankingList.setBackgroundColor(Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectTab(int i) {
|
||||||
|
FragmentManager manager = getActivity().getSupportFragmentManager();
|
||||||
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
|
hideFragment(transaction);
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
tvNewSong.setBackgroundColor(Color.RED);
|
||||||
|
if (fragmentMusic_newSong == null) {
|
||||||
|
fragmentMusic_newSong = new FragmentMusic_NewSong();
|
||||||
|
transaction.add(R.id.fragment_music_fl, fragmentMusic_newSong);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMusic_newSong);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tvSongList.setBackgroundColor(Color.RED);
|
||||||
|
if (fragmentMusic_songList == null) {
|
||||||
|
fragmentMusic_songList = new FragmentMusic_SongList();
|
||||||
|
transaction.add(R.id.fragment_music_fl, fragmentMusic_songList);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMusic_songList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tvRankingList.setBackgroundColor(Color.RED);
|
||||||
|
if (fragmentMusic_rankingList == null) {
|
||||||
|
fragmentMusic_rankingList = new FragmentMusic_RankingList();
|
||||||
|
transaction.add(R.id.fragment_music_fl, fragmentMusic_rankingList);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMusic_rankingList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideFragment(FragmentTransaction transaction) {
|
||||||
|
if (fragmentMusic_newSong != null) {
|
||||||
|
transaction.hide(fragmentMusic_newSong);
|
||||||
|
}
|
||||||
|
if (fragmentMusic_songList != null) {
|
||||||
|
transaction.hide(fragmentMusic_songList);
|
||||||
|
}
|
||||||
|
if (fragmentMusic_rankingList != null) {
|
||||||
|
transaction.hide(fragmentMusic_rankingList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.d("MainActivity", "no");
|
||||||
|
if (binder != null) {
|
||||||
|
setMusicBean(binder.getMusicBean());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
public class FragmentMusic_RankingList extends Fragment {
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_music_rankinglist,container,false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
public class FragmentMusic_SongList extends Fragment {
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_music_songlist,container,false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
import com.example.netcloudsharing.diary.MainActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public class FragmentMy extends Fragment implements View.OnClickListener {
|
||||||
|
private Button btnDiary;
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_my,container,false);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
init(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(View view) {
|
||||||
|
view.findViewById(R.id.fragment_my_ll_diary).setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()){
|
||||||
|
case R.id.fragment_my_ll_diary:
|
||||||
|
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
package Fragment;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
import com.example.netcloudsharing.service.MusicService;
|
||||||
|
|
||||||
|
import static com.example.netcloudsharing.service.MusicService.currentPlayPosition;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
private FragmentMusic fragmentMusic;
|
||||||
|
private FragmentCommunity fragmentCommunity;
|
||||||
|
private FragmentMessage fragmentMessage;
|
||||||
|
private FragmentMy fragmentMy;
|
||||||
|
|
||||||
|
|
||||||
|
private ImageButton mImg1;
|
||||||
|
private ImageButton mImg2;
|
||||||
|
private ImageButton mImg3;
|
||||||
|
private ImageButton mImg4;
|
||||||
|
|
||||||
|
|
||||||
|
public static MusicService.MyBinder binder;
|
||||||
|
private myConn conn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
initView();//初始化控件
|
||||||
|
initEvent();//初始化事件
|
||||||
|
|
||||||
|
conn = new myConn();
|
||||||
|
Intent intent = new Intent(this,MusicService.class);
|
||||||
|
bindService(intent,conn, Context.BIND_AUTO_CREATE);
|
||||||
|
Log.d("MainActivity","1");
|
||||||
|
selectTab(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化事件
|
||||||
|
*/
|
||||||
|
private void initEvent() {
|
||||||
|
mImg1.setOnClickListener(this);
|
||||||
|
mImg2.setOnClickListener(this);
|
||||||
|
mImg3.setOnClickListener(this);
|
||||||
|
mImg4.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化控件
|
||||||
|
*/
|
||||||
|
private void initView() {
|
||||||
|
//初始化ImageButton布局文件
|
||||||
|
mImg1 = findViewById(R.id.ib_tab_home);
|
||||||
|
mImg2 = findViewById(R.id.ib_tab_community);
|
||||||
|
mImg3 = findViewById(R.id.ib_tab_message);
|
||||||
|
mImg4 = findViewById(R.id.ib_tab_my);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理点击事件
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
resetImages();
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.ib_tab_home:
|
||||||
|
selectTab(0);
|
||||||
|
break;
|
||||||
|
case R.id.ib_tab_community:
|
||||||
|
selectTab(1);
|
||||||
|
break;
|
||||||
|
case R.id.ib_tab_message:
|
||||||
|
|
||||||
|
selectTab(2);
|
||||||
|
break;
|
||||||
|
case R.id.ib_tab_my:
|
||||||
|
selectTab(3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//进行选中Tab的处理
|
||||||
|
private void selectTab(int i) {
|
||||||
|
//获取FragmentManager对象
|
||||||
|
FragmentManager manager = getSupportFragmentManager();
|
||||||
|
//获取FragmentTransaction对象
|
||||||
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
|
//先隐藏好所有的Fragment
|
||||||
|
hideFragment(transaction);
|
||||||
|
switch (i) {
|
||||||
|
//将选中的Tab实例化并关联起来
|
||||||
|
case 0:
|
||||||
|
mImg1.setImageResource(R.drawable.select_home);
|
||||||
|
if (fragmentMusic == null) {
|
||||||
|
fragmentMusic = new FragmentMusic();
|
||||||
|
transaction.add(R.id.fl_content, fragmentMusic);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMusic);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
mImg2.setImageResource(R.drawable.select_community);
|
||||||
|
if (fragmentCommunity == null) {
|
||||||
|
fragmentCommunity = new FragmentCommunity();
|
||||||
|
transaction.add(R.id.fl_content, fragmentCommunity);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentCommunity);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
mImg3.setImageResource(R.drawable.select_message);
|
||||||
|
if (fragmentMessage == null) {
|
||||||
|
fragmentMessage = new FragmentMessage();
|
||||||
|
transaction.add(R.id.fl_content, fragmentMessage);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMessage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
mImg4.setImageResource(R.drawable.select_my);
|
||||||
|
if (fragmentMy == null) {
|
||||||
|
fragmentMy = new FragmentMy();
|
||||||
|
transaction.add(R.id.fl_content, fragmentMy);
|
||||||
|
} else {
|
||||||
|
transaction.show(fragmentMy);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//提交事务
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//将Fragment进行隐藏
|
||||||
|
private void hideFragment(FragmentTransaction transaction) {
|
||||||
|
if (fragmentMusic != null) {
|
||||||
|
transaction.hide(fragmentMusic);
|
||||||
|
}
|
||||||
|
if (fragmentCommunity != null) {
|
||||||
|
transaction.hide(fragmentCommunity);
|
||||||
|
}
|
||||||
|
if (fragmentMessage != null) {
|
||||||
|
transaction.hide(fragmentMessage);
|
||||||
|
}
|
||||||
|
if (fragmentMy != null) {
|
||||||
|
transaction.hide(fragmentMy);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置导航图片
|
||||||
|
private void resetImages() {
|
||||||
|
mImg1.setImageResource(R.drawable.unselect_home);
|
||||||
|
mImg2.setImageResource(R.drawable.unselect_community);
|
||||||
|
mImg3.setImageResource(R.drawable.unselect_message);
|
||||||
|
mImg4.setImageResource(R.drawable.unselect_my);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class myConn implements ServiceConnection {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
|
binder = (MusicService.MyBinder) service;
|
||||||
|
Log.d("MainActivity","4");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
SharedPreferences sp = getSharedPreferences("lastMusicPlayPosition",MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor edit = sp.edit();
|
||||||
|
edit.putInt("lastMusicPlayPosition",currentPlayPosition);
|
||||||
|
edit.commit();
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.example.netcloudsharing;
|
||||||
|
|
||||||
|
public class LocalMusicBean {
|
||||||
|
private String id; //歌曲id
|
||||||
|
private String song; //歌曲名称
|
||||||
|
private String singer; //歌手名
|
||||||
|
private String album; //专辑
|
||||||
|
private String duration; //持续的时间
|
||||||
|
private String path; //歌曲路径
|
||||||
|
private int album_id; //歌曲图片id
|
||||||
|
|
||||||
|
public LocalMusicBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalMusicBean(String id, String song, String singer, String album, String duration, String path, int album_id) {
|
||||||
|
this.id = id;
|
||||||
|
this.song = song;
|
||||||
|
this.singer = singer;
|
||||||
|
this.album = album;
|
||||||
|
this.duration = duration;
|
||||||
|
this.path = path;
|
||||||
|
this.album_id = album_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalMusicBean(String id, String song, String singer, String album, String duration, String path) {
|
||||||
|
this.id = id;
|
||||||
|
this.song = song;
|
||||||
|
this.singer = singer;
|
||||||
|
this.album = album;
|
||||||
|
this.duration = duration;
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAlbum_id() {
|
||||||
|
return album_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlbum_id(int album_id) {
|
||||||
|
this.album_id = album_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSong() {
|
||||||
|
return song;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSong(String song) {
|
||||||
|
this.song = song;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSinger() {
|
||||||
|
return singer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSinger(String singer) {
|
||||||
|
this.singer = singer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlbum() {
|
||||||
|
return album;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlbum(String album) {
|
||||||
|
this.album = album;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.example.netcloudsharing.Music;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
public class MusicDownload extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_music_download);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.example.netcloudsharing.Music;
|
||||||
|
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.media.MediaPlayer.OnBufferingUpdateListener;
|
||||||
|
import android.media.MediaPlayer.OnPreparedListener;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
public class MusicPlayer implements OnBufferingUpdateListener, OnPreparedListener {
|
||||||
|
/* SeekBar拖动条 */
|
||||||
|
private SeekBar seekBar = null;
|
||||||
|
/* 播放器 */
|
||||||
|
public MediaPlayer mediaPlayer = null;
|
||||||
|
/* Timer定时器 */
|
||||||
|
private Timer mTimer = new Timer();
|
||||||
|
private static final int SHOW_SEEKBAR = 0;
|
||||||
|
private boolean isPlaying = false;
|
||||||
|
|
||||||
|
public MusicPlayer(SeekBar seekBar) {
|
||||||
|
this.seekBar = seekBar;
|
||||||
|
mediaPlayer = new MediaPlayer();
|
||||||
|
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||||
|
mediaPlayer.setOnBufferingUpdateListener(this);
|
||||||
|
mediaPlayer.setOnPreparedListener(this);
|
||||||
|
|
||||||
|
//使用定时器来改变seekBar的进度
|
||||||
|
mTimer.schedule(timerTask, 0, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
TimerTask timerTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (mediaPlayer == null)
|
||||||
|
return;
|
||||||
|
if (isPlaying && !seekBar.isPressed()) {
|
||||||
|
mHandler.sendEmptyMessage(SHOW_SEEKBAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Handler mHandler = new Handler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
|
if (msg.what == SHOW_SEEKBAR) {
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
int posttion = mediaPlayer.getCurrentPosition();//获取当前播放位置
|
||||||
|
int duration = mediaPlayer.getDuration();//获取总长度
|
||||||
|
int pos = (int) (100 * ((float) posttion / (float) duration));
|
||||||
|
seekBar.setProgress((int) pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public void play(String url) {
|
||||||
|
try {
|
||||||
|
mediaPlayer.reset();
|
||||||
|
mediaPlayer.setDataSource(url);
|
||||||
|
mediaPlayer.prepare();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pause() {
|
||||||
|
mediaPlayer.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
mediaPlayer.stop();
|
||||||
|
mediaPlayer.release();//结束后release
|
||||||
|
mediaPlayer = null;
|
||||||
|
isPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBufferingUpdate(MediaPlayer arg0, int arg1) {
|
||||||
|
/**
|
||||||
|
* 当网络stream buffer发生改变的时候调用
|
||||||
|
* 这里设置seekBar的第二进度条
|
||||||
|
*/
|
||||||
|
this.seekBar.setSecondaryProgress(arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrepared(MediaPlayer mp) {
|
||||||
|
/**
|
||||||
|
* 当播放文件准备好了后调用
|
||||||
|
* 开始播放
|
||||||
|
*/
|
||||||
|
mp.start();
|
||||||
|
isPlaying = true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.example.netcloudsharing;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.activity.LoginActivity;
|
||||||
|
import com.example.netcloudsharing.activity.RegisterActivity;
|
||||||
|
import com.example.netcloudsharing.tool.BaseTool;
|
||||||
|
|
||||||
|
public class NetStart extends AppCompatActivity {
|
||||||
|
|
||||||
|
private Button btnLogin;
|
||||||
|
private Button btnRegister;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_net_start);
|
||||||
|
Button btnLogin = BaseTool.openActivity(this,(Button)findViewById(R.id.btn_login),LoginActivity.class);
|
||||||
|
Button btnRegister = BaseTool.openActivity(this,(Button)findViewById(R.id.btn_register), RegisterActivity.class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,264 @@
|
|||||||
|
package com.example.netcloudsharing.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
import com.example.netcloudsharing.diary.Permission;
|
||||||
|
import com.example.netcloudsharing.tool.BaseTool;
|
||||||
|
import com.example.netcloudsharing.tool.UserDao;
|
||||||
|
import com.example.netcloudsharing.tool.Userinfo;
|
||||||
|
|
||||||
|
import Fragment.MainActivity;
|
||||||
|
|
||||||
|
public class LoginActivity extends AppCompatActivity{
|
||||||
|
private EditText etAccount;
|
||||||
|
private EditText etPassword;
|
||||||
|
private CheckBox cbAccount;
|
||||||
|
private CheckBox cbPassword;
|
||||||
|
private Handler mainHandle; //主线程
|
||||||
|
private UserDao dao; //用户数据库操作类
|
||||||
|
private String TAG = "LoginActivity";
|
||||||
|
private String SP_ACCOUNT = "sp_account";
|
||||||
|
private String SP_PASSWORD = "sp_password";
|
||||||
|
private String SP_IS_REMEMBER_ACCOUNT = "sp_is_remember_account";
|
||||||
|
private String SP_IS_REMEMBER_Password = "sp_is_remember_password";
|
||||||
|
private SharedPreferences sharedPreferences;
|
||||||
|
private boolean isCheckedAccount = false;
|
||||||
|
private boolean isCheckedPassword = false;
|
||||||
|
private Context context = this;
|
||||||
|
private Permission permission;
|
||||||
|
private Handler handler = new Handler(){
|
||||||
|
@Override
|
||||||
|
public void handleMessage(@NonNull Message msg) {
|
||||||
|
//super.handleMessage(msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_login);
|
||||||
|
//初始化控件
|
||||||
|
initUI();
|
||||||
|
//初始化数据
|
||||||
|
initData();
|
||||||
|
permission = new Permission();
|
||||||
|
permission.checkPermission(LoginActivity.this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
if(sharedPreferences==null){
|
||||||
|
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
isCheckedAccount = sharedPreferences.getBoolean(SP_IS_REMEMBER_ACCOUNT,false);
|
||||||
|
isCheckedPassword = sharedPreferences.getBoolean(SP_IS_REMEMBER_Password,false);
|
||||||
|
//回写数据
|
||||||
|
if(isCheckedAccount){
|
||||||
|
etAccount.setText(sharedPreferences.getString(SP_ACCOUNT,""));
|
||||||
|
}
|
||||||
|
if(isCheckedPassword){
|
||||||
|
etPassword.setText(sharedPreferences.getString(SP_PASSWORD,""));
|
||||||
|
}
|
||||||
|
cbAccount.setChecked(isCheckedAccount);
|
||||||
|
cbPassword.setChecked(isCheckedPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUI(){
|
||||||
|
dao = new UserDao(); //操作数据库类
|
||||||
|
mainHandle = new Handler(getMainLooper()); //获取主线程
|
||||||
|
|
||||||
|
etAccount = findViewById(R.id.login_et_account);
|
||||||
|
etPassword = findViewById(R.id.login_et_password);
|
||||||
|
|
||||||
|
|
||||||
|
//设置编辑框监听器
|
||||||
|
login_etListener();
|
||||||
|
|
||||||
|
cbAccount = findViewById(R.id.cb_remember_account);
|
||||||
|
cbPassword = findViewById(R.id.cb_remember_password);
|
||||||
|
|
||||||
|
//设置复选框监听器
|
||||||
|
login_cbListener();
|
||||||
|
|
||||||
|
Button btnLogin = findViewById(R.id.login_btn_login);
|
||||||
|
//设立点击事件——登录
|
||||||
|
btnLogin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String account = etAccount.getText().toString().trim();
|
||||||
|
String password = etPassword.getText().toString().trim();
|
||||||
|
login(account,password);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Button btnTouristLogin = findViewById(R.id.login_btn_tourist);
|
||||||
|
btnTouristLogin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
BaseTool.showShortMsg(context,"欢迎进入");
|
||||||
|
BaseTool.navigateTo(context,MainActivity.class);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复选框监听器
|
||||||
|
*/
|
||||||
|
private void login_cbListener(){
|
||||||
|
/**
|
||||||
|
* 设立点击记住账号事件
|
||||||
|
*/
|
||||||
|
cbAccount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
Log.d(TAG,"账号状态为:"+isChecked);
|
||||||
|
isCheckedAccount = isChecked;
|
||||||
|
//实例化sharedPreferences对象
|
||||||
|
if(sharedPreferences==null){
|
||||||
|
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//实例化sharedPreferences的编辑者对象
|
||||||
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||||
|
//存储数据
|
||||||
|
if(isChecked) {
|
||||||
|
edit.putString(SP_ACCOUNT, etAccount.getText().toString().trim());
|
||||||
|
}
|
||||||
|
edit.putBoolean(SP_IS_REMEMBER_ACCOUNT,isChecked);
|
||||||
|
//提交
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 设立点击记住密码事件
|
||||||
|
*/
|
||||||
|
cbPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
Log.d(TAG, "密码状态为:" + isChecked);
|
||||||
|
isCheckedPassword = isChecked;
|
||||||
|
//实例化sharedPreferences对象
|
||||||
|
if (sharedPreferences == null) {
|
||||||
|
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//实例化sharedPreferences的编辑者对象
|
||||||
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||||
|
//存储数据
|
||||||
|
if (isChecked) {
|
||||||
|
edit.putString(SP_PASSWORD, etPassword.getText().toString().trim());
|
||||||
|
}
|
||||||
|
edit.putBoolean(SP_IS_REMEMBER_Password, isChecked);
|
||||||
|
//提交
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑框监听器
|
||||||
|
*/
|
||||||
|
private void login_etListener(){
|
||||||
|
etAccount.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
if(isCheckedAccount){
|
||||||
|
//实例化sharedPreferences对象
|
||||||
|
if(sharedPreferences==null){
|
||||||
|
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||||
|
edit.putString(SP_ACCOUNT,etAccount.getText().toString().trim());
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
etPassword.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
if(isCheckedPassword){
|
||||||
|
//实例化sharedPreferences对象
|
||||||
|
if(sharedPreferences==null){
|
||||||
|
sharedPreferences = getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||||
|
edit.putString(SP_PASSWORD, etPassword.getText().toString().trim());
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 执行登录操作
|
||||||
|
* @param account 账号
|
||||||
|
* @param password 密码
|
||||||
|
*/
|
||||||
|
private void login(final String account, final String password){
|
||||||
|
if(TextUtils.isEmpty(account)){
|
||||||
|
BaseTool.showShortMsg(this,getString(R.string.please_input_account));
|
||||||
|
etAccount.requestFocus();
|
||||||
|
}else if(TextUtils.isEmpty(password)){
|
||||||
|
BaseTool.showShortMsg(this,getString(R.string.please_input_password));
|
||||||
|
etPassword.requestFocus();
|
||||||
|
}else{
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final Userinfo item = dao.getUserByUnameAndUpass(account,password);
|
||||||
|
mainHandle.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(item==null){
|
||||||
|
BaseTool.showDlaMsg(context,"用户名或密码错误");
|
||||||
|
}else{
|
||||||
|
BaseTool.showShortMsg(context,"登录成功");
|
||||||
|
Intent intent = new Intent(context, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.setClass(context,MainActivity.class);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.VideoView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class AddContent extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
private String val;
|
||||||
|
private Button btnSave, btnCancel, btnBack;
|
||||||
|
private EditText etText;
|
||||||
|
private ImageView ivImage;
|
||||||
|
private VideoView vvVideo;
|
||||||
|
private NotesDB notesDB;
|
||||||
|
private SQLiteDatabase dbWriter;
|
||||||
|
private File file = null;
|
||||||
|
private String currentPath = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.diary_add_content);
|
||||||
|
init();
|
||||||
|
val = getIntent().getStringExtra("flag");
|
||||||
|
notesDB = new NotesDB(this);
|
||||||
|
dbWriter = notesDB.getWritableDatabase();
|
||||||
|
selectView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择将图片或视频进行显示
|
||||||
|
*/
|
||||||
|
public void selectView() {
|
||||||
|
NoteInfo info = (NoteInfo) getIntent().getSerializableExtra("noteInfo");
|
||||||
|
if (val.equals("1")) {
|
||||||
|
//文字
|
||||||
|
ivImage.setVisibility(View.GONE);
|
||||||
|
vvVideo.setVisibility(View.GONE);
|
||||||
|
if(info!=null){
|
||||||
|
etText.setText(info.getContent());
|
||||||
|
}
|
||||||
|
} else if (val.equals("2")) {
|
||||||
|
//图片
|
||||||
|
ivImage.setVisibility(View.VISIBLE);
|
||||||
|
vvVideo.setVisibility(View.GONE);
|
||||||
|
if(info!=null){
|
||||||
|
currentPath = info.getPath();
|
||||||
|
etText.setText(info.getContent());
|
||||||
|
}else{
|
||||||
|
currentPath = getIntent().getStringExtra("path");
|
||||||
|
}
|
||||||
|
Bitmap bitmap = BitmapFactory.decodeFile(currentPath);
|
||||||
|
ivImage.setImageBitmap(bitmap);
|
||||||
|
} else if (val.equals("3")) {
|
||||||
|
//视频
|
||||||
|
ivImage.setVisibility(View.GONE);
|
||||||
|
vvVideo.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
btnSave = findViewById(R.id.addContent_btnSave);
|
||||||
|
btnCancel = findViewById(R.id.addContent_btnCancel);
|
||||||
|
btnBack = findViewById(R.id.addContent_btnBack);
|
||||||
|
etText = findViewById(R.id.addContent_etText);
|
||||||
|
ivImage = findViewById(R.id.addContent_ivImage);
|
||||||
|
vvVideo = findViewById(R.id.addContent_vvVideo);
|
||||||
|
|
||||||
|
btnSave.setOnClickListener(this);
|
||||||
|
btnCancel.setOnClickListener(this);
|
||||||
|
btnBack.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDB() {
|
||||||
|
ContentValues cv = new ContentValues();
|
||||||
|
cv.put(NotesDB.CONTENT, etText.getText().toString());
|
||||||
|
cv.put(NotesDB.TIME, getTime());
|
||||||
|
cv.put(NotesDB.PATH, currentPath);
|
||||||
|
cv.put(NotesDB.TYPE, val);
|
||||||
|
dbWriter.insert(NotesDB.TABLE_NAME, null, cv);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss", Locale.CHINA);
|
||||||
|
Date curDate = new Date();
|
||||||
|
return format.format(curDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.addContent_btnSave:
|
||||||
|
addDB();
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
case R.id.addContent_btnCancel:
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
case R.id.addContent_btnBack:
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,308 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.xujiaji.happybubble.BubbleDialog;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
|
||||||
|
private NotesDB notesDB;
|
||||||
|
private Button btnText, btnImg, btnVideo;
|
||||||
|
private ListView lv;
|
||||||
|
private Intent intent;
|
||||||
|
private MyAdapter adapter;
|
||||||
|
private BottomSheetDialog dialog;
|
||||||
|
private final int REQUEST_CAMERA = 1;
|
||||||
|
private final int REQUEST_PICK = 2;
|
||||||
|
private final int REQUEST_ALTER = 3;
|
||||||
|
private String currentPath = null;
|
||||||
|
private Permission permission;
|
||||||
|
private List<NoteInfo> mData;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.diary_main);
|
||||||
|
init();
|
||||||
|
mData = new ArrayList<>();
|
||||||
|
notesDB = new NotesDB(this);
|
||||||
|
Log.d("Main", "onCreate");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
btnText = findViewById(R.id.btn_text);
|
||||||
|
btnImg = findViewById(R.id.btn_img);
|
||||||
|
btnVideo = findViewById(R.id.btn_video);
|
||||||
|
lv = findViewById(R.id.lv);
|
||||||
|
|
||||||
|
btnVideo.setOnClickListener(this);
|
||||||
|
btnText.setOnClickListener(this);
|
||||||
|
btnImg.setOnClickListener(this);
|
||||||
|
|
||||||
|
String[] mode = {"相机", "相册", "取消"};
|
||||||
|
ListView listView = new ListView(this);
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
listView.setLayoutParams(params);
|
||||||
|
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mode));
|
||||||
|
|
||||||
|
dialog = new BottomSheetDialog(this);
|
||||||
|
dialog.setContentView(listView);
|
||||||
|
|
||||||
|
//选择图文模块后顶部弹出listView选择框
|
||||||
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
permission = new Permission();
|
||||||
|
permission.checkPermission(MainActivity.this);
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
dispatchTakePictureIntent();
|
||||||
|
dialog.dismiss();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Intent intent1 = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
intent1.setType("image/*");
|
||||||
|
startActivityForResult(intent1, REQUEST_PICK);
|
||||||
|
dialog.dismiss();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dialog.dismiss();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static final int REQUEST_IMAGE_CAPTURE = 1;
|
||||||
|
|
||||||
|
public void dispatchTakePictureIntent() {
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
//必须确保手机上有相机,才可以继续,否则会一直闪退,故加判断语句
|
||||||
|
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
|
File photoFile = null;
|
||||||
|
try {
|
||||||
|
photoFile = createImageFile();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
if (photoFile != null) {
|
||||||
|
Uri photoURI = FileProvider.getUriForFile(this, "com.example.netcloudsharing.fileprovider", photoFile);
|
||||||
|
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||||
|
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File createImageFile() throws IOException {
|
||||||
|
//Create an image file name
|
||||||
|
String imageFileName = getTimeToPath();
|
||||||
|
Log.d("imageFileName", imageFileName);
|
||||||
|
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
|
File image = File.createTempFile(
|
||||||
|
imageFileName,
|
||||||
|
".jpg",
|
||||||
|
storageDir
|
||||||
|
);
|
||||||
|
currentPath = image.getAbsolutePath();
|
||||||
|
Log.d("imageFileName", currentPath);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimeToPath() {
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA);
|
||||||
|
Date curDate = new Date();
|
||||||
|
return format.format(curDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
intent = new Intent(this, AddContent.class);
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.btn_text:
|
||||||
|
intent.putExtra("flag", "1");
|
||||||
|
startActivity(intent);
|
||||||
|
break;
|
||||||
|
case R.id.btn_img:
|
||||||
|
intent.putExtra("flag", "2");
|
||||||
|
dialog.show();
|
||||||
|
break;
|
||||||
|
case R.id.btn_video:
|
||||||
|
intent.putExtra("flag", "3");
|
||||||
|
startActivity(intent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDB(int position) {
|
||||||
|
String id = mData.get(position).getId();
|
||||||
|
SQLiteDatabase dbWrite = notesDB.getWritableDatabase();
|
||||||
|
dbWrite.delete(NotesDB.TABLE_NAME, NotesDB.ID + "=?", new String[]{id + ""});
|
||||||
|
dbWrite.close();
|
||||||
|
selectDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void selectDB() {
|
||||||
|
//将链表清空
|
||||||
|
mData.clear();
|
||||||
|
SQLiteDatabase dbReader = notesDB.getReadableDatabase();
|
||||||
|
Cursor cursor = dbReader.query(NotesDB.TABLE_NAME, null, null, null, null, null, null);
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
String id = cursor.getString(cursor.getColumnIndex(NotesDB.ID));
|
||||||
|
String content = cursor.getString(cursor.getColumnIndex(NotesDB.CONTENT));
|
||||||
|
String path = cursor.getString(cursor.getColumnIndex(NotesDB.PATH));
|
||||||
|
String video = cursor.getString(cursor.getColumnIndex(NotesDB.VIDEO));
|
||||||
|
String time = cursor.getString(cursor.getColumnIndex(NotesDB.TIME));
|
||||||
|
int type = cursor.getInt(cursor.getColumnIndex(NotesDB.TYPE));
|
||||||
|
NoteInfo info = new NoteInfo(content, path, video, id, time, type);
|
||||||
|
mData.add(info);
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
dbReader.close();
|
||||||
|
adapter = new MyAdapter(this, mData);
|
||||||
|
lv.setAdapter(adapter);
|
||||||
|
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, AddContent.class);
|
||||||
|
NoteInfo noteInfo = mData.get(position);
|
||||||
|
intent.putExtra("noteInfo", noteInfo);
|
||||||
|
intent.putExtra("flag", noteInfo.getType() + "");
|
||||||
|
Log.d("flag", noteInfo.getType() + "");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||||
|
View viewDelete = LayoutInflater.from(MainActivity.this).inflate(R.layout.diary_button_delete, null);
|
||||||
|
//设置长按删除按钮
|
||||||
|
final BubbleDialog bubbleDialog = new BubbleDialog(MainActivity.this);
|
||||||
|
bubbleDialog.addContentView(viewDelete).setClickedView(view).calBar(true).calBar(true).show();
|
||||||
|
Button btnDelete = viewDelete.findViewById(R.id.diary_btnDelete);
|
||||||
|
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
deleteDB(position);
|
||||||
|
bubbleDialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写每次与屏幕连接的函数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.d("Main", "OnResume");
|
||||||
|
selectDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择图文按钮中的拍照或选择图库中的图片返回函数
|
||||||
|
*
|
||||||
|
* @param requestCode 请求码
|
||||||
|
* @param resultCode 返回码
|
||||||
|
* @param data 数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
switch (requestCode) {
|
||||||
|
case REQUEST_CAMERA: {
|
||||||
|
Intent intent = new Intent(this, AddContent.class);
|
||||||
|
intent.putExtra("path", currentPath);
|
||||||
|
intent.putExtra("flag", "2");
|
||||||
|
startActivity(intent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case REQUEST_PICK: {
|
||||||
|
Uri uri = null;
|
||||||
|
// try 是有可能未选择图片就进行返回,会造成空指针
|
||||||
|
try {
|
||||||
|
uri = data.getData(); //获取系统返回的照片uri
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (uri != null) {
|
||||||
|
// 使用ContentResolve 进行读取选择的图片路径
|
||||||
|
String[] strings = {MediaStore.Images.Media.DATA};
|
||||||
|
Cursor cursor = getContentResolver().query(uri, strings, null, null, null);
|
||||||
|
cursor.moveToFirst();
|
||||||
|
int index = cursor.getColumnIndex(strings[0]);
|
||||||
|
String path = cursor.getString(index); //获取图片路径
|
||||||
|
cursor.close();
|
||||||
|
Intent intent = new Intent(this, AddContent.class);
|
||||||
|
intent.putExtra("path", path);
|
||||||
|
intent.putExtra("flag", "2");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断权限返回是否正确
|
||||||
|
*
|
||||||
|
* @param requestCode 返回字段
|
||||||
|
* @param permissions 权限集
|
||||||
|
* @param grantResults 结果集
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == permission.REQUEST_CODE) {
|
||||||
|
for (int i = 0; i < grantResults.length; i++) {
|
||||||
|
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Log.e("permission", permissions[i] + "not");
|
||||||
|
Log.e("permission", grantResults[i] + "not");
|
||||||
|
} else {
|
||||||
|
Log.e("permission", permissions[i] + "");
|
||||||
|
Log.e("permission", grantResults[i] + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.media.ThumbnailUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.example.netcloudsharing.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MyAdapter extends BaseAdapter {
|
||||||
|
private Context context;
|
||||||
|
private ViewHolder holder;
|
||||||
|
private List<NoteInfo> data;
|
||||||
|
|
||||||
|
MyAdapter(Context context, List<NoteInfo> data) {
|
||||||
|
this.context = context;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return data.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(context).inflate(R.layout.diary_list_item, parent, false);
|
||||||
|
holder = new ViewHolder();
|
||||||
|
holder.tv_listContent = convertView.findViewById(R.id.list_tvContent);
|
||||||
|
holder.tv_listTime = convertView.findViewById(R.id.list_tvTime);
|
||||||
|
holder.iv_listImage = convertView.findViewById(R.id.list_ivImg);
|
||||||
|
holder.iv_listVideo = convertView.findViewById(R.id.list_ivVideo);
|
||||||
|
convertView.setTag(holder);
|
||||||
|
} else {
|
||||||
|
holder = (ViewHolder) convertView.getTag();
|
||||||
|
}
|
||||||
|
holder.tv_listContent.setText(data.get(position).getContent());
|
||||||
|
holder.tv_listTime.setText(data.get(position).getTime());
|
||||||
|
holder.iv_listImage.setImageBitmap(getImageThumbnail(data.get(position).getPath(),
|
||||||
|
200, 200));
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缩略图的方法
|
||||||
|
*
|
||||||
|
* @param uri 路径
|
||||||
|
* @param width 宽
|
||||||
|
* @param height 高
|
||||||
|
* @return 缩略图
|
||||||
|
*/
|
||||||
|
public Bitmap getImageThumbnail(String uri, int width, int height) {
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
//获取缩略图
|
||||||
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
|
options.inJustDecodeBounds = true;
|
||||||
|
bitmap = BitmapFactory.decodeFile(uri, options);
|
||||||
|
options.inJustDecodeBounds = false;
|
||||||
|
int beWidth = options.outWidth / width;
|
||||||
|
int beHeight = options.outHeight / height;
|
||||||
|
int be = 1 ;
|
||||||
|
if (beWidth < beHeight) {
|
||||||
|
be = beWidth;
|
||||||
|
} else {
|
||||||
|
be = beHeight;
|
||||||
|
}
|
||||||
|
if (be <= 0) {
|
||||||
|
be = 1;
|
||||||
|
}
|
||||||
|
options.inSampleSize = be;
|
||||||
|
bitmap = BitmapFactory.decodeFile(uri, options);
|
||||||
|
bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height,
|
||||||
|
ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ViewHolder {
|
||||||
|
public TextView tv_listContent, tv_listTime;
|
||||||
|
public ImageView iv_listImage, iv_listVideo;
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class NoteInfo implements Serializable {
|
||||||
|
private String content;
|
||||||
|
private String path;
|
||||||
|
private String video;
|
||||||
|
private String id;
|
||||||
|
private String time;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public NoteInfo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoteInfo(String content, String path, String video, String id, String time,int type) {
|
||||||
|
this.content = content;
|
||||||
|
this.path = path;
|
||||||
|
this.video = video;
|
||||||
|
this.id = id;
|
||||||
|
this.time = time;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideo(String video) {
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideo() {
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
|
public class NotesDB extends SQLiteOpenHelper {
|
||||||
|
public static final String TABLE_NAME = "note";
|
||||||
|
public static final String CONTENT = "content";
|
||||||
|
public static final String PATH = "path";
|
||||||
|
public static final String VIDEO = "video";
|
||||||
|
public static final String ID = "_id";
|
||||||
|
public static final String TIME = "time";
|
||||||
|
public static final String TYPE = "type";
|
||||||
|
|
||||||
|
public NotesDB(Context context) {
|
||||||
|
super(context, "notes", null, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(SQLiteDatabase db) {
|
||||||
|
db.execSQL("create table " + TABLE_NAME + "(" + ID
|
||||||
|
+ " integer not null primary key autoincrement," + CONTENT
|
||||||
|
+ " text," + PATH + " text," + VIDEO
|
||||||
|
+ " text," + TIME + " text not null,"+ TYPE
|
||||||
|
+ " tinyint not null)");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.example.netcloudsharing.diary;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Permission {
|
||||||
|
private static final String[] permission = {
|
||||||
|
Manifest.permission.CAMERA,
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION};
|
||||||
|
private List<String> permissionList = new ArrayList<>();
|
||||||
|
public int REQUEST_CODE = 1000;
|
||||||
|
|
||||||
|
public void checkPermission(Activity activity) {
|
||||||
|
for (int i = 0; i < permission.length; i++) {
|
||||||
|
if (ContextCompat.checkSelfPermission(activity, permission[i]) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
permissionList.add(permission[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(permissionList.size()>0){
|
||||||
|
requestPermission(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestPermission(Activity activity) {
|
||||||
|
ActivityCompat.requestPermissions(activity,permissionList.toArray(new String[permissionList.size()]),REQUEST_CODE);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.netcloudsharing.tool;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class BaseTool{
|
||||||
|
/**
|
||||||
|
* 给button设置监听器
|
||||||
|
* @param context 上下文
|
||||||
|
* @param btn 按钮
|
||||||
|
* @param cls 导向的class
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Button openActivity(final Context context, Button btn, final Class cls){
|
||||||
|
btn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
BaseTool.navigateTo(context,cls);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航到另一个Activity中
|
||||||
|
* @param context 上下文
|
||||||
|
* @param cls 导向的class
|
||||||
|
*/
|
||||||
|
public static void navigateTo(Context context,Class cls){
|
||||||
|
Intent intent = new Intent(context,cls);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 显示的短消息
|
||||||
|
* @param context 上下文
|
||||||
|
* @param msg 要显示的短消息
|
||||||
|
*/
|
||||||
|
public static void showShortMsg(Context context,String msg){
|
||||||
|
Toast.makeText(context,msg,Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示长消息
|
||||||
|
* @param context 上下文
|
||||||
|
* @param msg 要显示的消息
|
||||||
|
*/
|
||||||
|
public static void showLongMsg(Context context,String msg){
|
||||||
|
Toast.makeText(context,msg,Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示消息对话框
|
||||||
|
* @param context 上下文
|
||||||
|
* @param msg 要显示的消息
|
||||||
|
*/
|
||||||
|
public static void showDlaMsg(Context context,String msg){
|
||||||
|
new AlertDialog.Builder(context)
|
||||||
|
.setTitle("提示信息")
|
||||||
|
.setMessage(msg)
|
||||||
|
.setPositiveButton("确定",null)
|
||||||
|
.setNegativeButton("取消",null)
|
||||||
|
.create().show();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.example.netcloudsharing.tool;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
/*
|
||||||
|
直接连接数据库的辅助工具类
|
||||||
|
*/
|
||||||
|
public class DbOpenHelper {
|
||||||
|
final static private String CLS = "com.mysql.jdbc.Driver";
|
||||||
|
final static private String URL = "jdbc:mysql://10.77.169.229:3306/netsharingdb";
|
||||||
|
final static private String USER = "zzc";
|
||||||
|
final static private String PWD = "112211";
|
||||||
|
|
||||||
|
public static Connection conn; //连接对象
|
||||||
|
public static Statement stmt; //命令集
|
||||||
|
public static PreparedStatement pStmt; //预编译命令集
|
||||||
|
public static ResultSet rs; //结果集
|
||||||
|
|
||||||
|
//取得连接的方法
|
||||||
|
public static void getConnection(){
|
||||||
|
try{
|
||||||
|
Class.forName(CLS);
|
||||||
|
conn = DriverManager.getConnection(URL,USER,PWD);
|
||||||
|
}catch(Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//关闭连接
|
||||||
|
public static void closeAll(){
|
||||||
|
try{
|
||||||
|
if(rs!=null){
|
||||||
|
rs.close();
|
||||||
|
rs=null;
|
||||||
|
}
|
||||||
|
if(pStmt!=null){
|
||||||
|
pStmt.close();
|
||||||
|
pStmt=null;
|
||||||
|
}
|
||||||
|
if(stmt!=null){
|
||||||
|
stmt.close();
|
||||||
|
stmt=null;
|
||||||
|
}
|
||||||
|
if(conn!=null){
|
||||||
|
conn.close();
|
||||||
|
conn=null;
|
||||||
|
}
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.example.netcloudsharing.tool;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
/*
|
||||||
|
直接连接数据库的辅助工具类
|
||||||
|
*/
|
||||||
|
public class MySqlHelp {
|
||||||
|
public static int getUserSize(){
|
||||||
|
final String CLS = "com.mysql.jdbc.Driver";
|
||||||
|
final String URL = "jdbc:mysql://10.77.169.229:3306/netsharingdb";
|
||||||
|
final String USER = "zzc";
|
||||||
|
final String PWD = "112211";
|
||||||
|
int count=0;
|
||||||
|
try{
|
||||||
|
Class.forName(CLS);
|
||||||
|
Connection conn = DriverManager.getConnection(URL,USER,PWD);
|
||||||
|
String sql ="select count(1) as sl from userinfo";
|
||||||
|
Statement stmt = conn.createStatement();
|
||||||
|
ResultSet rs =stmt.executeQuery(sql);
|
||||||
|
while(rs.next()){
|
||||||
|
count = rs.getInt("sl");
|
||||||
|
}
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,137 @@
|
|||||||
|
package com.example.netcloudsharing.tool;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*
|
||||||
|
用户数据库操作类
|
||||||
|
实现用户的CRUD操作
|
||||||
|
*/
|
||||||
|
public class UserDao extends DbOpenHelper {
|
||||||
|
/**
|
||||||
|
* 查询所有用户的信息 R
|
||||||
|
* @return List<Userinfo>表单
|
||||||
|
*/
|
||||||
|
public List<Userinfo> getAllUserList(){
|
||||||
|
List<Userinfo> list = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
getConnection(); //取得连接信息
|
||||||
|
String sql="select * from userinfo";
|
||||||
|
pStmt = conn.prepareStatement(sql);
|
||||||
|
rs = pStmt.executeQuery();
|
||||||
|
if(rs.next()){
|
||||||
|
Userinfo item = new Userinfo();
|
||||||
|
item.setId(rs.getInt("id"));
|
||||||
|
item.setUname(rs.getString("uname"));
|
||||||
|
item.setUpass(rs.getString("upass"));
|
||||||
|
item.setCreateDt(rs.getString("createDt"));
|
||||||
|
|
||||||
|
list.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户名和密码查询用户信息 R
|
||||||
|
* @param uname 用户名
|
||||||
|
* @param upass 密码
|
||||||
|
* @return Userinfo实例
|
||||||
|
*/
|
||||||
|
public Userinfo getUserByUnameAndUpass(String uname,String upass){
|
||||||
|
Userinfo item = null;
|
||||||
|
try{
|
||||||
|
getConnection(); //取得连接信息
|
||||||
|
String sql="select * from userinfo where uname = ? and upass = ?";
|
||||||
|
pStmt = conn.prepareStatement(sql);
|
||||||
|
pStmt.setString(1,uname);
|
||||||
|
pStmt.setString(2,upass);
|
||||||
|
rs = pStmt.executeQuery();
|
||||||
|
if(rs.next()){
|
||||||
|
item = new Userinfo();
|
||||||
|
item.setId(rs.getInt("id"));
|
||||||
|
item.setUname(uname);
|
||||||
|
item.setCreateDt(rs.getString("createDt"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户信息 C
|
||||||
|
* @param item 要添加的用户
|
||||||
|
* @return int 影响的行数
|
||||||
|
*/
|
||||||
|
public int addUser(Userinfo item){
|
||||||
|
int iRow = 0;
|
||||||
|
try{
|
||||||
|
getConnection(); //取得连接信息
|
||||||
|
String sql="insert into userinfo(uname,upass,createDt) values(?,?,?)";
|
||||||
|
pStmt = conn.prepareStatement(sql);
|
||||||
|
pStmt.setString(1,item.getUname());
|
||||||
|
pStmt.setString(2,item.getUpass());
|
||||||
|
pStmt.setString(3,item.getCreateDt());
|
||||||
|
iRow = pStmt.executeUpdate();
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
return iRow;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改用户信息 U
|
||||||
|
* @param item 要修改的用户
|
||||||
|
* @return int 影响的行数
|
||||||
|
*/
|
||||||
|
public int editUser(Userinfo item){
|
||||||
|
int iRow = 0;
|
||||||
|
try{
|
||||||
|
getConnection(); //取得连接信息
|
||||||
|
String sql="updata userinfo set uname = ?,upass = ? where id =?";
|
||||||
|
pStmt = conn.prepareStatement(sql);
|
||||||
|
pStmt.setString(1,item.getUname());
|
||||||
|
pStmt.setString(2,item.getUpass());
|
||||||
|
pStmt.setInt(3,item.getId());
|
||||||
|
iRow = pStmt.executeUpdate();
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
return iRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id 删除用户信息 D
|
||||||
|
* @param id 要删除的用户id
|
||||||
|
* @return int 影响的行数
|
||||||
|
*/
|
||||||
|
public int delUser(int id){
|
||||||
|
int iRow = 0;
|
||||||
|
try{
|
||||||
|
getConnection(); //取得连接信息
|
||||||
|
String sql="delete from userinfo where id = ?";
|
||||||
|
pStmt = conn.prepareStatement(sql);
|
||||||
|
pStmt.setInt(1,id);
|
||||||
|
iRow = pStmt.executeUpdate();
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
return iRow;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.example.netcloudsharing.tool;
|
||||||
|
/*
|
||||||
|
用户信息实体类
|
||||||
|
*/
|
||||||
|
import java.io.Serializable;
|
||||||
|
public class Userinfo implements Serializable{
|
||||||
|
private int id;
|
||||||
|
private String uname;
|
||||||
|
private String upass;
|
||||||
|
private String createDt;
|
||||||
|
|
||||||
|
public Userinfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Userinfo(int id, String uname, String upass, String createDt) {
|
||||||
|
this.id = id;
|
||||||
|
this.uname = uname;
|
||||||
|
this.upass = upass;
|
||||||
|
this.createDt = createDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUname() {
|
||||||
|
return uname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUname(String uname) {
|
||||||
|
this.uname = uname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpass() {
|
||||||
|
return upass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpass(String upass) {
|
||||||
|
this.upass = upass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateDt() {
|
||||||
|
return createDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDt(String createDt) {
|
||||||
|
this.createDt = createDt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 157 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 201 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 631 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<stroke android:width="1dp"
|
||||||
|
android:color="#bcb8b8"/>
|
||||||
|
<size android:width="300dp"/>
|
||||||
|
</shape>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 825 B |
After Width: | Height: | Size: 847 B |
After Width: | Height: | Size: 912 B |
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="9dp" />
|
||||||
|
<solid android:color="#c75fe768" />
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="9dp"/>
|
||||||
|
<solid android:color="#F2F2F2"/>
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="9dp" />
|
||||||
|
<solid android:color="#C75FE7C7" />
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="9dp" />
|
||||||
|
<solid android:color="#afee5d59" />
|
||||||
|
</shape>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="9dp"/>
|
||||||
|
</shape>
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 818 B |
After Width: | Height: | Size: 893 B |
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:context=".activity.LoginActivity">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="329dp"
|
||||||
|
android:src="@mipmap/login"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="230dp"
|
||||||
|
android:background="@drawable/shape_login_form"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingRight="31dp"
|
||||||
|
android:layout_marginLeft="18dp"
|
||||||
|
android:layout_marginRight="18dp"
|
||||||
|
android:layout_marginTop="278dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="43dp"
|
||||||
|
android:paddingEnd="31dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:src="@mipmap/account"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/login_et_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:hint="@string/please_input_account"
|
||||||
|
android:textColorHint="#bcbcbc"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="@null"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:inputType="text" />
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_marginTop="23dp"
|
||||||
|
android:layout_marginBottom="23dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/divide"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:src="@mipmap/password"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/login_et_password"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:hint="@string/please_input_password"
|
||||||
|
android:textColorHint="#bcbcbc"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:layout_marginStart="20dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp">
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_remember_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cb_rm_account"/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_remember_password"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="30dp"
|
||||||
|
android:text="@string/cb_rm_password"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login_btn_login"
|
||||||
|
android:layout_marginLeft="18dp"
|
||||||
|
android:layout_marginRight="18dp"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:background="@drawable/shape_login_btn"
|
||||||
|
android:text="@string/login"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login_btn_tourist"
|
||||||
|
android:layout_marginLeft="18dp"
|
||||||
|
android:layout_marginRight="18dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:background="@drawable/shape_login_tourist_btn"
|
||||||
|
android:text="@string/touristlogin"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="Fragment.MainActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fl_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
<include layout="@layout/bottom"/>
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Music.MusicDownload"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="音乐下载"
|
||||||
|
android:textSize="20sp"/>
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Music.MusicDownload">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<include layout="@layout/music_buttom" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/local_music_rv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@id/local_music_bottomLayout">
|
||||||
|
|
||||||
|
</androidx.recyclerview.widget.RecyclerView>
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Music.HttpGetDemoActivity"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/netmusicbackground">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/activity_music_search_llButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:background="#33E6E6E6"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_play"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="在线播放"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="#33E6E6E6"
|
||||||
|
android:layout_marginRight="30dp"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_pause"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="停止"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="#33E6E6E6"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekBar_playing"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@id/activity_music_search_llButton"
|
||||||
|
android:layout_marginBottom="100dp"
|
||||||
|
android:background="#33E6E6E6"/>
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@mipmap/splash"
|
||||||
|
tools:context=".NetStart">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="@dimen/dimen_90dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="@dimen/dimen_44dp"
|
||||||
|
android:paddingRight="@dimen/dimen_44dp">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_login"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_width="@dimen/dimen_100dp"
|
||||||
|
android:layout_height="@dimen/dimen_40dp"
|
||||||
|
android:text="@string/login"
|
||||||
|
android:textSize="@dimen/size_20sp"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:background="@drawable/shape_login_btn"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_register"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="@dimen/dimen_100dp"
|
||||||
|
android:layout_height="@dimen/dimen_40dp"
|
||||||
|
android:text="@string/register"
|
||||||
|
android:textSize="@dimen/size_20sp"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:background="@drawable/shape_register_btn"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:context=".activity.LoginActivity">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="329dp"
|
||||||
|
android:src="@mipmap/login"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="230dp"
|
||||||
|
android:background="@drawable/shape_login_form"
|
||||||
|
android:paddingLeft="43dp"
|
||||||
|
android:paddingRight="31dp"
|
||||||
|
android:layout_marginLeft="18dp"
|
||||||
|
android:layout_marginRight="18dp"
|
||||||
|
android:layout_marginTop="278dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="43dp"
|
||||||
|
android:paddingEnd="31dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:src="@mipmap/account"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/register_et_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:hint="@string/please_input_account"
|
||||||
|
android:textColorHint="#bcbcbc"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="@null"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:inputType="text" />
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_marginTop="23dp"
|
||||||
|
android:layout_marginBottom="23dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/divide"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:src="@mipmap/password"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/register_et_password"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:hint="@string/please_input_password"
|
||||||
|
android:textColorHint="#bcbcbc"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:layout_marginStart="20dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/register_btn_register"
|
||||||
|
android:layout_marginLeft="18dp"
|
||||||
|
android:layout_marginRight="18dp"
|
||||||
|
android:layout_marginTop="67dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:background="@drawable/shape_register_btn"
|
||||||
|
android:text="@string/register"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|