Skip to content

Commit

Permalink
增加activity单独设置,优化Demo,文档更新
Browse files Browse the repository at this point in the history
  • Loading branch information
likaiyuan559 committed Jun 12, 2019
1 parent ddae94d commit fa201d5
Show file tree
Hide file tree
Showing 33 changed files with 828 additions and 171 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ TouchEffects能够帮助你更快速方便的增加点击时候的效果,Touch
|:---------------------------------------------------------------------------:|:----------------------------------------------------------------------------:|
| ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/scale.gif) | ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/ripple.gif) |

| 渐变效果 | 个性化设置 |
|:---------------------------------------------------------------------------:|:-----------------------------------------------------------------------:|
| ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/state.gif) | ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/p.gif) |
| 渐变效果 | 水波纹1设置 |
|:---------------------------------------------------------------------------:|:-----------------------------------------------------------------------------:|
| ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/state.gif) | ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/ripple1.gif) |

| 抖动效果 | 个性化设置 |
|:---------------------------------------------------------------------------:|:----------------------------------------------------------------------------------:|
| ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/shake.gif) | ![](https://github.com/likaiyuan559/TouchEffects/blob/master/gif/personalized.gif) |



## 简单用例

Expand Down
16 changes: 13 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@
android:supportsRtl="true"
android:name=".TouchEffectsApplication"
android:theme="@style/AppTheme">
<activity android:name=".TouchEffectsMainActivity"
<activity android:name=".activity.TouchEffectsMainActivity"
android:label="点击特效示例">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TouchEffectsPersonalizedSettingsActivity"
<activity android:name=".activity.TouchEffectsPersonalizedSettingsActivity"
android:label="个性化设置"/>
<activity android:name=".TouchEffectsListActivity"
<activity android:name=".activity.TouchEffectsListActivity"
android:label="列表示例"/>
<activity android:name=".activity.TouchEffectsScaleActivity"
android:label="缩放效果演示"/>
<activity android:name=".activity.TouchEffectsRippleActivity"
android:label="水波纹效果演示"/>
<activity android:name=".activity.TouchEffectsRipple1Activity"
android:label="水波纹1效果演示"/>
<activity android:name=".activity.TouchEffectsStateActivity"
android:label="渐变效果演示"/>
<activity android:name=".activity.TouchEffectsShakeActivity"
android:label="抖动效果演示"/>
</application>

</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lky.toucheffectsviewdemo;
package com.lky.toucheffectsviewdemo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
Expand All @@ -10,7 +10,11 @@ public class TouchEffectsBaseActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
TouchEffectsFactory.initTouchEffects(this);
initTouchEffects();
super.onCreate(savedInstanceState);
}

protected void initTouchEffects() {
TouchEffectsFactory.initTouchEffects(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lky.toucheffectsviewdemo;
package com.lky.toucheffectsviewdemo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
Expand All @@ -9,6 +9,8 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.lky.toucheffectsviewdemo.R;

public class TouchEffectsListActivity extends TouchEffectsBaseActivity{

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.lky.toucheffectsviewdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lky.toucheffectsmodule.TouchEffectsManager;
import com.lky.toucheffectsmodule.types.TouchEffectsViewType;
import com.lky.toucheffectsmodule.types.TouchEffectsWholeType;
import com.lky.toucheffectsviewdemo.R;
import com.lky.toucheffectsviewdemo.bean.JumpBean;

import java.util.ArrayList;

public class TouchEffectsMainActivity extends TouchEffectsBaseActivity implements View.OnClickListener{

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.touch_effects_activity_main);

ArrayList<JumpBean> jumpArrayList = new ArrayList<>();
jumpArrayList.add(new JumpBean("缩放效果示例",TouchEffectsScaleActivity.class));
jumpArrayList.add(new JumpBean("水波纹效果示例",TouchEffectsRippleActivity.class));
jumpArrayList.add(new JumpBean("水波纹1效果示例",TouchEffectsRipple1Activity.class));
jumpArrayList.add(new JumpBean("渐变效果示例",TouchEffectsStateActivity.class));
jumpArrayList.add(new JumpBean("抖动效果示例",TouchEffectsShakeActivity.class));
jumpArrayList.add(new JumpBean("列表效果示例",TouchEffectsListActivity.class));
jumpArrayList.add(new JumpBean("个性化设置示例",TouchEffectsPersonalizedSettingsActivity.class));

RecyclerView recyclerView = findViewById(R.id.touch_effects_main_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
RecyclerAdapter adapter = new RecyclerAdapter(jumpArrayList);
recyclerView.setAdapter(adapter);


}

class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

private ArrayList<JumpBean> mJumpArrayList;


public RecyclerAdapter(ArrayList<JumpBean> jumpArrayList) {
mJumpArrayList = jumpArrayList;
}

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.touch_effects_layout_list_item,parent,false));
}

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
bindHolder((ViewHolder)holder,position);
}

