@ -0,0 +1,15 @@
|
||||
*.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
|
||||
local.properties
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1 @@
|
||||
My Application
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="D:\AndroidStudio\SDK\.android\avd\Pixel_2_API_28.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-06-24T13:03:05.265393400Z" />
|
||||
</component>
|
||||
</project>
|
@ -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="GRADLE" />
|
||||
<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,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven2" />
|
||||
<option name="name" value="maven2" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/google" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/drawable/btn_round_corner.xml" value="0.118" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/drawable/btn_round_primary.xml" value="0.118" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/drawable/btn_round_stroke.xml" value="0.1205" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_contant.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_contant2.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_frends.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_login.xml" value="0.12604166666666666" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_login1.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_main.xml" value="0.264" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_person.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/activity_register.xml" value="0.12395833333333334" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/content_contant.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/layout/fragment_me.xml" value="0.27395833333333336" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/MyApplication6/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.1215" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_contant.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_contant2.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_frends.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_person.xml" value="0.1" />
|
||||
<entry key="..\:/QQDownload/PICTURE SHARING/app/src/main/res/layout/activity_register.xml" value="0.1" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" 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 @@
|
||||
/build
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<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" project-jdk-name="Android Studio default JDK" 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,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app.iml" filepath="$PROJECT_DIR$/.idea/modules/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,50 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.myapplication"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation "com.squareup.okhttp3:okhttp:4.9.3"
|
||||
// implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
// implementation 'com.android.support:recyclerview-v7:29.0.0'
|
||||
//Gson
|
||||
implementation 'com.google.code.gson:gson:2.6.2'
|
||||
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
}
|
@ -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,26 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
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.myapplication", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.myapplication">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="图片分享平台"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:theme="@style/NoTitle"
|
||||
android:networkSecurityConfig="@xml/network_config">
|
||||
<activity android:name=".ContantActivity"></activity>
|
||||
<activity android:name=".FriendsActivity" />
|
||||
<activity android:name=".PersonActivity" />
|
||||
<activity android:name=".MainActivity" />
|
||||
<activity android:name=".RegisterActivity" />
|
||||
<activity android:name=".LoginActivity">
|
||||
<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.project2315.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,29 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
public class BaseResponse<T> {
|
||||
|
||||
public static final Integer CODE_200 = 200;
|
||||
public static final Integer CODE_401 = 401;
|
||||
public static final Integer CODE_404 = 404;
|
||||
public static final Integer CODE_500 = 500;
|
||||
public static final Integer CODE_5217 = 5217;
|
||||
public static final Integer CODE_5311 = 5311;
|
||||
public static final Integer CODE_5314 = 5314;
|
||||
|
||||
private Integer code;
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.example.myapplication;
|
||||
public class Contact {
|
||||
int _id;
|
||||
String uri;
|
||||
byte[] _image;
|
||||
String mes;
|
||||
String name;
|
||||
int account;
|
||||
|
||||
public void setAccount(int account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public int getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public String getMes() {
|
||||
return mes;
|
||||
}
|
||||
|
||||
public void setMes(String mes) {
|
||||
this.mes = mes;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Contact() {
|
||||
|
||||
}
|
||||
|
||||
public Contact(int keyId, String name, byte[] image) {
|
||||
this._id = keyId;
|
||||
this.uri = name;
|
||||
this._image = image;
|
||||
|
||||
}
|
||||
|
||||
public Contact(String name, byte[] image) {
|
||||
this.uri = name;
|
||||
this._image = image;
|
||||
|
||||
}
|
||||
|
||||
public Contact(byte[] image) {
|
||||
this._image = image;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public void setID(int keyId) {
|
||||
this._id = keyId;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
public void setUri(String name) {
|
||||
this.uri = name;
|
||||
}
|
||||
|
||||
public byte[] getImage() {
|
||||
return this._image;
|
||||
}
|
||||
|
||||
public void setImage(byte[] image) {
|
||||
this._image = image;
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DataBaseHandler extends SQLiteOpenHelper {
|
||||
|
||||
private static final int DATABASE_VERSION = 6;
|
||||
private static final String DATABASE_NAME = "imagedb";
|
||||
private static final String TABLE_CONTACTS = "contacts";
|
||||
private static final String KEY_ID = "id";
|
||||
private static final String KEY_NAME = "name";
|
||||
private static final String KEY_IMAGE = "image";
|
||||
private static final String PEOPLE = "people";
|
||||
private static final String MESSAGE = "message";
|
||||
private static final String ACCOUNT = "account";
|
||||
|
||||
|
||||
public DataBaseHandler(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
|
||||
+ KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
|
||||
+ KEY_IMAGE + " BLOB," + PEOPLE + " TEXT," + MESSAGE + " TEXT," + ACCOUNT + " INTEGER" + ")";
|
||||
db.execSQL(CREATE_CONTACTS_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
|
||||
onCreate(db);
|
||||
}
|
||||
|
||||
|
||||
public void addContact(Contact contact) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(KEY_NAME, contact.uri);
|
||||
values.put(KEY_IMAGE, contact._image);
|
||||
values.put(PEOPLE, contact.name);
|
||||
values.put(MESSAGE, contact.mes);
|
||||
values.put(ACCOUNT, contact.account);
|
||||
db.insert(TABLE_CONTACTS, null, values);
|
||||
db.close();
|
||||
}
|
||||
|
||||
// 获取所有contact
|
||||
public List<Contact> getAllContacts() {
|
||||
List<Contact> contactList = new ArrayList<Contact>();
|
||||
String selectQuery = "SELECT * FROM contacts ORDER BY name";
|
||||
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor cursor = db.rawQuery(selectQuery, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
Contact contact = new Contact();
|
||||
contact.setID(Integer.parseInt(cursor.getString(0)));
|
||||
contact.setUri(cursor.getString(1));
|
||||
contact.setImage(cursor.getBlob(2));
|
||||
contact.setName(cursor.getString(3));
|
||||
contact.setMes(cursor.getString(4));
|
||||
contact.setAccount(Integer.parseInt(cursor.getString(5)));
|
||||
contactList.add(contact);
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
db.close();
|
||||
return contactList;
|
||||
|
||||
}
|
||||
|
||||
// Updating single contact
|
||||
public int updateContact(Contact contact) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(KEY_NAME, contact.uri);
|
||||
values.put(KEY_IMAGE, contact._image);
|
||||
values.put(PEOPLE, contact.name);
|
||||
values.put(MESSAGE, contact.mes);
|
||||
values.put(ACCOUNT, contact.account);
|
||||
// updating row
|
||||
return db.update(TABLE_CONTACTS, values, KEY_ID + " = ?",
|
||||
new String[]{String.valueOf(contact.getID())});
|
||||
|
||||
}
|
||||
|
||||
public void deleteContact(Contact contact) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
db.delete(TABLE_CONTACTS, KEY_ID + " = ?",
|
||||
new String[]{String.valueOf(contact.getID())});
|
||||
db.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FriendsActivity extends AppCompatActivity {
|
||||
|
||||
private LinearLayout firstLl;
|
||||
private LinearLayout secondLl;
|
||||
private TextView name;
|
||||
private TextView sex;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_frends);
|
||||
|
||||
name = findViewById(R.id.name);
|
||||
sex = findViewById(R.id.sex);
|
||||
firstLl = findViewById(R.id.people_first);
|
||||
secondLl = findViewById(R.id.people_second);
|
||||
|
||||
int isPerson = getIntent().getIntExtra("isperson", 0);
|
||||
if (isPerson != 1) {
|
||||
secondLl.setVisibility(View.GONE);
|
||||
firstLl.setVisibility(View.VISIBLE);
|
||||
name.setText(getIntent().getStringExtra("name"));
|
||||
sex.setText(getIntent().getStringExtra("sex"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = LoginActivity.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login1);
|
||||
|
||||
AppCompatButton btnSignIn = findViewById(R.id.btn_signin);
|
||||
AppCompatButton btnSignUp = findViewById(R.id.btn_signup);
|
||||
|
||||
|
||||
EditText etUserName = findViewById(R.id.et_username);
|
||||
EditText etPassword = findViewById(R.id.et_password);
|
||||
|
||||
btnSignIn.setOnClickListener(v -> {
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
String userName = etUserName.getText().toString();
|
||||
String password = etPassword.getText().toString();
|
||||
|
||||
Request request = new LoginRequest(userName, password).build();
|
||||
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override public void onResponse(Call call, Response response) throws IOException {
|
||||
try {
|
||||
ResponseBody responseBody = response.body();
|
||||
String body = responseBody.string();
|
||||
|
||||
Log.d(TAG, body);
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
} else {
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC).create();
|
||||
|
||||
Type baseResponseType = new TypeToken<BaseResponse<LoginResponse>>() {}.getType();
|
||||
|
||||
BaseResponse<LoginResponse> baseResponse = gson.fromJson(body, baseResponseType);
|
||||
|
||||
if (baseResponse.getCode().equals(BaseResponse.CODE_200)) {
|
||||
LoginResponse loginResponse = baseResponse.getData();
|
||||
String loginResponseString = gson.toJson(loginResponse);
|
||||
Log.d(TAG, "login response: " + loginResponseString);
|
||||
|
||||
ToastInstance.getInstance().show(LoginActivity.this, "Welcome back, " + loginResponse.getUserName(), Toast.LENGTH_LONG);
|
||||
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
} else if (baseResponse.getCode().equals(BaseResponse.CODE_500)) {
|
||||
ToastInstance.getInstance().show(LoginActivity.this, "username or password incorrect!", Toast.LENGTH_LONG);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
btnSignUp.setOnClickListener(new View.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class LoginRequest {
|
||||
|
||||
private Request request;
|
||||
|
||||
private String userName;
|
||||
private String password;
|
||||
private Headers headers;
|
||||
|
||||
private String userNameKey = "username";
|
||||
private String passwordKey = "password";
|
||||
|
||||
private String params;
|
||||
|
||||
public LoginRequest(String userName, String password) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.params = "?" + userNameKey + "=" + userName
|
||||
+ "&" + passwordKey + "=" + password;
|
||||
}
|
||||
|
||||
public Request build() {
|
||||
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create("", mediaType);
|
||||
|
||||
request = new Request.Builder()
|
||||
.url(UrlConstant.getLoginUrl() + params)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader(UrlConstant.AppIdKey, UrlConstant.AppId)
|
||||
.addHeader(UrlConstant.AppSecretKey, UrlConstant.AppSecret)
|
||||
.build();
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class LoginResponse {
|
||||
private String appKey;
|
||||
|
||||
private BigInteger id;
|
||||
|
||||
@SerializedName("username")
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
@SerializedName("sex")
|
||||
private Integer sexCode;
|
||||
|
||||
private String avatar;
|
||||
@SerializedName("introduce")
|
||||
private String introduction;
|
||||
|
||||
private BigInteger createTime;
|
||||
private BigInteger lastUpdateTime;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class LoginResponseB {
|
||||
/*
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "登录成功",
|
||||
"data": {
|
||||
"id": "1534026874529910784",
|
||||
"appKey": "7e7ef16381b147e6b211665b557259a7",
|
||||
"username": "balabala",
|
||||
"password": null,
|
||||
"sex": null,
|
||||
"introduce": null,
|
||||
"avatar": null,
|
||||
"createTime": "1654575482386",
|
||||
"lastUpdateTime": "1654575482386"
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
String msg;
|
||||
int code;
|
||||
|
||||
LoginResponseInner data;
|
||||
|
||||
public class LoginResponseInner {
|
||||
private String appKey;
|
||||
|
||||
private BigInteger id;
|
||||
|
||||
@SerializedName("username")
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
@SerializedName("sex")
|
||||
private Integer sexCode;
|
||||
|
||||
private String avatar;
|
||||
@SerializedName("introduce")
|
||||
private String introduction;
|
||||
|
||||
private BigInteger createTime;
|
||||
private BigInteger lastUpdateTime;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,283 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.media.ExifInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
public static final int TAKE_PHOTO = 1;
|
||||
public static final int CHOOSE_PHOTO = 0;
|
||||
AlertDialog.Builder builder = null;
|
||||
private File cameraFile;
|
||||
private FrameLayout frameLayout;
|
||||
private RecyclerView recyclerView;
|
||||
private RecycleAdapter adapter;
|
||||
private FloatingActionButton button;
|
||||
private Button delete;
|
||||
private Button person;
|
||||
private Button friends;
|
||||
private Uri imageUri;
|
||||
private ArrayList<Contact> imageArry = new ArrayList<Contact>();
|
||||
private DataBaseHandler db;
|
||||
private static File mPhotoFile = null;
|
||||
private Map<String, Object> map;
|
||||
private boolean isLove = false;
|
||||
private int isPerson;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
map = new HashMap<>();
|
||||
SharedPreferences data = getSharedPreferences("data", Context.MODE_PRIVATE);
|
||||
isPerson = data.getInt("isperson",1);
|
||||
if (isPerson == 1) {
|
||||
SharedPreferences sh = getSharedPreferences("mes", Context.MODE_PRIVATE);
|
||||
map.put("name", sh.getString("name", ""));
|
||||
map.put("sex", sh.getString("sex", ""));
|
||||
map.put("city", sh.getString("city", ""));
|
||||
} else {
|
||||
map.put("name", "马菁泽");
|
||||
map.put("sex", "男");
|
||||
map.put("city", "广西桂林");
|
||||
}
|
||||
initView();
|
||||
updateFromDb();
|
||||
if (isEmpty(imageArry)) {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateFromDb() {
|
||||
List<Contact> contacts = db.getAllContacts();
|
||||
for (Contact cn : contacts) {
|
||||
imageArry.add(cn);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
|
||||
|
||||
//frameLayout = findViewById(R.id.no_image);
|
||||
db = new DataBaseHandler(this);
|
||||
recyclerView = findViewById(R.id.recycle_view);
|
||||
button = findViewById(R.id.bt_photo);
|
||||
//delete = findViewById(R.id.bt__delete);
|
||||
//person = findViewById(R.id.person_message);
|
||||
//friends = findViewById(R.id.friends);
|
||||
adapter = new RecycleAdapter(imageArry);
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
// person.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// map.put("key", "1");
|
||||
// Intent intent = new Intent(MainActivity.this, PersonActivity.class);
|
||||
// intent.putExtra("mes", (Serializable) map);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
|
||||
// friends.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// SharedPreferences sh = getSharedPreferences("mes", Context.MODE_PRIVATE);
|
||||
// Intent intent = new Intent(MainActivity.this, FriendsActivity.class);
|
||||
// intent.putExtra("isperson",isPerson);
|
||||
// intent.putExtra("name",sh.getString("name",""));
|
||||
// intent.putExtra("sex",sh.getString("sex",""));
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// delete.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// List<Contact> contacts = db.getAllContacts();
|
||||
// for (Contact cn : contacts) {
|
||||
// db.deleteContact(cn);
|
||||
// }
|
||||
// upDateList();
|
||||
// Toast.makeText(MainActivity.this, "清空数据库成功!", Toast.LENGTH_SHORT).show();
|
||||
// startActivity(new Intent(MainActivity.this, MainActivity.class));
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MainActivity.this, ContantActivity.class);
|
||||
intent.putExtra("name", (String) map.get("name"));
|
||||
Log.w("ssssssssssssssssssssss", "button: "+map);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
adapter.setOnLoveClickListener(new RecycleAdapter.OnLoveClickListener() {
|
||||
@Override
|
||||
public void onClick(int position, ImageView imageLove) {
|
||||
if (!isLove) {
|
||||
imageLove.setImageResource(R.mipmap.ic_love_have);
|
||||
Contact contact = new Contact();
|
||||
contact = imageArry.get(position);
|
||||
contact.setAccount((contact.getAccount()) + 1);
|
||||
db.updateContact(contact);
|
||||
imageLove.setEnabled(false);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
adapter.setOnItemLongClickListener(new RecycleAdapter.OnItemLongClickListener() {
|
||||
@Override
|
||||
public void onClick(int position) {
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(imageArry.get(position)._image, 0, imageArry.get(position)._image.length);
|
||||
saveBitmap(getApplicationContext(), bitmap, "aa");
|
||||
}
|
||||
});
|
||||
TabLayout tabLayout = findViewById(R.id.tabLayout);
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
int position = tab.getPosition();
|
||||
LinearLayout layout = findViewById(R.id.personLayout);
|
||||
switch (position)
|
||||
{
|
||||
case 0:
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
layout.setVisibility(View.INVISIBLE);
|
||||
break;
|
||||
case 1 :
|
||||
recyclerView.setVisibility(View.INVISIBLE);
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void saveBitmap(Context context, Bitmap bm, String picName) {
|
||||
try {
|
||||
String dir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/renji/" + picName + ".jpg";
|
||||
File f = new File(dir);
|
||||
if (!f.exists()) {
|
||||
f.getParentFile().mkdirs();
|
||||
f.createNewFile();
|
||||
}
|
||||
FileOutputStream out = new FileOutputStream(f);
|
||||
bm.compress(Bitmap.CompressFormat.PNG, 90, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
Uri uri = Uri.fromFile(f);
|
||||
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
intent.setData(uri);
|
||||
context.sendBroadcast(intent);
|
||||
Toast.makeText(context, "图片保存成功!", Toast.LENGTH_SHORT).show();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(context, "图片保存失败!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
/*private void upDateList() {
|
||||
if (isEmpty(imageArry)) {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
} else {
|
||||
frameLayout.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}*/
|
||||
|
||||
private Boolean isEmpty(List<Contact> images) {
|
||||
if (images.size() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (!isEmpty(imageArry)) {
|
||||
}
|
||||
upDateList();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PersonActivity extends AppCompatActivity {
|
||||
|
||||
private EditText nameEt;
|
||||
private EditText sexEt;
|
||||
private EditText cityEt;
|
||||
private Button button;
|
||||
private SharedPreferences.Editor editor;
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_person);
|
||||
|
||||
initView();
|
||||
sharedPreferences = getSharedPreferences("mes", MODE_PRIVATE);
|
||||
editor = sharedPreferences.edit();
|
||||
Map<String, Object> map = (Map<String, Object>) getIntent().getSerializableExtra("mes");
|
||||
if (map != null) {
|
||||
if ("1".equals(map.get("key"))) {
|
||||
button.setVisibility(View.GONE);
|
||||
button.setEnabled(false);
|
||||
nameEt.setEnabled(false);
|
||||
sexEt.setEnabled(false);
|
||||
cityEt.setEnabled(false);
|
||||
nameEt.setText(String.valueOf(map.get("name")));
|
||||
sexEt.setText(String.valueOf(map.get("sex")));
|
||||
cityEt.setText(String.valueOf(map.get("city")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
nameEt = findViewById(R.id.tv_modify_name);
|
||||
sexEt = findViewById(R.id.tv_modify_sex);
|
||||
cityEt = findViewById(R.id.tv_city);
|
||||
button = findViewById(R.id.bt_save);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
editor.putString("name", nameEt.getText().toString());
|
||||
editor.putString("sex", sexEt.getText().toString());
|
||||
editor.putString("city", cityEt.getText().toString());
|
||||
editor.apply();
|
||||
Intent intent = new Intent(PersonActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.text.Layout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<Contact> imageArry;
|
||||
private OnItemLongClickListener longClickListener;
|
||||
private OnLoveClickListener loveClickListener;
|
||||
|
||||
|
||||
public interface OnItemLongClickListener {
|
||||
void onClick(int position);
|
||||
}
|
||||
|
||||
public interface OnLoveClickListener {
|
||||
void onClick(int position, ImageView imageLove);
|
||||
}
|
||||
|
||||
|
||||
public void setOnLoveClickListener(OnLoveClickListener listener) {
|
||||
loveClickListener = listener;
|
||||
}
|
||||
|
||||
|
||||
public void setOnItemLongClickListener(OnItemLongClickListener longClickListener) {
|
||||
this.longClickListener = longClickListener;
|
||||
}
|
||||
|
||||
public RecycleAdapter(ArrayList<Contact> imageArry) {
|
||||
this.imageArry = imageArry;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false);
|
||||
ViewHolder holder = new ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Contact picture = imageArry.get(position);
|
||||
byte[] outImage = picture._image;
|
||||
ByteArrayInputStream imageStream = new ByteArrayInputStream(outImage);
|
||||
Bitmap theImage = BitmapFactory.decodeStream(imageStream);
|
||||
holder.imageView.setImageBitmap(theImage);
|
||||
holder.nameTv.setText(picture.getName());
|
||||
holder.content.setText(picture.getMes());
|
||||
holder.accountTv.setText(String.valueOf(picture.account));
|
||||
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (longClickListener != null) {
|
||||
longClickListener.onClick(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.imageLove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (loveClickListener != null) {
|
||||
loveClickListener.onClick(position, holder.imageLove);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return imageArry.size();
|
||||
}
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView imageView;
|
||||
private ImageView imageLove;
|
||||
private TextView nameTv;
|
||||
private TextView accountTv;
|
||||
private TextView content;
|
||||
private View view;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
view = itemView;
|
||||
imageView = view.findViewById(R.id.image);
|
||||
content = view.findViewById(R.id.tv_content);
|
||||
imageLove = view.findViewById(R.id.iv_love);
|
||||
accountTv = view.findViewById(R.id.love_account);
|
||||
nameTv = view.findViewById(R.id.message_name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = RegisterActivity.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
AppCompatButton btnSignUp = findViewById(R.id.btn_signup2);
|
||||
|
||||
EditText etUserName = findViewById(R.id.et_username);
|
||||
EditText etPassword = findViewById(R.id.et_password);
|
||||
EditText etConfirmPassword = findViewById(R.id.et_confirm_password);
|
||||
|
||||
AppCompatTextView tvBackToSignIn = findViewById(R.id.tv_backto_signin);
|
||||
|
||||
btnSignUp.setOnClickListener(v -> {
|
||||
|
||||
|
||||
String userName = etUserName.getText().toString();
|
||||
String password = etPassword.getText().toString();
|
||||
String confirmPassword = etConfirmPassword.getText().toString();
|
||||
|
||||
if (!password.equals(confirmPassword)) {
|
||||
ToastInstance.getInstance()
|
||||
.show(RegisterActivity.this, "password unmatched!", Toast.LENGTH_LONG);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
Request request = new RegisterRequest(userName, password).build();
|
||||
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override public void onResponse(Call call, Response response) throws IOException {
|
||||
try {
|
||||
ResponseBody responseBody = response.body();
|
||||
String body = responseBody.string();
|
||||
|
||||
Log.d(TAG, body);
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
} else {
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC).create();
|
||||
|
||||
Type baseResponseType = new TypeToken<BaseResponse<String>>() {}.getType();
|
||||
|
||||
BaseResponse<String> baseResponse = gson.fromJson(body, baseResponseType);
|
||||
|
||||
if (baseResponse.getCode().equals(BaseResponse.CODE_200)) {
|
||||
String loginResponse = baseResponse.getData();
|
||||
|
||||
ToastInstance.getInstance().show(RegisterActivity.this, "Welcome, " + userName, Toast.LENGTH_LONG);
|
||||
|
||||
finish();
|
||||
|
||||
} else if (baseResponse.getCode().equals(BaseResponse.CODE_500)) {
|
||||
ToastInstance.getInstance().show(RegisterActivity.this, "username or password incorrect!", Toast.LENGTH_LONG);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
tvBackToSignIn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class RegisterRequest {
|
||||
|
||||
private Request request;
|
||||
|
||||
@SerializedName("username")
|
||||
private String userName;
|
||||
private String password;
|
||||
|
||||
public RegisterRequest(String userName, String password) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Request build() {
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC).create();
|
||||
|
||||
String requestBody = gson.toJson(this);
|
||||
RequestBody body = RequestBody.create(requestBody, mediaType);
|
||||
|
||||
request = new Request.Builder()
|
||||
.url(UrlConstant.getRegisterUrl())
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader(UrlConstant.AppIdKey, UrlConstant.AppId)
|
||||
.addHeader(UrlConstant.AppSecretKey, UrlConstant.AppSecret)
|
||||
.build();
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
public class RegisterResponse {
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class ToastInstance {
|
||||
private static ToastInstance instance = new ToastInstance();
|
||||
|
||||
public static ToastInstance getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ToastInstance();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private ToastInstance() {
|
||||
}
|
||||
|
||||
public void show(Activity activity, String text, int duration) {
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(activity, text, duration).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.example.myapplication;
|
||||
|
||||
import okhttp3.Headers;
|
||||
|
||||
public final class UrlConstant {
|
||||
public static final String BaseURL = "http://47.107.52.7:88";
|
||||
public static final String LoginPath = "/member/photo/user/login";
|
||||
public static final String RegisterPath = "/member/photo/user/register";
|
||||
public static final String UploadPhotosPath = "/member/photo/image/upload";
|
||||
public static final String PublishPhotosPath = "/member/photo/share/add";
|
||||
public static final String PhotosPath = "/member/photo/share";
|
||||
|
||||
public static final String AppId = "0b8b6fd7bb8e485da72c9186652c9b85";
|
||||
public static final String AppSecret = "6733365198f66a27f4f5eb2707ebc55247a8c";
|
||||
|
||||
public static final String AppIdKey = "appId";
|
||||
public static final String AppSecretKey = "appSecret";
|
||||
|
||||
|
||||
public Headers headers = new Headers.Builder()
|
||||
.add(AppIdKey, AppId)
|
||||
.add(AppSecretKey, AppSecret)
|
||||
.add("Content-Type", "application/json")
|
||||
.build();
|
||||
|
||||
public static String getLoginUrl() {
|
||||
return BaseURL + LoginPath;
|
||||
}
|
||||
|
||||
public static String getUploadPhotosUrl() {
|
||||
return BaseURL + UploadPhotosPath;
|
||||
}
|
||||
|
||||
public static String getPublishPhotosUrl() {
|
||||
return BaseURL + PublishPhotosPath;
|
||||
}
|
||||
|
||||
public static String getPhotosUrl() {
|
||||
return BaseURL + PhotosPath;
|
||||
}
|
||||
|
||||
public static String getRegisterUrl() {
|
||||
return BaseURL + RegisterPath;
|
||||
}
|
||||
|
||||
public Headers getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
}
|
@ -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>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/colorButtonActiveUnchecked"/>
|
||||
<corners android:radius="25dp"/>
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="25dp"/>
|
||||
<solid android:color="#9E9E9E"/>
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/EDgreyLightBlackBackground"/>
|
||||
<corners android:radius="25dp"/>
|
||||
</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="20dp" />
|
||||
<solid android:color="#4DFFFFFF" />
|
||||
</shape>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/white" />
|
||||
<stroke android:color="@color/white" android:width="2dp"/>
|
||||
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/purple_200" />
|
||||
<stroke android:color="@color/white" android:width="1dp"/>
|
||||
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M21,3H3C2,3 1,4 1,5v14c0,1.1 0.9,2 2,2h18c1,0 2,-1 2,-2V5c0,-1 -1,-2 -2,-2zM5,17l3.5,-4.5 2.5,3.01L14.5,11l4.5,6H5z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 222 B |
@ -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: 1.1 KiB |
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".ContantActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/NoTitle.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/NoTitle.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_contant" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -0,0 +1,123 @@
|
||||
<?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"
|
||||
android:background="@color/lightBlackBackground"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginRight="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_head"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:src="@mipmap/photo1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nick_name"
|
||||
style="@style/TextNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@+id/iv_head"
|
||||
android:text="马菁泽"
|
||||
android:textSize="14dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_content"
|
||||
style="@style/TextNormal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@null"
|
||||
android:hint="写你所想..." />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_photo_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
android:weightSum="3"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="20dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_photo_9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="105dp"
|
||||
android:layout_margin="3dp"
|
||||
android:layout_weight="1"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/ic_take_photo"
|
||||
android:scaleType="centerCrop" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_delete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/rl_photo"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt__share"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@color/colorButtonActiveUnchecked"
|
||||
android:text="分享"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/people_second"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/photo1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_marginStart="23dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:text="马菁泽"
|
||||
style="@style/TextNormal"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="11sp"
|
||||
android:text="男"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginTop="3dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/people_first"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/photo2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_marginStart="23dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:text="张三"
|
||||
style="@style/TextNormal"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="11sp"
|
||||
android:text="男"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginTop="3dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,94 @@
|
||||
<?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=".LoginActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@mipmap/img_05"
|
||||
android:scaleType="fitXY"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#CCF8F8F8"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_signin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="68dp"
|
||||
android:text="登 录"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_username"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:textSize="18sp"
|
||||
android:hint="用户名"
|
||||
android:textColor="@color/black"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_signin"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_password"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:textSize="18sp"
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/black"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_username"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_signin"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:text="登录"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:background="@drawable/btn_round_primary"
|
||||
app:layout_constraintStart_toStartOf="@id/btn_signup"
|
||||
app:layout_constraintEnd_toEndOf="@id/btn_signup"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_signup"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_signup"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="68dp"
|
||||
android:textColor="@color/black"
|
||||
android:background="@drawable/btn_round_stroke"
|
||||
android:textSize="20sp"
|
||||
android:text="注册"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,239 @@
|
||||
<?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:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".MainActivity" >
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="主页" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="个人" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycle_view"
|
||||
android:layout_width="416dp"
|
||||
android:layout_height="566dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/bt_photo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clickable="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tabLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.997"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:srcCompat="@android:drawable/ic_menu_upload" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/personLayout"
|
||||
android:layout_width="411dp"
|
||||
android:layout_height="681dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/imageview_me_thumb"
|
||||
android:layout_width="62dp"
|
||||
android:layout_height="62dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:src="@mipmap/user_thumb_5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_me_user"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="迪丽热巴"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toEndOf="@id/imageview_me_thumb"
|
||||
app:layout_constraintTop_toTopOf="@id/imageview_me_thumb" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_me_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="id:20201008"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_me_user"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_me_user" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/imageview_gender"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:src="@mipmap/gender_female"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_me_id"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_me_id" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_me_level"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Lv 4"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toEndOf="@id/imageview_gender"
|
||||
app:layout_constraintTop_toTopOf="@id/imageview_gender" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/button_edit"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:text="编辑资料"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/textview_me_user" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_slogon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="这个人很懒,什么都没留下。"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/button_edit"
|
||||
app:layout_constraintStart_toStartOf="@id/imageview_me_thumb"
|
||||
app:layout_constraintTop_toBottomOf="@id/imageview_me_thumb" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="64dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="64dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_slogon">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_subscribed_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="3"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="关注"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/textview_subscribed_count"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_subscribed_count"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_subscribed_count" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_fans_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="361w"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="粉丝"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/textview_fans_count"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_fans_count"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_fans_count" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textview_liked_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="235.8w"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="获赞"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/textview_liked_count"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_liked_count"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_liked_count" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,163 @@
|
||||
<?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"
|
||||
android:orientation="vertical"
|
||||
tools:context=".PersonActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/modify_profile_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:src="@mipmap/photo1" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@color/background_gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/lightBlackBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_nick_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13.5dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_modify_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="昵称"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tv_modify_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="37.5dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/user_modify_name"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/user_modify_name"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_modify_name_enter"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginRight="12.5dp"
|
||||
android:src="@drawable/ic_enter_icon_petname"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13.5dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uer_modify_sex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="性别"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tv_modify_sex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="37.5dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/uer_modify_sex"
|
||||
app:layout_constraintLeft_toRightOf="@+id/uer_modify_sex"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13.5dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uer_city"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="城市"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tv_city"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="37.5dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/uer_city"
|
||||
app:layout_constraintLeft_toRightOf="@+id/uer_city"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/rl_friends"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/colorButtonActiveUnchecked"
|
||||
android:text="保存"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:visibility="visible"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,111 @@
|
||||
<?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=".LoginActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@mipmap/img_019"
|
||||
android:scaleType="fitXY"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/transPrimary"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_signin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="68dp"
|
||||
android:text="注 册"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_username"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="134dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:textSize="18sp"
|
||||
android:hint="用户名"
|
||||
android:textColor="@color/white"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_password"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:textSize="18sp"
|
||||
android:hint="输入密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/white"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_username"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_confirm_password"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/btn_round_corner"
|
||||
android:textSize="18sp"
|
||||
android:hint="确认密码"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="@color/white"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_password"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_signup2"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="122dp"
|
||||
android:text="注册"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:background="@drawable/btn_round_primary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_backto_signin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="16sp"
|
||||
android:text="返回登录"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_signup2"
|
||||
app:layout_constraintStart_toStartOf="@id/btn_signup2"
|
||||
app:layout_constraintEnd_toEndOf="@id/btn_signup2"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,6 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"></androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,85 @@
|
||||
<?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"
|
||||
android:id="@+id/ll_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fans_image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="23dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_bus_time1" />
|
||||
<TextView
|
||||
android:id="@+id/message_name"
|
||||
style="@style/TextNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="12321321321" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
style="@style/TextNormal"
|
||||
android:maxLines="4"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginRight="23dp"
|
||||
android:layout_marginLeft="23dp"
|
||||
android:ellipsize="end"
|
||||
android:textSize="14sp" app:layout_constraintTop_toBottomOf="@+id/ll_message"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:src="@mipmap/photo1"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_love"
|
||||
android:layout_width="22.5dp"
|
||||
android:layout_height="22.5dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/icon_praising"
|
||||
app:layout_constraintRight_toLeftOf="@+id/love_account"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/love_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:text="0"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 938 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 874 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 995 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 478 KiB |
After Width: | Height: | Size: 530 KiB |
After Width: | Height: | Size: 865 KiB |
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 751 KiB |
After Width: | Height: | Size: 516 KiB |
After Width: | Height: | Size: 598 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 483 KiB |
After Width: | Height: | Size: 487 KiB |
After Width: | Height: | Size: 513 KiB |
After Width: | Height: | Size: 470 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 27 KiB |