Compare commits
No commits in common. 'master' and 'ongbodev' have entirely different histories.
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>paz2s9bc5</name>
|
||||
<comment>Project paz2s9bc5 created by Buildship.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,2 +0,0 @@
|
||||
connection.project.dir=
|
||||
eclipse.preferences.version=1
|
@ -1,165 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.3" />
|
||||
<option name="LAST_KNOWN_AGP_VERSION" value="3.5.3" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
|
||||
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.ext:junit:1.1.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-core:3.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:runner:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:core:1.1.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.hankcs:hanlp:portable-1.7.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:4.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:gifdecoder:4.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.alibaba:fastjson:1.2.62@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.flaviofaria:kenburnsview:1.0.7@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:disklrucache:4.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:annotations:4.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.material:material:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.loopeer.library:cardstack:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.hanks.animatecheckbox:library:0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.johnpersano:supertoasts:2.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: liji.library.dev:citypickerview:5.1.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.florent37:materialviewpager:1.2.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.ramotion.foldingcell:folding-cell:1.2.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cardview:cardview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jpardogo.materialtabstrip:library:1.1.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.transition:transition:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.media:media:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.dmytrodanylyk.circular-progress-button:library:1.1.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.open-android:WheelPicker:v1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: cn.aigestudio.wheelpicker:WheelPicker:1.1.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: de.hdodenhof:circleimageview:2.2.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.ybq:Android-SpinKit:1.4.0@aar" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,166 @@
|
||||
package com.example.ChatContentPkg;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.loopeer.cardstack.CardStackView;
|
||||
import com.loopeer.cardstack.StackAdapter;
|
||||
|
||||
public class DrugFriendsCardAdapter extends StackAdapter<Integer> {
|
||||
AppCompatActivity appCompatActivity;
|
||||
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
|
||||
public DrugFriendsCardAdapter(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(Integer data, int position, CardStackView.ViewHolder holder) {
|
||||
if (holder instanceof ColorItemLargeHeaderViewHolder) {
|
||||
ColorItemLargeHeaderViewHolder h = (ColorItemLargeHeaderViewHolder) holder;
|
||||
h.onBind(data, position);
|
||||
}
|
||||
if (holder instanceof ColorItemWithNoHeaderViewHolder) {
|
||||
ColorItemWithNoHeaderViewHolder h = (ColorItemWithNoHeaderViewHolder) holder;
|
||||
h.onBind(data, position);
|
||||
}
|
||||
if (holder instanceof ColorItemViewHolder) {
|
||||
ColorItemViewHolder h = (ColorItemViewHolder) holder;
|
||||
h.onBind(data, position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CardStackView.ViewHolder onCreateView(ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
switch (viewType) {
|
||||
case R.layout.list_card_item_larger_header:
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_card_item_larger_header, parent, false);
|
||||
// view = getLayoutInflater().inflate(R.layout.list_card_item_larger_header, parent, false);
|
||||
return new ColorItemLargeHeaderViewHolder(view);
|
||||
case R.layout.list_card_item_with_no_header:
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_card_item_with_no_header, parent, false);
|
||||
// view = getLayoutInflater().inflate(R.layout.list_card_item_with_no_header, parent, false);
|
||||
return new ColorItemWithNoHeaderViewHolder(view);
|
||||
default:
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_card_item, parent, false);
|
||||
// view = getLayoutInflater().inflate(R.layout.list_card_item, parent, false);
|
||||
return new ColorItemViewHolder(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// if (position == 6) {//TODO TEST LARGER ITEM
|
||||
// return R.layout.list_card_item_larger_header;
|
||||
// } else if (position == 10) {
|
||||
// return R.layout.list_card_item_with_no_header;
|
||||
// }else {
|
||||
return R.layout.list_card_item;
|
||||
// }
|
||||
}
|
||||
|
||||
//三种ViewHolder
|
||||
public class ColorItemViewHolder extends CardStackView.ViewHolder {
|
||||
View mLayout;
|
||||
View mContainerContent;
|
||||
TextView mTextTitle;
|
||||
|
||||
public ColorItemViewHolder(View view) {
|
||||
super(view);
|
||||
mLayout = view.findViewById(R.id.frame_list_card_item);
|
||||
mContainerContent = view.findViewById(R.id.container_list_content);
|
||||
mTextTitle = (TextView) view.findViewById(R.id.text_list_card_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemExpand(boolean b) {
|
||||
mContainerContent.setVisibility(b ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void onBind(Integer data, int position) {
|
||||
|
||||
mLayout.getBackground().setColorFilter(ContextCompat.getColor(appCompatActivity, data), PorterDuff.Mode.SRC_IN);
|
||||
mTextTitle.setText("这是分组");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ColorItemWithNoHeaderViewHolder extends CardStackView.ViewHolder {
|
||||
View mLayout;
|
||||
TextView mTextTitle;
|
||||
|
||||
public ColorItemWithNoHeaderViewHolder(View view) {
|
||||
super(view);
|
||||
mLayout = view.findViewById(R.id.frame_list_card_item);
|
||||
mTextTitle = (TextView) view.findViewById(R.id.text_list_card_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemExpand(boolean b) {
|
||||
}
|
||||
|
||||
public void onBind(Integer data, int position) {
|
||||
mLayout.getBackground().setColorFilter(ContextCompat.getColor(getContext(), data), PorterDuff.Mode.SRC_IN);
|
||||
mTextTitle.setText(String.valueOf(position));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ColorItemLargeHeaderViewHolder extends CardStackView.ViewHolder {
|
||||
View mLayout;
|
||||
View mContainerContent;
|
||||
TextView mTextTitle;
|
||||
|
||||
public ColorItemLargeHeaderViewHolder(View view) {
|
||||
super(view);
|
||||
mLayout = view.findViewById(R.id.frame_list_card_item);
|
||||
mContainerContent = view.findViewById(R.id.container_list_content);
|
||||
mTextTitle = (TextView) view.findViewById(R.id.text_list_card_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemExpand(boolean b) {
|
||||
mContainerContent.setVisibility(b ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAnimationStateChange(int state, boolean willBeSelect) {
|
||||
super.onAnimationStateChange(state, willBeSelect);
|
||||
if (state == CardStackView.ANIMATION_STATE_START && willBeSelect) {
|
||||
onItemExpand(true);
|
||||
}
|
||||
if (state == CardStackView.ANIMATION_STATE_END && !willBeSelect) {
|
||||
onItemExpand(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBind(Integer data, int position) {
|
||||
mLayout.getBackground().setColorFilter(ContextCompat.getColor(getContext(), data), PorterDuff.Mode.SRC_IN);
|
||||
mTextTitle.setText(String.valueOf(position));
|
||||
|
||||
itemView.findViewById(R.id.text_view).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CardStackView) itemView.getParent()).performItemClick(ColorItemLargeHeaderViewHolder.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.example.ChatContentPkg;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.loopeer.cardstack.CardStackView;
|
||||
import com.ramotion.foldingcell.FoldingCell;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RecyclerViewPagerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
List<Object> contents;
|
||||
int flag;
|
||||
AppCompatActivity appCompatActivity;
|
||||
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
|
||||
public RecyclerViewPagerAdapter(List<Object> contents, int flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
this.contents = contents;
|
||||
}
|
||||
public int getItemCount() {
|
||||
return contents.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
|
||||
View view = null;
|
||||
switch (flag){
|
||||
case 0://论坛
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.internetforumfragment, parent, false);
|
||||
//
|
||||
// view = LayoutInflater.from(parent.getContext()).inflate(R.layout.drug_friends,parent,false);
|
||||
FoldingCell foldingCell = view.findViewById(R.id.folding_cell);
|
||||
foldingCell.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
foldingCell.toggle(false);
|
||||
}
|
||||
});
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
};
|
||||
|
||||
|
||||
case 1://动态
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.content_cardview, parent, false);
|
||||
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
};
|
||||
|
||||
case 2://好友列表
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.drug_friends,parent,false);
|
||||
CardStackView cardStackView = view.findViewById(R.id.stackview);
|
||||
Integer[] item = new Integer[]{R.color.color_1,
|
||||
R.color.color_2,
|
||||
R.color.color_3,
|
||||
R.color.color_4,
|
||||
R.color.color_5,
|
||||
R.color.color_6,
|
||||
R.color.color_7,
|
||||
R.color.color_8,
|
||||
R.color.color_9,
|
||||
R.color.color_10,
|
||||
R.color.color_11,
|
||||
R.color.color_12,
|
||||
R.color.color_13,
|
||||
R.color.color_14,
|
||||
R.color.color_15,
|
||||
R.color.color_16,
|
||||
R.color.color_17,
|
||||
R.color.color_18,
|
||||
R.color.color_19,
|
||||
R.color.color_20,
|
||||
R.color.color_21,
|
||||
R.color.color_22,
|
||||
R.color.color_23,
|
||||
R.color.color_24,
|
||||
R.color.color_25,
|
||||
R.color.color_26};
|
||||
DrugFriendsCardAdapter drugFriendsCardAdapter = new DrugFriendsCardAdapter(parent.getContext());
|
||||
drugFriendsCardAdapter.setAppCompatActivity(appCompatActivity);
|
||||
|
||||
cardStackView.setAdapter(drugFriendsCardAdapter);
|
||||
cardStackView.setItemExpendListener(new CardStackView.ItemExpendListener() {
|
||||
@Override
|
||||
public void onItemExpend(boolean expend) {
|
||||
|
||||
}
|
||||
});
|
||||
// cardStackView.setAnimatorAdapter(new AllMoveDownAnimatorAdapter(cardStackView));
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
drugFriendsCardAdapter.updateData(Arrays.asList(item));
|
||||
}
|
||||
},200);
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
//在这里设置某一个条目的监听
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.example.ChatContentPkg;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.ramotion.foldingcell.FoldingCell;
|
||||
|
||||
public class internetforum_fragment extends Fragment {
|
||||
public static Fragment newInstance(){return new internetforum_fragment();}
|
||||
FoldingCell foldingCell;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.internetforumfragment, container, false);
|
||||
foldingCell = view.findViewById(R.id.folding_cell);
|
||||
foldingCell.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
foldingCell.toggle(false);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.example.HomeContent;
|
||||
|
||||
|
||||
/*
|
||||
* 保存药文推送信息的一些信息bean
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
public class SlideBean {
|
||||
private int mItemBg;
|
||||
private String mTitle;
|
||||
private int mUserIcon;
|
||||
private String mUserSay;
|
||||
|
||||
public SlideBean(int mItemBg, String mTitle, int mUserIcon, String mUserSay) {
|
||||
this.mItemBg = mItemBg;
|
||||
this.mTitle = mTitle;
|
||||
this.mUserIcon = mUserIcon;
|
||||
this.mUserSay = mUserSay;
|
||||
}
|
||||
|
||||
public int getItemBg() {
|
||||
return mItemBg;
|
||||
}
|
||||
|
||||
public void setItemBg(int mItemBg) {
|
||||
this.mItemBg = mItemBg;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
public void setTitle(String mTitle) {
|
||||
this.mTitle = mTitle;
|
||||
}
|
||||
|
||||
public int getUserIcon() {
|
||||
return mUserIcon;
|
||||
}
|
||||
|
||||
public void setUserIcon(int mUserIcon) {
|
||||
this.mUserIcon = mUserIcon;
|
||||
}
|
||||
|
||||
public String getUserSay() {
|
||||
return mUserSay;
|
||||
}
|
||||
|
||||
public void setUserSay(String mUserSay) {
|
||||
this.mUserSay = mUserSay;
|
||||
}
|
||||
}
|
@ -0,0 +1,314 @@
|
||||
package com.example.HomeContent;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.dingmouren.layoutmanagergroup.slide.ItemConfig;
|
||||
import com.dingmouren.layoutmanagergroup.slide.ItemTouchHelperCallback;
|
||||
import com.dingmouren.layoutmanagergroup.slide.OnSlideListener;
|
||||
import com.dingmouren.layoutmanagergroup.slide.SlideLayoutManager;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.q42.android.scrollingimageview.ScrollingImageView;
|
||||
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
//这个是home的Fragment
|
||||
public class SlideFragment extends Fragment {
|
||||
private static final String TAG = "SlideFragment";
|
||||
private RecyclerView mRecyclerView;
|
||||
private SmileView mSmileView;
|
||||
private SlideLayoutManager mSlideLayoutManager;
|
||||
private ItemTouchHelper mItemTouchHelper;
|
||||
private ItemTouchHelperCallback mItemTouchHelperCallback;
|
||||
private MyAdapter mAdapter;
|
||||
private MyAdapterItem myAdapterItem;
|
||||
private List<SlideBean> mList = new ArrayList<>();
|
||||
private int mLikeCount = 50;
|
||||
private int mDislikeCount = 50;
|
||||
private XRecyclerView xRecyclerView_home;
|
||||
private ArrayList<TweetsBean> listData;
|
||||
private int refreshtime = 0;
|
||||
|
||||
AppCompatActivity appCompatActivity;//保存最初的主Activity
|
||||
public AppCompatActivity getAppCompatActivity(){
|
||||
return appCompatActivity;
|
||||
}
|
||||
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
|
||||
private static final SlideFragment ourInstance = new SlideFragment();
|
||||
|
||||
public static SlideFragment getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_slide, container, false);
|
||||
initView(rootView);
|
||||
initListener();//初始化监听器
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private void initView(View rootView) {
|
||||
listData = new ArrayList<TweetsBean>();
|
||||
|
||||
//表情那一块最热门推送top6
|
||||
|
||||
xRecyclerView_home = (XRecyclerView) rootView.findViewById(R.id.home_XRecyclerView);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(appCompatActivity);
|
||||
//设置垂直布局
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
//给mRecyclerView设置布局
|
||||
xRecyclerView_home.setLayoutManager(linearLayoutManager);
|
||||
xRecyclerView_home.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
|
||||
xRecyclerView_home.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
xRecyclerView_home.setArrowImageView(R.drawable._planet);
|
||||
|
||||
//建立header的view
|
||||
View header = (RelativeLayout)LayoutInflater.from(appCompatActivity).inflate(R.layout.recycleview_header_home,appCompatActivity.findViewById(android.R.id.content),false);
|
||||
mRecyclerView = header.findViewById(R.id.recycler_view);
|
||||
mSmileView = header.findViewById(R.id.smile_view);
|
||||
mSmileView.setLike(mLikeCount);
|
||||
mSmileView.setDisLike(mDislikeCount);
|
||||
mAdapter = new MyAdapter();
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
addData(2);
|
||||
mItemTouchHelperCallback = new ItemTouchHelperCallback(mRecyclerView.getAdapter(), mList);
|
||||
mItemTouchHelper = new ItemTouchHelper(mItemTouchHelperCallback);
|
||||
mSlideLayoutManager = new SlideLayoutManager(mRecyclerView, mItemTouchHelper);
|
||||
mItemTouchHelper.attachToRecyclerView(mRecyclerView);
|
||||
mRecyclerView.setLayoutManager(mSlideLayoutManager);
|
||||
|
||||
//为外层RecycleView增加嵌套RecycleView,嵌套在header
|
||||
xRecyclerView_home.addHeaderView(header);
|
||||
|
||||
|
||||
myAdapterItem = new MyAdapterItem(listData);
|
||||
// for(int i=0;i<15;i++) {
|
||||
// listData.add("item"+i);
|
||||
// }
|
||||
xRecyclerView_home.setAdapter(myAdapterItem);
|
||||
xRecyclerView_home.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshtime++;
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listData.clear();
|
||||
addData(0);
|
||||
myAdapterItem.notifyDataSetChanged();
|
||||
xRecyclerView_home.refreshComplete();
|
||||
}
|
||||
},3000
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
addData(0);
|
||||
myAdapterItem.notifyDataSetChanged();
|
||||
xRecyclerView_home.loadMoreComplete();
|
||||
}
|
||||
},3000);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
//往左滑就是不喜欢,往右滑就是喜欢
|
||||
mItemTouchHelperCallback.setOnSlideListener(new OnSlideListener() {
|
||||
@Override
|
||||
public void onSliding(RecyclerView.ViewHolder viewHolder, float ratio, int direction) {
|
||||
if (direction == ItemConfig.SLIDING_LEFT) {
|
||||
|
||||
} else if (direction == ItemConfig.SLIDING_RIGHT) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlided(RecyclerView.ViewHolder viewHolder, Object o, int direction) {
|
||||
if (direction == ItemConfig.SLIDED_LEFT) {
|
||||
mDislikeCount--;
|
||||
mSmileView.setDisLike(mDislikeCount);
|
||||
mSmileView.disLikeAnimation();
|
||||
} else if (direction == ItemConfig.SLIDED_RIGHT) {
|
||||
mLikeCount++;
|
||||
mSmileView.setLike(mLikeCount);
|
||||
mSmileView.likeAnimation();
|
||||
}
|
||||
int position = viewHolder.getAdapterPosition();
|
||||
Log.e(TAG, "onSlided--position:" + position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClear() {
|
||||
// 一旦几个页面的数据加载完了,就在这里重新加载数据
|
||||
|
||||
addData(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 向集合中添加数据
|
||||
* 这个要从服务器拿数据
|
||||
* 0代表更新item 1代表更新header 2代表都更新
|
||||
*/
|
||||
private void addData(int flag){
|
||||
int[] icons = {R.mipmap.header_icon_1, R.mipmap.header_icon_2, R.mipmap.header_icon_3,
|
||||
R.mipmap.header_icon_4, R.mipmap.header_icon_1, R.mipmap.header_icon_2};
|
||||
String[] titles = {"Acknowledging", "Belief", "Confidence", "Dreaming", "Happiness", "Confidence"};
|
||||
String[] says = {
|
||||
"Do one thing at a time, and do well.",
|
||||
"Keep on going never give up.",
|
||||
"Whatever is worth doing is worth doing well.",
|
||||
"I can because i think i can.",
|
||||
"Jack of all trades and master of none.",
|
||||
"Keep on going never give up.",
|
||||
"Whatever is worth doing is worth doing well.",
|
||||
};
|
||||
int[] bgs = {
|
||||
R.drawable.draw9,
|
||||
R.drawable.draw10,
|
||||
R.drawable.draw6,
|
||||
R.drawable.draw7,
|
||||
R.drawable.draw7,
|
||||
R.drawable.draw12
|
||||
};
|
||||
if(flag==1||flag==2)
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mList.add(new SlideBean(bgs[i],titles[i],icons[i],says[i]));
|
||||
}
|
||||
if(flag==0||flag==2)
|
||||
for(int i=0;i<10;i++){
|
||||
listData.add(new TweetsBean(bgs[i%6],titles[i%6],icons[i%6],says[i%6]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 适配器
|
||||
*/
|
||||
class MyAdapterItem extends RecyclerView.Adapter<MyAdapterItem.ViewHolder>{
|
||||
public ArrayList<TweetsBean> datas = null;
|
||||
public MyAdapterItem(ArrayList<TweetsBean> datas){
|
||||
this.datas = datas;
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public MyAdapterItem.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(appCompatActivity).inflate(R.layout.item_haha,parent,false);
|
||||
ViewHolder vh = new ViewHolder(view);
|
||||
return vh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyAdapterItem.ViewHolder holder, int position) {
|
||||
Log.i("hah","j"+holder.mTextView);
|
||||
TweetsBean tweetsBean = datas.get(position);
|
||||
holder.mTextView.setText(tweetsBean.getUserSay());
|
||||
holder.tvTitle.setText(tweetsBean.getTitle());
|
||||
holder.imgBg.setImageResource(tweetsBean.getItemBg());
|
||||
holder.userIcon.setImageResource(tweetsBean.getUserIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
public TextView mTextView;//文字部分
|
||||
ImageView imgBg;//背景图片
|
||||
ImageView userIcon;//读者头像
|
||||
TextView tvTitle;//推文标题
|
||||
|
||||
public ViewHolder(View view){
|
||||
super(view);
|
||||
mTextView = (TextView) view.findViewById(R.id.text_item_view);
|
||||
imgBg = (ImageView) view.findViewById(R.id.img_bg);
|
||||
userIcon = (ImageView) view.findViewById(R.id.img_user);
|
||||
tvTitle = (TextView) view.findViewById(R.id.text_item_view);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(appCompatActivity).inflate(R.layout.item_slide, parent, false);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.i("你呗","你点接了");
|
||||
//这里可以设置点开文章好查看
|
||||
// 可以新开一个Activity来查看文章
|
||||
}
|
||||
});
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
SlideBean bean = mList.get(position);
|
||||
holder.imgBg.setImageResource(bean.getItemBg());
|
||||
holder.tvTitle.setText(bean.getTitle());
|
||||
holder.userIcon.setImageResource(bean.getUserIcon());
|
||||
holder.userSay.setText(bean.getUserSay());
|
||||
}
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView imgBg;//背景图片
|
||||
ImageView userIcon;//读者头像
|
||||
TextView tvTitle;//推文标题
|
||||
TextView userSay;//用户名或者到时候改成一段摘要也可以
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
imgBg = itemView.findViewById(R.id.img_bg);
|
||||
userIcon = itemView.findViewById(R.id.img_user);
|
||||
tvTitle = itemView.findViewById(R.id.tv_title);
|
||||
userSay = itemView.findViewById(R.id.tv_user_say);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,428 @@
|
||||
package com.example.HomeContent;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by DELL on 2017/7/25.
|
||||
*/
|
||||
public class SmileView extends LinearLayout implements Animator.AnimatorListener {
|
||||
|
||||
|
||||
//分割线间距
|
||||
private int dividerMargin = 20;
|
||||
private float count;
|
||||
private int defalutBottom = 70;
|
||||
private String defaultLike = "喜欢";
|
||||
private String defalutDis = "无感";
|
||||
private int defalutTextColor = Color.WHITE;
|
||||
private String defaluteShadow = "#7F484848";
|
||||
private int defalutGravity = Gravity.CENTER_HORIZONTAL;
|
||||
private int defalutSize = dip2px(getContext(), 25);
|
||||
|
||||
private int like = 20;
|
||||
private int disLike = 20; //点赞数,差评数
|
||||
private float fLike, fDis;
|
||||
private ImageView imageLike;
|
||||
private ImageView imageDis;
|
||||
|
||||
private TextView likeNum, disNum, likeText, disText;
|
||||
private LinearLayout likeBack, disBack, likeAll, disAll;
|
||||
private AnimationDrawable animLike, animDis; //笑脸帧动画
|
||||
private ValueAnimator animatorBack; //背景拉伸动画
|
||||
|
||||
private int type = 0; //选择执行帧动画的笑脸 //0 笑脸 1 哭脸
|
||||
private boolean isClose = false; //判断收起动画
|
||||
|
||||
public SmileView setDefalutBottom(int defalutBottom) {
|
||||
this.defalutBottom = defalutBottom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void notifyChange() {
|
||||
init();
|
||||
bindListener();
|
||||
}
|
||||
|
||||
|
||||
public void setDefalutGravity(int defalutGravity) {
|
||||
this.defalutGravity = defalutGravity;
|
||||
}
|
||||
|
||||
public void setDefalutDis(String defalutDis) {
|
||||
this.defalutDis = defalutDis;
|
||||
}
|
||||
|
||||
public void setDefaultLike(String defaultLike) {
|
||||
this.defaultLike = defaultLike;
|
||||
|
||||
}
|
||||
|
||||
public SmileView setDividerMargin(int dividerMargin) {
|
||||
this.dividerMargin = dividerMargin;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void setDefalutSize(int defalutSize) {
|
||||
this.defalutSize = defalutSize;
|
||||
}
|
||||
|
||||
public void setNum(int like, int dislike) {
|
||||
//设置百分比
|
||||
count = like + dislike;
|
||||
fLike = like / count;
|
||||
fDis = dislike / count;
|
||||
this.like = (int) (fLike * 100);
|
||||
this.disLike = 100 - this.like;
|
||||
setLike(this.like);
|
||||
setDisLike(this.disLike);
|
||||
}
|
||||
|
||||
public void setLike(int like) {
|
||||
likeNum.setText(like + "");
|
||||
}
|
||||
|
||||
public void setDisLike(int disLike) {
|
||||
disNum.setText(disLike + "");
|
||||
}
|
||||
|
||||
|
||||
public SmileView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SmileView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SmileView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
bindListener();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.removeAllViews();
|
||||
//初始化总布局
|
||||
setOrientation(HORIZONTAL);
|
||||
setGravity(defalutGravity | Gravity.BOTTOM);
|
||||
setBackgroundColor(Color.TRANSPARENT); //开始透明
|
||||
|
||||
|
||||
//设置百分比
|
||||
float count = like + disLike;
|
||||
fLike = like / count;
|
||||
fDis = disLike / count;
|
||||
like = (int) (fLike * 100);
|
||||
disLike = (int) (fDis * 100);
|
||||
|
||||
//初始化图片
|
||||
imageLike = new ImageView(getContext());
|
||||
//添加动画资源 获得帧动画
|
||||
imageLike.setBackgroundResource(R.drawable.animation_like);
|
||||
animLike = (AnimationDrawable) imageLike.getBackground();
|
||||
//初始化文字
|
||||
likeNum = new TextView(getContext());
|
||||
likeNum.setText(like + "");
|
||||
likeNum.setTextColor(defalutTextColor);
|
||||
TextPaint likeNumPaint = likeNum.getPaint();
|
||||
likeNumPaint.setFakeBoldText(true);
|
||||
likeNum.setTextSize(20f);
|
||||
likeText = new TextView(getContext());
|
||||
likeText.setText(defaultLike);
|
||||
likeText.setTextColor(defalutTextColor);
|
||||
|
||||
imageDis = new ImageView(getContext());
|
||||
imageDis.setBackgroundResource(R.drawable.animation_dislike);
|
||||
animDis = (AnimationDrawable) imageDis.getBackground();
|
||||
disNum = new TextView(getContext());
|
||||
disNum.setText(disLike + "");
|
||||
disNum.setTextColor(defalutTextColor);
|
||||
TextPaint disNumPaint = disNum.getPaint();
|
||||
disNumPaint.setFakeBoldText(true);
|
||||
disNum.setTextSize(20f);
|
||||
disText = new TextView(getContext());
|
||||
disText.setText(defalutDis);
|
||||
disText.setTextColor(defalutTextColor);
|
||||
|
||||
|
||||
//初始化布局
|
||||
likeBack = new LinearLayout(getContext());
|
||||
disBack = new LinearLayout(getContext());
|
||||
LayoutParams params2 = new LayoutParams(defalutSize, defalutSize);
|
||||
likeBack.addView(imageLike, params2);
|
||||
disBack.addView(imageDis, params2);
|
||||
disBack.setBackgroundResource(R.drawable.white_background);
|
||||
likeBack.setBackgroundResource(R.drawable.white_background);
|
||||
|
||||
//单列总布局
|
||||
likeAll = new LinearLayout(getContext());
|
||||
disAll = new LinearLayout(getContext());
|
||||
likeAll.setOrientation(VERTICAL);
|
||||
disAll.setOrientation(VERTICAL);
|
||||
likeAll.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
disAll.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
likeAll.setBackgroundColor(Color.TRANSPARENT);
|
||||
disAll.setBackgroundColor(Color.TRANSPARENT);
|
||||
|
||||
//添加文字图片放进一列
|
||||
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, 10, 0, 0);
|
||||
params.gravity = Gravity.CENTER;
|
||||
disAll.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
likeAll.setGravity(Gravity.RIGHT);
|
||||
disAll.addView(disNum, params);
|
||||
disAll.addView(disText, params);
|
||||
disAll.addView(disBack, params);
|
||||
|
||||
likeAll.addView(likeNum, params);
|
||||
likeAll.addView(likeText, params);
|
||||
likeAll.addView(likeBack, params);
|
||||
|
||||
//中间分隔线
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
imageView.setBackground(new ColorDrawable(Color.GRAY));
|
||||
LayoutParams params4 = new LayoutParams(3, 80);
|
||||
params4.setMargins(dividerMargin, 10, dividerMargin, defalutBottom + 20);
|
||||
params4.gravity = Gravity.BOTTOM;
|
||||
|
||||
|
||||
LayoutParams params3 = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params3.setMargins(30, 20, 30, defalutBottom);
|
||||
params3.gravity = Gravity.BOTTOM;
|
||||
addView(disAll, params3);
|
||||
addView(imageView, params4);
|
||||
addView(likeAll, params3);
|
||||
|
||||
//隐藏文字
|
||||
setVisibities(GONE);
|
||||
}
|
||||
|
||||
//
|
||||
public void setVisibities(int v) {
|
||||
likeNum.setVisibility(v);
|
||||
disNum.setVisibility(v);
|
||||
likeText.setVisibility(v);
|
||||
disText.setVisibility(v);
|
||||
}
|
||||
|
||||
//绑定监听
|
||||
private void bindListener() {
|
||||
imageDis.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
/* type = 1; //设置动画对象
|
||||
animBack(); //拉伸背景
|
||||
setVisibities(VISIBLE); //隐藏文字
|
||||
//切换背景色
|
||||
setBackgroundColor(Color.TRANSPARENT);
|
||||
likeBack.setBackgroundResource(R.drawable.white_background);
|
||||
disBack.setBackgroundResource(R.drawable.yellow_background);
|
||||
//重置帧动画
|
||||
imageLike.setBackground(null);
|
||||
imageLike.setBackgroundResource(R.drawable.animation_like);
|
||||
animLike = (AnimationDrawable) imageLike.getBackground();*/
|
||||
disLikeAnimation();
|
||||
}
|
||||
});
|
||||
imageLike.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
/* type = 0;
|
||||
animBack();
|
||||
setVisibities(VISIBLE);
|
||||
setBackgroundColor(Color.TRANSPARENT);
|
||||
disBack.setBackgroundResource(R.drawable.white_background);
|
||||
likeBack.setBackgroundResource(R.drawable.yellow_background);
|
||||
imageDis.setBackground(null);
|
||||
imageDis.setBackgroundResource(R.drawable.animation_dislike);
|
||||
animDis = (AnimationDrawable) imageDis.getBackground();*/
|
||||
likeAnimation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void disLikeAnimation(){
|
||||
type = 1; //设置动画对象
|
||||
animBack(); //拉伸背景
|
||||
setVisibities(VISIBLE); //隐藏文字
|
||||
//切换背景色
|
||||
setBackgroundColor(Color.parseColor(defaluteShadow));
|
||||
likeBack.setBackgroundResource(R.drawable.white_background);
|
||||
disBack.setBackgroundResource(R.drawable.yellow_background);
|
||||
//重置帧动画
|
||||
imageLike.setBackground(null);
|
||||
imageLike.setBackgroundResource(R.drawable.animation_like);
|
||||
animLike = (AnimationDrawable) imageLike.getBackground();
|
||||
}
|
||||
|
||||
public void likeAnimation(){
|
||||
type = 0;
|
||||
animBack();
|
||||
setVisibities(VISIBLE);
|
||||
setBackgroundColor(Color.parseColor(defaluteShadow));
|
||||
disBack.setBackgroundResource(R.drawable.white_background);
|
||||
likeBack.setBackgroundResource(R.drawable.yellow_background);
|
||||
imageDis.setBackground(null);
|
||||
imageDis.setBackgroundResource(R.drawable.animation_dislike);
|
||||
animDis = (AnimationDrawable) imageDis.getBackground();
|
||||
}
|
||||
|
||||
//背景伸展动画
|
||||
public void animBack() {
|
||||
//动画执行中不能点击
|
||||
imageDis.setClickable(false);
|
||||
imageLike.setClickable(false);
|
||||
|
||||
final int max = Math.max(like * 4, disLike * 4);
|
||||
animatorBack = ValueAnimator.ofInt(5, max);
|
||||
animatorBack.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int magrin = (int) animation.getAnimatedValue();
|
||||
LayoutParams paramsLike
|
||||
= (LayoutParams) imageLike.getLayoutParams();
|
||||
paramsLike.bottomMargin = magrin;
|
||||
|
||||
if (magrin <= like * 4) {
|
||||
imageLike.setLayoutParams(paramsLike);
|
||||
}
|
||||
if (magrin <= disLike * 4) {
|
||||
imageDis.setLayoutParams(paramsLike);
|
||||
}
|
||||
}
|
||||
});
|
||||
isClose = false;
|
||||
animatorBack.addListener(this);
|
||||
animatorBack.setDuration(500);
|
||||
animatorBack.start();
|
||||
}
|
||||
|
||||
//背景收回动画
|
||||
public void setBackUp() {
|
||||
final int max = Math.max(like * 4, disLike * 4);
|
||||
animatorBack = ValueAnimator.ofInt(max, 5);
|
||||
animatorBack.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
int magrin = (int) animation.getAnimatedValue();
|
||||
LayoutParams paramsLike
|
||||
= (LayoutParams) imageLike.getLayoutParams();
|
||||
paramsLike.bottomMargin = magrin;
|
||||
|
||||
if (magrin <= like * 4) {
|
||||
imageLike.setLayoutParams(paramsLike);
|
||||
}
|
||||
if (magrin <= disLike * 4) {
|
||||
imageDis.setLayoutParams(paramsLike);
|
||||
}
|
||||
}
|
||||
});
|
||||
animatorBack.addListener(this);
|
||||
animatorBack.setDuration(500);
|
||||
animatorBack.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
//重置帧动画
|
||||
animDis.stop();
|
||||
animLike.stop();
|
||||
|
||||
//关闭时不执行帧动画
|
||||
if (isClose) {
|
||||
//收回后可点击
|
||||
imageDis.setClickable(true);
|
||||
imageLike.setClickable(true);
|
||||
//隐藏文字
|
||||
setVisibities(GONE);
|
||||
//恢复透明
|
||||
setBackgroundColor(Color.TRANSPARENT);
|
||||
return;
|
||||
}
|
||||
isClose = true;
|
||||
|
||||
if (type == 0) {
|
||||
animLike.start();
|
||||
objectY(imageLike);
|
||||
} else {
|
||||
animDis.start();
|
||||
objectX(imageDis);
|
||||
}
|
||||
}
|
||||
|
||||
public void objectY(View view) {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", -10.0f, 0.0f, 10.0f, 0.0f, -10.0f, 0.0f, 10.0f, 0);
|
||||
animator.setRepeatMode(ObjectAnimator.RESTART);
|
||||
//animator.setRepeatCount(1);
|
||||
animator.setDuration(1500);
|
||||
animator.start();
|
||||
animator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setBackUp(); //执行回弹动画
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void objectX(View view) {
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10.0f, 0.0f, 10.0f, 0.0f, -10.0f, 0.0f, 10.0f, 0);
|
||||
animator.setRepeatMode(ObjectAnimator.RESTART);
|
||||
// animator.setRepeatCount(1);
|
||||
animator.setDuration(1500);
|
||||
animator.start();
|
||||
|
||||
animator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setBackUp(); //执行回弹动画
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
//dp转px
|
||||
public static int dip2px(Context context, float dipValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dipValue * scale + 0.5f);
|
||||
}
|
||||
|
||||
//px转dp
|
||||
public static int px2dip(Context context, float pxValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (pxValue / scale + 0.5f);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.example.HomeContent;
|
||||
|
||||
public class TweetsBean {
|
||||
private int mItemBg;
|
||||
private String mTitle;
|
||||
private int mUserIcon;
|
||||
private String mUserSay;
|
||||
public TweetsBean(int mItemBg, String mTitle, int mUserIcon, String mUserSay){
|
||||
this.mItemBg = mItemBg;//截取图片
|
||||
this.mTitle = mTitle;//标题
|
||||
this.mUserIcon = mUserIcon;
|
||||
this.mUserSay = mUserSay;//摘要
|
||||
}
|
||||
public int getItemBg() {
|
||||
return mItemBg;
|
||||
}
|
||||
|
||||
public void setItemBg(int mItemBg) {
|
||||
this.mItemBg = mItemBg;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
public void setTitle(String mTitle) {
|
||||
this.mTitle = mTitle;
|
||||
}
|
||||
|
||||
public int getUserIcon() {
|
||||
return mUserIcon;
|
||||
}
|
||||
|
||||
public void setUserIcon(int mUserIcon) {
|
||||
this.mUserIcon = mUserIcon;
|
||||
}
|
||||
|
||||
public String getUserSay() {
|
||||
return mUserSay;
|
||||
}
|
||||
|
||||
public void setUserSay(String mUserSay) {
|
||||
this.mUserSay = mUserSay;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
//package com.example.PersonalCenter;
|
||||
//
|
||||
//import android.view.View;
|
||||
//
|
||||
//public class ArcView extends View {
|
||||
// private int mWidth;
|
||||
// private int mHeight;
|
||||
// /**
|
||||
// * 弧形高度
|
||||
// */
|
||||
// private int mArcHeight;
|
||||
// /**
|
||||
// * 背景颜色
|
||||
// */
|
||||
// private int mBgColor;
|
||||
// private Paint mPaint;
|
||||
// private Context mContext;
|
||||
//
|
||||
// public ArcView(Context context) {
|
||||
// this(context, null);
|
||||
// }
|
||||
//
|
||||
// public ArcView(Context context, @Nullable AttributeSet attrs) {
|
||||
// this(context, attrs, 0);
|
||||
// }
|
||||
//
|
||||
// public ArcView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
// super(context, attrs, defStyleAttr);
|
||||
//
|
||||
// TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ArcView);
|
||||
// mArcHeight = typedArray.getDimensionPixelSize(R.styleable.ArcView_arcHeight, 0);
|
||||
// mBgColor=typedArray.getColor(R.styleable.ArcView_bgColor,Color.parseColor("#303F9F"));
|
||||
//
|
||||
// mContext = context;
|
||||
// mPaint = new Paint();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onDraw(Canvas canvas) {
|
||||
// super.onDraw(canvas);
|
||||
//
|
||||
// mPaint.setStyle(Paint.Style.FILL);
|
||||
// mPaint.setColor(mBgColor);
|
||||
//
|
||||
// Rect rect = new Rect(0, 0, mWidth, mHeight - mArcHeight);
|
||||
// canvas.drawRect(rect, mPaint);
|
||||
//
|
||||
//
|
||||
// Path path = new Path();
|
||||
// path.moveTo(0, mHeight - mArcHeight);
|
||||
// path.quadTo(mWidth / 2, mHeight, mWidth, mHeight - mArcHeight);
|
||||
// canvas.drawPath(path, mPaint);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
// int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
// int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
// int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
// int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
//
|
||||
// if (widthMode == MeasureSpec.EXACTLY) {
|
||||
// mWidth = widthSize;
|
||||
// }
|
||||
// if (heightMode == MeasureSpec.EXACTLY) {
|
||||
// mHeight = heightSize;
|
||||
// }
|
||||
// setMeasuredDimension(mWidth, mHeight);
|
||||
// }
|
||||
//}
|
@ -0,0 +1,56 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import com.squareup.picasso.Transformation;
|
||||
|
||||
|
||||
class CircleTransformation implements Transformation {
|
||||
|
||||
private static final int STROKE_WIDTH = 6;
|
||||
|
||||
@Override
|
||||
public Bitmap transform(Bitmap source) {
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
|
||||
if (squaredBitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
|
||||
Paint avatarPaint = new Paint();
|
||||
BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
|
||||
avatarPaint.setShader(shader);
|
||||
|
||||
Paint outlinePaint = new Paint();
|
||||
outlinePaint.setColor(Color.WHITE);
|
||||
outlinePaint.setStyle(Paint.Style.STROKE);
|
||||
outlinePaint.setStrokeWidth(STROKE_WIDTH);
|
||||
outlinePaint.setAntiAlias(true);
|
||||
|
||||
float r = size / 2f;
|
||||
canvas.drawCircle(r, r, r, avatarPaint);
|
||||
canvas.drawCircle(r, r, r - STROKE_WIDTH / 2, outlinePaint);
|
||||
|
||||
squaredBitmap.recycle();
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return "circleTransformation()";
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Point;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.cmknowledgegraph.MainActivity;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EssayGalleryAdapter extends RecyclerView.Adapter<EssayGalleryAdapter.ViewHolder>{
|
||||
private List<Image> data;
|
||||
|
||||
public EssayGalleryAdapter(List<Image> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
View v = inflater.inflate(R.layout.item_shop_card, parent, false);
|
||||
return new ViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(data.get(position).getImage())
|
||||
.into(holder.image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView image;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
image = (ImageView) itemView.findViewById(R.id.image);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextSwitcher;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
|
||||
|
||||
public class FeedAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private int itemsCount = 0;
|
||||
|
||||
public FeedAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
final View view = LayoutInflater.from(context).inflate(R.layout.item_feed, parent, false);
|
||||
|
||||
return new CellFeedViewHolder(view);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
final CellFeedViewHolder holder = (CellFeedViewHolder) viewHolder;
|
||||
bindDefaultFeedItem(position, holder);
|
||||
}
|
||||
|
||||
private void bindDefaultFeedItem(int position, CellFeedViewHolder holder) {
|
||||
if (position % 2 == 0) {
|
||||
holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_1);
|
||||
holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_1);
|
||||
} else {
|
||||
holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_2);
|
||||
holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_2);
|
||||
}
|
||||
|
||||
holder.btnComments.setTag(position);
|
||||
holder.btnMore.setTag(position);
|
||||
holder.ivFeedCenter.setTag(holder);
|
||||
holder.btnLike.setTag(holder);
|
||||
|
||||
}
|
||||
|
||||
public void updateItems() {
|
||||
itemsCount = 10;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return itemsCount;
|
||||
}
|
||||
|
||||
private static class CellFeedViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ivFeedCenter;
|
||||
ImageView ivFeedBottom;
|
||||
ImageButton btnComments;
|
||||
ImageButton btnLike;
|
||||
ImageButton btnMore;
|
||||
TextSwitcher tsLikesCounter;
|
||||
ImageView ivUserProfile;
|
||||
FrameLayout vImageRoot;
|
||||
|
||||
CellFeedViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
ivFeedCenter = (ImageView) view.findViewById(R.id.ivFeedCenter);
|
||||
ivFeedBottom = (ImageView) view.findViewById(R.id.ivFeedBottom);
|
||||
btnComments = (ImageButton) view.findViewById(R.id.btnComments);
|
||||
btnLike = (ImageButton) view.findViewById(R.id.btnLike);
|
||||
btnMore = (ImageButton) view.findViewById(R.id.btnMore);
|
||||
tsLikesCounter = (TextSwitcher) view.findViewById(R.id.tsLikesCounter);
|
||||
ivUserProfile = (ImageView) view.findViewById(R.id.ivUserProfile);
|
||||
vImageRoot = (FrameLayout) view.findViewById(R.id.vImageRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.example.cmknowledgegraph.LoginActivity;
|
||||
import com.example.tools.retuData;
|
||||
|
||||
public class HandlerHandle extends Handler {
|
||||
LoginActivity loginActivity;
|
||||
public HandlerHandle(LoginActivity loginActivity){
|
||||
this.loginActivity = loginActivity;
|
||||
}
|
||||
@Override
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
//根据登录状态请求不同的消息
|
||||
super.handleMessage(msg);
|
||||
|
||||
// Bundle b = msg.getData();
|
||||
// String data = b.getString("msg");
|
||||
// Log.i("haha-====","==="+data);
|
||||
//
|
||||
// retuData retuData = JSON.parseObject(data, com.example.tools.retuData.class);
|
||||
// if(retuData.msg.equals("success")){
|
||||
// //登录成功,返回主页面
|
||||
// }else{
|
||||
//// 登录失败
|
||||
// Toast.makeText(loginActivity, retuData.msg, Toast.LENGTH_SHORT).show();
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
public class Image {
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final String price;
|
||||
private final int image;
|
||||
|
||||
public Image(int id, String name, String price, int image) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public int getImage() {
|
||||
return image;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.tools.retuData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Login {
|
||||
|
||||
private String password;
|
||||
private String phonenumber;
|
||||
public Login(String phonenumber,String password){
|
||||
|
||||
this.password = password;
|
||||
this.phonenumber = phonenumber;
|
||||
|
||||
}
|
||||
public String connUser() throws IOException {
|
||||
String infoString = WebServiceGet.executeHttpGet(phonenumber,password,"/person/login");
|
||||
// if(infoString.equals("false")){
|
||||
// Log.i("Login","+++++++++++fail"+infoString);
|
||||
// }else {
|
||||
// Log.i("Login","+++++++++++successs"+infoString);
|
||||
// }
|
||||
//登录成功后返回用户名
|
||||
|
||||
Log.i("sucesss",infoString+"ha");
|
||||
return infoString;
|
||||
}
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
package com.example.PersonalCenter.Login_Register;
|
||||
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.dd.CircularProgressButton;
|
||||
import com.example.Util.ConditionCode;
|
||||
import com.example.Util.RequestBody.user;
|
||||
import com.example.Util.ReturnData;
|
||||
import com.example.Util.ToolTip;
|
||||
import com.example.Util.User;
|
||||
import com.example.Util.cmkgWebServicePost;
|
||||
import com.example.Util.publicStringUtil;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.hanks.library.AnimateCheckBox;
|
||||
import com.itheima.wheelpicker.WheelPicker;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private EditText phonenumberRegister;
|
||||
private EditText usernameRegister;
|
||||
private EditText passwordRegister;
|
||||
private TextView RegisterButton;
|
||||
private ImageView boycheckimg;
|
||||
private ImageView girlcheckimg;
|
||||
private AnimateCheckBox boycheck;
|
||||
private AnimateCheckBox girlcheck;
|
||||
private WheelPicker wheelPicker;
|
||||
|
||||
|
||||
|
||||
private final RegisterHandler registerHandler = new RegisterHandler(this);
|
||||
public static class RegisterHandler extends Handler{
|
||||
private final WeakReference<RegisterActivity> weakReference;
|
||||
RegisterHandler(RegisterActivity registerActivity){
|
||||
this.weakReference = new WeakReference<RegisterActivity>(registerActivity);
|
||||
}
|
||||
@Override
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
RegisterActivity registerActivity = (RegisterActivity) weakReference.get();
|
||||
Bundle bundle = msg.getData();
|
||||
|
||||
ReturnData returnData = (ReturnData) bundle.getSerializable("msg");
|
||||
|
||||
if(returnData!=null && returnData.getCode()!=null){
|
||||
int code = returnData.getCode();
|
||||
if(code == ConditionCode.registersucess){
|
||||
try {
|
||||
Thread.sleep(700);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ToolTip.FadeCenter(weakReference.get(),"注册成功!");
|
||||
weakReference.get().finish();
|
||||
}else {
|
||||
ToolTip.FlyTocenter(weakReference.get(),returnData.getMsg());
|
||||
}
|
||||
}else ToolTip.FlyTocenter(weakReference.get(),"服务器出了点小问题");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_register);
|
||||
initView();
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
//获取各个控件
|
||||
RegisterButton = findViewById(R.id.main_btn_register_but);
|
||||
boycheck = findViewById(R.id.boycheck);
|
||||
boycheckimg = findViewById(R.id.boycheckimg);
|
||||
girlcheck = findViewById(R.id.girlcheck);
|
||||
girlcheckimg = findViewById(R.id.girlcheckimg);
|
||||
phonenumberRegister = findViewById(R.id.phonenumber_edit_register);
|
||||
usernameRegister = findViewById(R.id.username_edit_register);
|
||||
passwordRegister = findViewById(R.id.password_edit_register);
|
||||
|
||||
//给控件设置监听器
|
||||
boycheck.setOnClickListener(this);
|
||||
boycheckimg.setOnClickListener(this);
|
||||
girlcheckimg.setOnClickListener(this);
|
||||
girlcheck.setOnClickListener(this);
|
||||
RegisterButton.setOnClickListener(this);
|
||||
List<String> agewhellList = new ArrayList<String>();
|
||||
for(int i=0;i<120;i++) agewhellList.add(i+"");
|
||||
|
||||
|
||||
|
||||
// wheelPicker.run();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
switch (id){
|
||||
case R.id.boycheck:
|
||||
case R.id.boycheckimg:
|
||||
if(!girlcheck.isChecked()){
|
||||
if(boycheck.isChecked()) boycheck.setChecked(false); else boycheck.setChecked(true);
|
||||
}
|
||||
break;
|
||||
case R.id.girlcheck:
|
||||
case R.id.girlcheckimg:
|
||||
if(!boycheck.isChecked()) {
|
||||
if(girlcheck.isChecked()) girlcheck.setChecked(false); else girlcheck.setChecked(true);
|
||||
}
|
||||
break;
|
||||
case R.id.main_btn_register_but:
|
||||
Log.i("haha","你要注册了");
|
||||
checkInfo();
|
||||
|
||||
}
|
||||
}
|
||||
public void checkInfo(){
|
||||
// 先检查手机号
|
||||
String phonenumber = phonenumberRegister.getText().toString();
|
||||
|
||||
if(phonenumber == null || phonenumber.length()!=11 || !phonenumber.matches("[0-9]+")){
|
||||
ToolTip.FadeCenter(this,"请输入正确的手机号");
|
||||
|
||||
}else{
|
||||
String username = usernameRegister.getText().toString();
|
||||
if(username == null){
|
||||
ToolTip.FadeCenter(this,"请输入用户名");
|
||||
}else if(username.length()>14) ToolTip.FadeCenter(this,"用户名过长");
|
||||
else {
|
||||
String password = passwordRegister.getText().toString();
|
||||
if(password == null){
|
||||
ToolTip.FadeCenter(this,"请输入密码");
|
||||
}else if(password.length()<6) ToolTip.FadeCenter(this, "密码至少为6位");
|
||||
else if(password.length()>14) ToolTip.FadeCenter(this," 密码最多14位");
|
||||
else {
|
||||
if(boycheck.isChecked()){
|
||||
user user = new user(phonenumber,username,password,0,0,"");
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Message m = new Message();
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
ReturnData returnData = cmkgWebServicePost.execuHttpPost(user.toString(), publicStringUtil.registerURL);
|
||||
Log.i("returndata",""+returnData);
|
||||
bundle.putSerializable("msg", returnData);
|
||||
m.setData(bundle);
|
||||
registerHandler.sendMessage(m);
|
||||
|
||||
}
|
||||
}).start();
|
||||
}else if(girlcheck.isChecked()){
|
||||
String args = "phonenumber="+phonenumber+"&username="+username+"&password="+password
|
||||
+"®ion="+""+"&age=0"+"&sex=0";
|
||||
cmkgWebServicePost.execuHttpPost(args, publicStringUtil.registerURL);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Message message = new Message();
|
||||
Bundle bundle = new Bundle();
|
||||
ReturnData returnData = cmkgWebServicePost.execuHttpPost(args,publicStringUtil.registerURL);
|
||||
bundle.putSerializable("msg", returnData);
|
||||
message.setData(bundle);
|
||||
registerHandler.sendMessage(message);
|
||||
}
|
||||
}).start();
|
||||
}else{
|
||||
ToolTip.FadeCenter(this,"请选择性别");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,51 +1,222 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.app.Person;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.example.PersonalCenter.Login_Register.LoginActivity;
|
||||
import com.example.Util.User;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.example.PersonalCenter.FeedAdapter;
|
||||
import com.example.PersonalCenter.MenuListFragment;
|
||||
import com.example.cmknowledgegraph.MainActivity;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.hanks.htextview.rainbow.RainbowTextView;
|
||||
import com.mxn.soul.flowingdrawer_core.ElasticDrawer;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
|
||||
import com.skyfishjy.library.RippleBackground;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.yarolegovich.discretescrollview.DSVOrientation;
|
||||
import com.yarolegovich.discretescrollview.DiscreteScrollView;
|
||||
import com.yarolegovich.discretescrollview.InfiniteScrollAdapter;
|
||||
import com.yarolegovich.discretescrollview.transform.ScaleTransformer;
|
||||
|
||||
public class PersonContent extends Fragment {
|
||||
import java.util.List;
|
||||
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
|
||||
|
||||
public class PersonContent extends Fragment {
|
||||
|
||||
|
||||
protected int res;
|
||||
private FlowingDrawer mDrawer;
|
||||
AppCompatActivity appCompatActivity;
|
||||
public AppCompatActivity getAppCompatActivity() {
|
||||
return appCompatActivity;
|
||||
}
|
||||
|
||||
// 与滚动文章有关的变量
|
||||
private List<Image> data;
|
||||
private essayGallary essayGallary;
|
||||
|
||||
// private TextView currentItemName;
|
||||
// private TextView currentItemPrice;
|
||||
private ImageView rateItemButton;
|
||||
private DiscreteScrollView itemPicker;
|
||||
private InfiniteScrollAdapter infiniteAdapter;
|
||||
// 与滚动文章有关的变量
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
MainActivity mainActivity = (MainActivity) context;
|
||||
}
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate( R.layout.activity_personality_center, container, false ); //要加载的layout文件
|
||||
}
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Button login_pc_btn = (Button) getActivity().findViewById(R.id.login_pc_button);
|
||||
login_pc_btn.setOnClickListener(new View.OnClickListener() {
|
||||
mDrawer = (FlowingDrawer) appCompatActivity.findViewById(R.id.drawerlayout);
|
||||
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
|
||||
//设置工具栏
|
||||
|
||||
setuptoolbar();
|
||||
|
||||
//设置侧滑菜单
|
||||
setupMenu();
|
||||
}
|
||||
|
||||
|
||||
protected void setuptoolbar(){
|
||||
//分别设置背景和头像
|
||||
//背景
|
||||
// ImageView blurimageView = (ImageView) appCompatActivity.findViewById(R.id.iv_blur);
|
||||
//背景波纹图
|
||||
// RippleBackground linearimageView = (RippleBackground) appCompatActivity.findViewById(R.id.linearcontent);
|
||||
// linearimageView.startRippleAnimation();
|
||||
|
||||
//头像
|
||||
ImageView avatarImageView = (ImageView) appCompatActivity.findViewById(R.id.iv_avatar);
|
||||
|
||||
// Picasso.with(appCompatActivity).load("http://114.55.30.62:8080/product_pictures/a.jpg").into(avatarImageView);
|
||||
// Picasso.get().load("http://114.55.30.62:8080/product_pictures/a.jpg").into(avatarImageView);
|
||||
Glide.with(getAppCompatActivity()).load(R.drawable.draw7).into(avatarImageView);
|
||||
ViewOutlineProvider vop = new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
//修改outline
|
||||
outline.setOval(0,0,view.getWidth(),view.getHeight());
|
||||
}};
|
||||
avatarImageView.setOutlineProvider(vop);
|
||||
//二维码
|
||||
ImageView QRcodeImageView = (ImageView) appCompatActivity.findViewById(R.id.QRCode);
|
||||
Glide.with(getAppCompatActivity()).load(R.drawable.qrcodeimage).into(QRcodeImageView);
|
||||
// Animation anim = AnimationUtils.loadAnimation(appCompatActivity,R.anim.anim_rotate);
|
||||
// anim.setDuration(14000);
|
||||
// avatarImageView.startAnimation(anim);
|
||||
// ImageView drugImageView = (ImageView) appCompatActivity.findViewById(R.id.drug_essays);
|
||||
//drugessays(像动态一样)
|
||||
// Animation animessays = AnimationUtils.loadAnimation(appCompatActivity,R.anim.anim_drugessays);
|
||||
// animessays.setDuration(12000);
|
||||
// drugImageView.startAnimation(animessays);
|
||||
// Glide.with(appCompatActivity).load(R.drawable.draw6).into(avatarImageView);
|
||||
//用户名
|
||||
final TextView rainbowTextView = (TextView) appCompatActivity.findViewById(R.id.person_username);
|
||||
rainbowTextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//跳转到LoginActivity
|
||||
if(!User.isLogin){
|
||||
Intent intent=new Intent();
|
||||
intent.setClass(getActivity(), LoginActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//菜单图片按钮
|
||||
ImageView menuImageview = (ImageView) appCompatActivity.findViewById(R.id.set_image);
|
||||
menuImageview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDrawer.toggleMenu();
|
||||
}
|
||||
});
|
||||
/*
|
||||
*
|
||||
* *******
|
||||
* // 设置滚动的文章按钮,文章画廊
|
||||
* ****
|
||||
* */
|
||||
|
||||
// currentItemName = (TextView) appCompatActivity.findViewById(R.id.item_name);
|
||||
// currentItemPrice = (TextView) appCompatActivity.findViewById(R.id.item_price);
|
||||
// rateItemButton = (ImageView) appCompatActivity.findViewById(R.id.item_btn_rate);
|
||||
essayGallary = essayGallary.get();
|
||||
data = essayGallary.getData();
|
||||
itemPicker = (DiscreteScrollView) appCompatActivity.findViewById(R.id.item_picker);
|
||||
itemPicker.setOrientation(DSVOrientation.HORIZONTAL);
|
||||
itemPicker.addOnItemChangedListener(new DiscreteScrollView.OnItemChangedListener<EssayGalleryAdapter.ViewHolder>() {
|
||||
@Override
|
||||
public void onCurrentItemChanged(@Nullable EssayGalleryAdapter.ViewHolder viewHolder, int i) {
|
||||
int positionInDataSet = infiniteAdapter.getRealPosition(i);
|
||||
onItemChanged(data.get(positionInDataSet));
|
||||
}
|
||||
});
|
||||
infiniteAdapter = InfiniteScrollAdapter.wrap(new EssayGalleryAdapter(data));
|
||||
itemPicker.setAdapter(infiniteAdapter);
|
||||
itemPicker.setItemTransitionTimeMillis(150);
|
||||
itemPicker.setItemTransformer(new ScaleTransformer.Builder()
|
||||
.setMinScale(0.8f)
|
||||
.build());
|
||||
onItemChanged(data.get(0));
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
avatarOnclickListener avatarOnclickListener = new avatarOnclickListener(getAppCompatActivity(),this);
|
||||
avatarOnclickListener.setFlowingDrawerl(mDrawer);
|
||||
avatarImageView.setOnClickListener(avatarOnclickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if(User.isLogin){
|
||||
Button longin_pc_btn=(Button) getActivity().findViewById(R.id.login_pc_button);
|
||||
longin_pc_btn.setText("Hello"+User.getUser().getUsername());
|
||||
|
||||
//设置菜单
|
||||
private void setupMenu() {
|
||||
FragmentManager fm = appCompatActivity.getSupportFragmentManager();//获取Fragment管理器
|
||||
MenuListFragment mMenuFragment = (MenuListFragment) fm.findFragmentById(R.id.id_container_menu);
|
||||
|
||||
if (mMenuFragment == null) {
|
||||
Log.i("is","------------it null");
|
||||
mMenuFragment = new MenuListFragment();
|
||||
mMenuFragment.setAppCompatActivity(getAppCompatActivity());
|
||||
fm.beginTransaction().add(R.id.id_container_menu, mMenuFragment).commit();
|
||||
//向activity添加一个布局
|
||||
}
|
||||
|
||||
//高血压
|
||||
|
||||
}
|
||||
//有关文章滚动画廊的方法
|
||||
private void onItemChanged(Image item) {
|
||||
// currentItemName.setText(item.getName());
|
||||
// currentItemPrice.setText(item.getPrice());
|
||||
// changeRateButtonState(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.loopeer.cardstack.CardStackView;
|
||||
import com.ramotion.foldingcell.FoldingCell;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RecyclerViewPagerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
List<Object> contents;
|
||||
int flag;
|
||||
AppCompatActivity appCompatActivity;
|
||||
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
|
||||
public RecyclerViewPagerAdapter(List<Object> contents, int flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
this.contents = contents;
|
||||
}
|
||||
public int getItemCount() {
|
||||
return contents.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
|
||||
View view = null;
|
||||
switch (flag){
|
||||
case 0://论坛
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.cell, parent, false);
|
||||
//
|
||||
// view = LayoutInflater.from(parent.getContext()).inflate(R.layout.drug_friends,parent,false);
|
||||
FoldingCell foldingCell = view.findViewById(R.id.folding_cell_new);
|
||||
foldingCell.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
foldingCell.toggle(false);
|
||||
}
|
||||
});
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
};
|
||||
|
||||
|
||||
case 1://动态
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.personinfomain, parent, false);
|
||||
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
case 2://好友列表
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.content_cardview, parent, false);
|
||||
|
||||
return new RecyclerView.ViewHolder(view) {
|
||||
};
|
||||
//
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
//在这里设置某一个条目的监听
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
public class Register {
|
||||
String phonenumber;
|
||||
String username;
|
||||
String password;
|
||||
public Register(String phonenumber, String username, String password){
|
||||
this.phonenumber = phonenumber;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
public boolean regist(){
|
||||
String regRet = WebServicePost.execuHttpPost(username, phonenumber, password,"/Register");
|
||||
if(regRet.equals("true")){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.hankcs.hanlp.HanLP;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Search {
|
||||
public String sickname;
|
||||
public Search(String sickname){
|
||||
this.sickname = sickname;
|
||||
}
|
||||
|
||||
public List<Set<String>> search(){
|
||||
Log.i("search","sick执行了");
|
||||
//找出对应的8个关键字
|
||||
List<String> keywordList = HanLP.extractKeyword(sickname,8);
|
||||
|
||||
//针对每一个sickname来查找一下能不能够找到相应的名字
|
||||
Set<String> mediciesSet = new HashSet<String>();
|
||||
Set<String> reasonsSet = new HashSet<String>();
|
||||
for(String i: keywordList){
|
||||
Log.i("关键词提取",i+"ha");
|
||||
String resq = SearchServiceGet.executeSearchGet(i,"/Search");
|
||||
|
||||
if(!resq.equals("fail")) {
|
||||
String[] me_rea = resq.split("-");
|
||||
String[] medicines = me_rea[0].split("\\|");
|
||||
for(String j: medicines) mediciesSet.add(j);
|
||||
String[] reasons = me_rea[1].split("\\|");
|
||||
for(String j: reasons) reasonsSet.add(j);
|
||||
|
||||
}
|
||||
}
|
||||
List<Set<String>> a = new ArrayList<Set<String>>();
|
||||
a.add(mediciesSet);
|
||||
a.add(reasonsSet);
|
||||
return a;
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.URL;
|
||||
|
||||
public class SearchServiceGet {
|
||||
public static String executeSearchGet(String sickname,String address){
|
||||
HttpURLConnection connection = null;
|
||||
InputStream in = null;
|
||||
|
||||
String Url = "http://106.54.210.208:8080/ChineseM"+address;
|
||||
String path = Url + "?sickname="+sickname;
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL(path);
|
||||
connection = (HttpURLConnection)url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(100000);//建立连接超时
|
||||
connection.setReadTimeout(80000);//传输数据超时
|
||||
in = connection.getInputStream();
|
||||
|
||||
BufferedReader reader = null;//输入流
|
||||
String line = "";//读取返回的每一行
|
||||
StringBuilder response = new StringBuilder();
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(in));
|
||||
while((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
//这时候response就是一个连续字符串了吧
|
||||
Log.i("response+++++",response+"返回值");
|
||||
return response.toString();
|
||||
//
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(reader!=null){
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
|
||||
public class SquaredFrameLayout extends FrameLayout {
|
||||
public SquaredFrameLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SquaredFrameLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.cmknowledgegraph.LoginActivity;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
|
||||
|
||||
/*
|
||||
* 头像监听类
|
||||
* 一个监听头像对象是个人中心主界面
|
||||
* 一个监听对象是左滑之后的头像
|
||||
*
|
||||
* */
|
||||
public class avatarOnclickListener implements View.OnClickListener {
|
||||
AppCompatActivity appCompatActivity;
|
||||
Fragment personFragment;
|
||||
private FlowingDrawer flowingDrawerl;
|
||||
|
||||
public FlowingDrawer getFlowingDrawerl() {
|
||||
return flowingDrawerl;
|
||||
}
|
||||
public void setFlowingDrawerl(FlowingDrawer flowingDrawerl){
|
||||
this.flowingDrawerl = flowingDrawerl;
|
||||
}
|
||||
|
||||
public avatarOnclickListener(AppCompatActivity appCompatActivity, Fragment fragment){
|
||||
this.personFragment = fragment;
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//这里监听就是如果未登录就跳到登录界面
|
||||
if(User.isLogin()){
|
||||
//登陆了,登录了点击主界面头像就可以打开左边菜单栏
|
||||
|
||||
flowingDrawerl.toggleMenu();
|
||||
}else{
|
||||
//没有登录
|
||||
//跳转到登录界面
|
||||
Intent intent=new Intent();
|
||||
intent.setClass(appCompatActivity, LoginActivity.class);
|
||||
personFragment.startActivity(intent);
|
||||
}
|
||||
//如果登录了就跳到个人信息界面
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.example.PersonalCenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
/*
|
||||
* 文章画廊类
|
||||
* */
|
||||
public class essayGallary {
|
||||
private static final String STORAGE = "shop";
|
||||
|
||||
public static essayGallary get() {
|
||||
return new essayGallary();
|
||||
}
|
||||
|
||||
// private SharedPreferences storage;
|
||||
//
|
||||
// private Shop() {
|
||||
// storage = getInstance().getSharedPreferences(STORAGE, Context.MODE_PRIVATE);
|
||||
// }
|
||||
|
||||
public List<Image> getData() {
|
||||
return Arrays.asList(
|
||||
new Image(1, "文章1", "概要1", R.drawable.draw6),
|
||||
new Image(2, "文章2", "概要2", R.drawable.draw6),
|
||||
new Image(3, "文章3", "概要3", R.drawable.draw6),
|
||||
new Image(4, "文章4", "概要4", R.drawable.draw6),
|
||||
new Image(5, "文章5", "概要5", R.drawable.draw6),
|
||||
new Image(6, "文章6", "概要6", R.drawable.draw6));
|
||||
}
|
||||
|
||||
// public boolean isRated(int itemId) {
|
||||
// return storage.getBoolean(String.valueOf(itemId), false);
|
||||
// }
|
||||
//
|
||||
// public void setRated(int itemId, boolean isRated) {
|
||||
// storage.edit().putBoolean(String.valueOf(itemId), isRated).apply();
|
||||
// }
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.example.SearchCenter;
|
||||
|
||||
public class ContentData {
|
||||
|
||||
private String contentdata;
|
||||
|
||||
public ContentData(String content) {
|
||||
this.contentdata = content;
|
||||
}
|
||||
|
||||
public String getContentdata() {
|
||||
return contentdata;
|
||||
}
|
||||
|
||||
public void setContentdata(String contentdata) {
|
||||
this.contentdata = contentdata;
|
||||
}
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
package com.example.SearchCenter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.Util.ConditionCode;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by LZL on 2017/7/16.
|
||||
*/
|
||||
|
||||
public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ScoresViewHodler> implements ConditionCode {
|
||||
List<ContentData> content_list;
|
||||
|
||||
public ListAdapter(List<ContentData> list)
|
||||
{
|
||||
content_list = list;
|
||||
}
|
||||
|
||||
public static class ScoresViewHodler extends RecyclerView.ViewHolder
|
||||
{
|
||||
TextView search_content; //内容
|
||||
public ScoresViewHodler(View view)
|
||||
{
|
||||
super(view);
|
||||
search_content=(TextView)view.findViewById(R.id.search_content);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ScoresViewHodler holder, int position) {
|
||||
holder.search_content.setText(content_list.get(position).getContentdata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScoresViewHodler onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cmkg_list_item,parent,false);
|
||||
return new ScoresViewHodler(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return content_list.size();
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
//package com.example.SearchCenter;
|
||||
//
|
||||
//import android.os.Bundle;
|
||||
//import android.util.Log;
|
||||
//import android.view.View;
|
||||
//import android.widget.Button;
|
||||
//import android.widget.EditText;
|
||||
//import android.widget.ImageButton;
|
||||
//
|
||||
//import androidx.appcompat.app.AppCompatActivity;
|
||||
//
|
||||
//import com.example.PersonalCenter.Search;
|
||||
//import com.example.cmknowledgegraph.R;
|
||||
////
|
||||
//public class SearchActivity extends AppCompatActivity {
|
||||
//
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.activity_search);
|
||||
// EditText search_edit_frame = findViewById(R.id.search_edit);
|
||||
// ImageButton search_btn = findViewById(R.id.search_btn);
|
||||
// String sickname = search_edit_frame.getText().toString();
|
||||
//
|
||||
// search_btn.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
//// Search search = new Search(sickname);
|
||||
//// search.search();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//}
|
@ -1,39 +0,0 @@
|
||||
package com.example.Util;
|
||||
|
||||
public interface ConditionCode {
|
||||
|
||||
/**
|
||||
* DiseaseToSymptom 病 症状
|
||||
* DiseaseToMedeicines 病 治疗方法
|
||||
* MedicineToOperation 药 用法
|
||||
* MedicineToFunction药 作用
|
||||
*/
|
||||
public final int DiseaseToSymptom=100;
|
||||
public final int DiseaseToMedicines=200;
|
||||
public final int MedicineToOperation=300;
|
||||
public final int MedicineToFunction=400;
|
||||
/***
|
||||
*Model_Symptom 匹配模板 病——症状
|
||||
* Model_Medicines 匹配模板 病——治疗方法
|
||||
* Model_Operation 匹配模板 药——用法
|
||||
* Model_Function 匹配模板 药——作用
|
||||
*/
|
||||
public final String Model_Symptom="的症状";
|
||||
public final String Model_Medicines="吃什么药";
|
||||
public final String Model_Operation="用法";
|
||||
public final String Model_Function="作用";
|
||||
|
||||
//登陆成功
|
||||
public final int loginsucess = 200;
|
||||
//手机号不存在
|
||||
public final int phonenumberisNotExist = 501;
|
||||
//密码错误
|
||||
public final int passwordError = 502;
|
||||
|
||||
//注册成功
|
||||
public final int registersucess = 200;
|
||||
//手机号已注册
|
||||
public final int phonenumberHadExist = 501;
|
||||
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package com.example.Util.RequestBody;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class user {
|
||||
protected user(){}
|
||||
private String phonenumber;
|
||||
private String username;
|
||||
private String password;
|
||||
private Integer age;
|
||||
private Integer sex;
|
||||
private String region;
|
||||
|
||||
public user(String phonenumber, String username, String password, Integer age, Integer sex, String region) {
|
||||
this.phonenumber = phonenumber;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.age = age;
|
||||
this.sex = sex;
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("phonenumber",phonenumber);
|
||||
jsonObject.put("username",username);
|
||||
jsonObject.put("password",password);
|
||||
jsonObject.put("sex",sex);
|
||||
jsonObject.put("age",age);
|
||||
jsonObject.put("region",region);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber) {
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.example.Util;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ReturnData implements Serializable {
|
||||
private Integer code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
|
||||
public ReturnData(Integer code, String msg, Object data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.example.Util;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.github.johnpersano.supertoasts.library.Style;
|
||||
import com.github.johnpersano.supertoasts.library.SuperActivityToast;
|
||||
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils;
|
||||
|
||||
/*
|
||||
*
|
||||
* 用于发出提示框
|
||||
* */
|
||||
public class ToolTip {
|
||||
|
||||
public static void FadeCenter(Context context,String info){
|
||||
SuperActivityToast.create(context, new Style(), Style.TYPE_STANDARD)
|
||||
.setButtonText("UNDO")
|
||||
.setButtonIconResource(R.drawable.back)
|
||||
.setProgressBarColor(Color.WHITE)
|
||||
.setText(info)
|
||||
.setDuration(Style.DURATION_LONG)
|
||||
.setFrame(Style.FRAME_KITKAT)
|
||||
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED))
|
||||
.setAnimations(Style.ANIMATIONS_SCALE).show();
|
||||
}
|
||||
public static void FlyTocenter(Context context, String info){
|
||||
SuperActivityToast.create(context, new Style(), Style.TYPE_STANDARD)
|
||||
.setButtonText("UNDO")
|
||||
.setButtonIconResource(R.drawable.back)
|
||||
.setProgressBarColor(Color.WHITE)
|
||||
.setText(info)
|
||||
.setDuration(Style.DURATION_MEDIUM)
|
||||
.setFrame(Style.FRAME_KITKAT)
|
||||
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BROWN))
|
||||
.setAnimations(Style.ANIMATIONS_FLY).show();
|
||||
}
|
||||
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
package com.example.Util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/*
|
||||
* 发给tomcat服务器的网络请求类
|
||||
* @han
|
||||
* @ongbo
|
||||
* */
|
||||
public class cmkgWebServiceGet {
|
||||
public static ReturnData executeHttpGet(String args,String address){
|
||||
HttpURLConnection connection = null;
|
||||
InputStream in = null;
|
||||
|
||||
String path = publicStringUtil.cmkgTomcatURL+address+args;
|
||||
|
||||
Log.i("path-=",path);
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL(path);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
//打开连接
|
||||
connection = (HttpURLConnection)url.openConnection();
|
||||
//设置请求方式
|
||||
connection.setRequestMethod("GET");//
|
||||
//建立连接超时
|
||||
connection.setConnectTimeout(100000);
|
||||
//传输数据超时
|
||||
connection.setReadTimeout(80000);
|
||||
//获取返回结果json数据
|
||||
in = connection.getInputStream();
|
||||
return parseInfo(in);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(connection != null){
|
||||
connection.disconnect();
|
||||
}
|
||||
if(in != null){
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//将字节流转换成String
|
||||
public static ReturnData parseInfo(InputStream inputStream){
|
||||
BufferedReader reader = null;
|
||||
String line = "";
|
||||
StringBuilder response = new StringBuilder();
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
while((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
jsonObject = new JSONObject(response.toString());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int code = 0;
|
||||
try {
|
||||
code = jsonObject.getInt("code");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("code:",""+code);
|
||||
String message = null;
|
||||
try {
|
||||
message = jsonObject.getString("msg");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Object data = null;
|
||||
try {
|
||||
data = jsonObject.getString("data");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i("data:",""+data);
|
||||
ReturnData returnData = new ReturnData(code,message,data);
|
||||
return returnData;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(reader!=null){
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
package com.example.Util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class cmkgWebServicePost {
|
||||
public static ReturnData execuHttpPost(String args,String address){
|
||||
HttpURLConnection connection = null;
|
||||
InputStream in = null;
|
||||
String path = publicStringUtil.cmkgTomcatURL+address;
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL(path);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setReadTimeout(8000);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestProperty("Content-Type","application/json");
|
||||
connection.connect();
|
||||
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
|
||||
// String data = URLEncoder.encode(args, "UTF-8");
|
||||
Log.i("data",""+args);
|
||||
// "username="+ URLEncoder.encode(username,"UTF-8")+"&phonenumber="+URLEncoder.encode(phonenumber,"UTF-8")+"&password="+URLEncoder.encode(password,"UTF-8");
|
||||
out.writeBytes(args);
|
||||
out.flush();
|
||||
out.close();
|
||||
// int resultCode = connection.getResponseCode();
|
||||
// Log.i("HTTP",resultCode+"");
|
||||
// if(HttpURLConnection.HTTP_OK == resultCode){
|
||||
in = connection.getInputStream();
|
||||
|
||||
return parseInfo(in);
|
||||
// }
|
||||
// return null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(connection != null){
|
||||
connection.disconnect();
|
||||
}
|
||||
if(in != null){
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static ReturnData parseInfo(InputStream inputStream){
|
||||
BufferedReader reader = null;
|
||||
String line = "";
|
||||
StringBuilder response = new StringBuilder();
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
try {
|
||||
while((line = reader.readLine())!=null){
|
||||
Log.d("RegisterActivity",line);
|
||||
response.append(line);
|
||||
}
|
||||
Log.d("RegisterActivity","response.toSring:"+response.toString());
|
||||
|
||||
JSONObject jsonObject = null;
|
||||
ReturnData returnData = null;
|
||||
try {
|
||||
jsonObject = new JSONObject(response.toString());
|
||||
int code = jsonObject.getInt("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
String data = jsonObject.getString("data");
|
||||
returnData = new ReturnData(code,msg,data);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return returnData;
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(reader != null){
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.example.cmknowledgegraph;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class MainContent extends Fragment {
|
||||
|
||||
//创建视图
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate( R.layout.activity_home, container, false ); //要加载的layout文件
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.cmknowledgegraph;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class PersonalityCenterActivity extends AppCompatActivity {
|
||||
@SuppressLint("LongLogTag")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.i("PersonalityCenterActivity","个人中心");
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_personality_center);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.cmknowledgegraph;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.PersonalCenter.Search;
|
||||
|
||||
public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search);
|
||||
// EditText search_edit_frame = findViewById(R.id.search_edit);
|
||||
// ImageButton search_btn = findViewById(R.id.search_btn);
|
||||
// String sickname = search_edit_frame.getText().toString();
|
||||
//
|
||||
// search_btn.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
//// Search search = new Search(sickname);
|
||||
//// search.search();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.example.search;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.PersonalCenter.Search;
|
||||
import com.example.cmknowledgegraph.R;
|
||||
import com.hankcs.hanlp.seg.common.Term;
|
||||
import com.hankcs.hanlp.tokenizer.StandardTokenizer;
|
||||
import com.yalantis.jellytoolbar.listener.JellyListener;
|
||||
import com.yalantis.jellytoolbar.widget.JellyToolbar;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
//
|
||||
public class SearchContent extends Fragment {
|
||||
private static final String TEXT_KEY = "text";
|
||||
AppCompatActivity appCompatActivity;
|
||||
|
||||
public AppCompatActivity getAppCompatActivity() {
|
||||
return appCompatActivity;
|
||||
}
|
||||
|
||||
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
|
||||
this.appCompatActivity = appCompatActivity;
|
||||
}
|
||||
private JellyToolbar toolbar;
|
||||
private AppCompatEditText editText;
|
||||
private JellyListener jellyListener = new JellyListener() {
|
||||
@Override
|
||||
public void onCancelIconClicked() {
|
||||
if (TextUtils.isEmpty(editText.getText())) {
|
||||
toolbar.collapse();
|
||||
} else {
|
||||
editText.getText().clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
public static List<Set<String>> a;
|
||||
public static int k=0;
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate( R.layout.activity_search, container, false ); //要加载的layout文件
|
||||
}
|
||||
|
||||
|
||||
private int getStatusBarHeight() {
|
||||
int result = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
result = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putString(TEXT_KEY, editText.getText().toString());
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
//
|
||||
// @Override
|
||||
// public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
|
||||
// super.onViewStateRestored(savedInstanceState);
|
||||
//
|
||||
// editText.setText(savedInstanceState.getString(TEXT_KEY));
|
||||
// editText.setSelection(editText.getText().length());
|
||||
// }
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
toolbar = (JellyToolbar) appCompatActivity.findViewById(R.id.toolbar);
|
||||
toolbar.getToolbar().setNavigationIcon(R.drawable.ic_menu);
|
||||
toolbar.setJellyListener(jellyListener);
|
||||
toolbar.getToolbar().setPadding(0, getStatusBarHeight(), 0, 0);
|
||||
|
||||
editText = (AppCompatEditText) LayoutInflater.from(appCompatActivity).inflate(R.layout.edit_text, null);
|
||||
editText.setBackgroundResource(R.color.colorTransparent);
|
||||
|
||||
toolbar.setContentView(editText);//添加入输入框
|
||||
|
||||
appCompatActivity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
toolbar.setJellyListener(jellyListener);
|
||||
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if((event != null && KeyEvent.KEYCODE_ENTER == event.getKeyCode() && KeyEvent.ACTION_DOWN == event.getAction())){
|
||||
Log.i("dianjile","你点击了哥哥");
|
||||
toolbar.collapse();
|
||||
editText.getText().clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
// super.onActivityCreated(savedInstanceState);
|
||||
// EditText search_edit = getActivity().findViewById(R.id.search_edit);
|
||||
//
|
||||
// ImageButton search_btn = (ImageButton) getActivity().findViewById(R.id.search_btn);
|
||||
//
|
||||
// search_btn.setOnClickListener(new View.OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// Log.i("haha","=======Oncli");
|
||||
// //查找逻辑
|
||||
// List<Term> termList = StandardTokenizer.segment("什么是糖尿病");
|
||||
// System.out.println(termList);
|
||||
// String sickname = search_edit.getText().toString();
|
||||
// Search search = new Search(sickname);
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// SearchContent.a = search.search();
|
||||
// SearchContent.k = 1;
|
||||
//
|
||||
// }
|
||||
// }).start();
|
||||
// while(SearchContent.k==0) {Log.i("i","i");}
|
||||
// if(SearchContent.a!=null){
|
||||
// String[] medicines = a.get(0).toArray(new String[0]);
|
||||
// String[] reasons = a.get(1).toArray(new String[0]);
|
||||
// ListView lv = getActivity().findViewById(R.id.listView1);
|
||||
// ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,medicines);
|
||||
// lv.setAdapter(adapter);
|
||||
//
|
||||
// }
|
||||
// SearchContent.k=0;
|
||||
// SearchContent.a=null;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.example.cmknowledgegraph;
|
||||
package com.example.tools;
|
||||
|
||||
import com.hankcs.hanlp.HanLP;
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.example.tools;
|
||||
|
||||
public class retuData {
|
||||
public String msg;//接受消息码
|
||||
public Object data;//接受数据
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="800"
|
||||
android:fromDegrees="0.0"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:pivotX="50.0%"
|
||||
android:pivotY="50.0%"
|
||||
|
||||
android:repeatCount="infinite"
|
||||
android:toDegrees="-360.0" />
|
||||
<!-- // 设置动画持续时间-->
|
||||
<!-- // 设置动画开始时的角度-->
|
||||
<!-- // 设置动画相对于控件的x坐标的位置-->
|
||||
<!-- 设置动画相对于控件的y坐标的位置-->
|
||||
<!-- 设置无线循环-->
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="800"
|
||||
android:fromDegrees="0.0"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:pivotX="50.0%"
|
||||
android:pivotY="50.0%"
|
||||
|
||||
android:repeatCount="infinite"
|
||||
android:toDegrees="360.0" />
|
||||
<!-- // 设置动画持续时间-->
|
||||
<!-- // 设置动画开始时的角度-->
|
||||
<!-- // 设置动画相对于控件的x坐标的位置-->
|
||||
<!-- 设置动画相对于控件的y坐标的位置-->
|
||||
<!-- 设置无线循环-->
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="150"
|
||||
android:interpolator="@android:anim/linear_interpolator">
|
||||
<translate
|
||||
android:fromYDelta="80%p"
|
||||
android:toYDelta="0" />
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0" />
|
||||
</set>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="150"
|
||||
android:interpolator="@android:anim/linear_interpolator">
|
||||
<translate
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="-80%p" />
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:dither="true"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="4dp"/>
|
||||
<solid android:color="#4b405c"/>
|
||||
|
||||
</shape>
|
After Width: | Height: | Size: 452 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 437 B |
After Width: | Height: | Size: 410 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 505 B |
After Width: | Height: | Size: 608 B |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 935 B |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 498 B |
After Width: | Height: | Size: 578 B |
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 498 B |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 560 B |