-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split project&&Supprt horizontal refresh
- Loading branch information
Showing
111 changed files
with
1,810 additions
and
550 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
app/src/main/java/me/dkzwm/widget/srl/sample/ui/TestHorizontalRefreshActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package me.dkzwm.widget.srl.sample.ui; | ||
|
||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.widget.Toast; | ||
|
||
import me.dkzwm.widget.srl.RefreshingListenerAdapter; | ||
import me.dkzwm.widget.srl.SmoothRefreshLayout; | ||
import me.dkzwm.widget.srl.extra.footer.HorizontalMaterialFooter; | ||
import me.dkzwm.widget.srl.extra.header.HorizontalMaterialHeader; | ||
import me.dkzwm.widget.srl.sample.R; | ||
import me.dkzwm.widget.srl.utils.PixelUtl; | ||
|
||
/** | ||
* Created by dkzwm on 2017/9/13. | ||
* | ||
* @author dkzwm | ||
*/ | ||
|
||
public class TestHorizontalRefreshActivity extends AppCompatActivity { | ||
private SmoothRefreshLayout mRefreshLayout; | ||
private Handler mHandler = new Handler(); | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_test_horizontal_refresh); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
getSupportActionBar().setDisplayShowHomeEnabled(true); | ||
getSupportActionBar().setTitle(R.string.test_nested_horizontal_views); | ||
mRefreshLayout = (SmoothRefreshLayout) findViewById(R.id | ||
.smoothRefreshLayout_test_horizontal_refresh); | ||
HorizontalMaterialHeader header = new HorizontalMaterialHeader(this); | ||
header.setColorSchemeColors(new int[]{Color.RED, Color.BLUE, Color | ||
.GREEN, Color.BLACK}); | ||
header.setPadding(PixelUtl.dp2px(this, 25), 0, PixelUtl.dp2px(this, 25), 0); | ||
mRefreshLayout.setHeaderView(header); | ||
HorizontalMaterialFooter footer = new HorizontalMaterialFooter(this); | ||
footer.setProgressBarColors(new int[]{Color.RED, Color.BLUE, Color | ||
.GREEN, Color.BLACK}); | ||
mRefreshLayout.setFooterView(footer); | ||
mRefreshLayout.setDisableLoadMore(false); | ||
mRefreshLayout.setDisablePerformLoadMore(false); | ||
mRefreshLayout.setEnableKeepRefreshView(true); | ||
mRefreshLayout.setDisableWhenAnotherDirectionMove(true); | ||
mRefreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() { | ||
@Override | ||
public void onRefreshBegin(boolean isRefresh) { | ||
mHandler.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
mRefreshLayout.refreshComplete(); | ||
Toast.makeText(TestHorizontalRefreshActivity.this, | ||
R.string.sr_refresh_complete, Toast.LENGTH_SHORT).show(); | ||
} | ||
}, 4000); | ||
} | ||
}); | ||
mRefreshLayout.setOffsetRatioToKeepRefreshViewWhileLoading(1); | ||
mRefreshLayout.setRatioOfRefreshViewHeightToRefresh(1); | ||
mRefreshLayout.autoRefresh(false); | ||
} | ||
|
||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
onBackPressed(); | ||
return true; | ||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
|
||
|
||
@Override | ||
public void onBackPressed() { | ||
startActivity(new Intent(TestHorizontalRefreshActivity.this, MainActivity.class)); | ||
finish(); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
mHandler.removeCallbacksAndMessages(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.