private void bindHolder(ViewHolder holder, int position) {
((TextView)holder.itemView).setText(mJumpArrayList.get(position).getTitleName());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(TouchEffectsMainActivity.this,mJumpArrayList.get(position).getJumpClass()));
}
});
}

@Override
public int getItemCount() {
return mJumpArrayList.size();
}

class ViewHolder extends RecyclerView.ViewHolder{
public ViewHolder(View itemView) {
super(itemView);
}
}

}

@Override
public void onClick(View v) {

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.lky.toucheffectsviewdemo;
package com.lky.toucheffectsviewdemo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.lky.toucheffectsviewdemo.R;

public class TouchEffectsPersonalizedSettingsActivity extends TouchEffectsBaseActivity implements View.OnClickListener {

@Override
Expand All @@ -17,6 +19,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
findViewById(R.id.single_state_txt).setOnClickListener(this);
findViewById(R.id.single_state_round_txt).setOnClickListener(this);
findViewById(R.id.single_shake_txt).setOnClickListener(this);
findViewById(R.id.single_ripple_color_txt).setOnClickListener(this);
findViewById(R.id.single_ripple_1_txt).setOnClickListener(this);
findViewById(R.id.single_ripple_round_1_txt).setOnClickListener(this);
findViewById(R.id.single_ripple_color_1_txt).setOnClickListener(this);
findViewById(R.id.single_state_color_txt).setOnClickListener(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.lky.toucheffectsviewdemo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.lky.toucheffectsmodule.factory.TouchEffectsFactory;
import com.lky.toucheffectsmodule.types.TouchEffectsWholeType;
import com.lky.toucheffectsviewdemo.R;

public class TouchEffectsRipple1Activity extends TouchEffectsBaseActivity implements View.OnClickListener{

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_touch_effects_sample);

findViewById(R.id.touch_effects_sample_txt).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_btn).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_img).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_ib).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_fl).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_ll).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_rl).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_cl).setOnClickListener(this);
}

@Override
protected void initTouchEffects() {
TouchEffectsFactory.initTouchEffects(this,TouchEffectsWholeType.RIPPLE_1);
}

@Override
public void onClick(View v) {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.lky.toucheffectsviewdemo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.lky.toucheffectsmodule.factory.TouchEffectsFactory;
import com.lky.toucheffectsmodule.types.TouchEffectsWholeType;
import com.lky.toucheffectsviewdemo.R;

public class TouchEffectsRippleActivity extends TouchEffectsBaseActivity implements View.OnClickListener{

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_touch_effects_sample);

findViewById(R.id.touch_effects_sample_txt).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_btn).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_img).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_ib).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_fl).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_ll).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_rl).setOnClickListener(this);
findViewById(R.id.touch_effects_sample_cl).setOnClickListener(this);

}

@Override
protected void initTouchEffects() {
TouchEffectsFactory.initTouchEffects(this,TouchEffectsWholeType.RIPPLE);
}

@Override
public void onClick(View v) {

}

}
Loading

0 comments on commit fa201d5

Please sign in to comment.