Commit 1eefe1ac by 许梦竹

add originCode

parents
File added
File added
This diff is collapsed. Click to expand it.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.danding.yang800"
minSdkVersion 17
targetSdkVersion 23
versionCode 8
versionName APP_VERSION
multiDexEnabled true
}
signingConfigs {
release {
storeFile file("yang800.keystore.jks")
storePassword "1234567890"
keyAlias "yang800"
keyPassword "1234567890"
}
}
buildTypes {
debug {
signingConfig signingConfigs.release
zipAlignEnabled true
}
release {
signingConfig signingConfigs.release
zipAlignEnabled true
}
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "Boolean", "TEST", "false"
buildConfigField "String", "HOSTURL", "\"shop.yang800.com\""
// buildConfigField "String", "HOSTURL", "\"shoptest.yang800.cn\""
// buildConfigField "String", "HOSTURL", "\"shop.yang800.com\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.102:6081\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.128:6081\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.104:6081\""
buildConfigField "String", "SECRET", SECRET
}
debug {
buildConfigField "Boolean", "TEST", "true"
// buildConfigField "String", "HOSTURL", "\"shop.yang800.com\""
buildConfigField "String", "HOSTURL", "\"shoptest.yang800.cn\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.53:6083\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.128:6081\""
// buildConfigField "String", "HOSTURL", "\"192.168.20.104:6081\""
buildConfigField "String", "SECRET", DEBUG_SECRET
}
}
}
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/Volley.jar')
compile files('libs/core-3.0.0.jar')
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile files('libs/nineoldanimatin.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.zhy:autolayout:1.4.5'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.jakewharton:butterknife:8.0.1'
compile files('libs/systembartint-1.0.4.jar')
compile 'com.github.chrisbanes.photoview:library:1.2.2'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v2.0.5'
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/umeng_social_shareboard.jar')
compile files('libs/umeng_shareboard_widget.jar')
compile files('libs/umeng_social_shareview.jar')
compile files('main/libs/umeng_social_api.jar')
compile files('main/libs/umeng_social_net.jar')
compile files('main/libs/umeng_social_tool.jar')
compile 'com.qiyukf.unicorn:unicorn:3.9.0'
compile files('libs/commons-codec-1.2.jar')
compile 'org.apache.httpcomponents:httpcore:4.4.2'
compile 'com.tencent.bugly:crashreport:latest.release'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.google.guava:guava:19.0'
compile 'com.lzy.net:okgo:3.0.4'
compile 'com.github.open-android:Glide-transformations:0.1.0'
compile files('libs/alipaySdk-20170922.jar')
compile 'com.umeng.sdk:common:latest.integration'
compile 'com.umeng.sdk:analytics:latest.integration'
compile 'com.yanzhenjie:sofia:1.0.4'
}
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp"
android:color="#ffffff"
/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp"
android:color="#C3C6C9"
/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<RelativeLayout
android:layout_width="match_parent"
android:background="#0086DC"
android:id="@+id/umeng_socialize_titlebar"
android:layout_height="54dp">
<TextView
android:layout_width="wrap_content"
android:id="@+id/umeng_title"
android:textSize="18sp"
android:text=""
android:textColor="#ffffff"
android:layout_centerInParent="true"
android:layout_height="wrap_content" />
<RelativeLayout
android:layout_width="60dp"
android:id="@+id/umeng_back"
android:visibility="visible"
android:onClick="onCancel"
android:layout_height="match_parent">
<ImageButton
android:scaleType="center"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:background="@drawable/umeng_socialize_back_icon"
android:layout_width="12dp"
android:layout_height="20dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="分享"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:id="@+id/umeng_share_btn"
android:padding="4dp"
android:background="@drawable/umeng_socialize_btn_bg"
android:textColor="#ffffff"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/umeng_socialize_follow"
android:layout_width="fill_parent"
android:layout_height="38dp"
android:layout_alignParentBottom="true"
android:visibility="visible" >
<CheckBox
android:id="@+id/umeng_socialize_follow_check"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="2dp"
android:layout_toRightOf="@id/umeng_socialize_follow_check"
android:textSize="14sp"
android:text="关注官方微博"
android:textColor="#949BA4" />
</RelativeLayout>
<!--<LinearLayout-->
<!--android:id="@+id/webView_container"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_above="@id/umeng_socialize_follow"-->
<!--android:layout_below="@id/umeng_socialize_titlebar"-->
<!--android:orientation="horizontal"-->
<!--android:visibility="visible" />-->
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#F2F5F6"
android:layout_above="@id/umeng_socialize_follow"
android:layout_below="@id/umeng_socialize_titlebar"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/progress_bar_parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/umeng_socialize_follow"
android:layout_below="@id/umeng_socialize_titlebar"
android:background="#F2F5F6" >
<LinearLayout
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:orientation="horizontal" >
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="10dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#D4E0E5">
<RelativeLayout android:id="@+id/umeng_socialize_titlebar" android:layout_width="match_parent"
android:layout_height="54dp" android:background="#0086DC">
<TextView android:id="@+id/umeng_title" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_centerInParent="true"
android:text="" android:textColor="#ffffff" android:textSize="18sp" />
<RelativeLayout android:id="@+id/umeng_back" android:layout_width="60dp"
android:layout_height="match_parent"
android:onClick="onCancel" android:visibility="visible">
<ImageButton
android:layout_width="12dp" android:layout_height="20dp"
android:layout_centerVertical="true" android:layout_marginLeft="15dp"
android:background="@drawable/umeng_socialize_back_icon"
android:scaleType="center" />
</RelativeLayout>
<TextView android:id="@+id/umeng_share_btn" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentRight="true"
android:layout_centerInParent="true" android:layout_marginRight="10dp"
android:background="@drawable/umeng_socialize_btn_bg" android:padding="4dp"
android:text="分享" android:textColor="#ffffff" />
</RelativeLayout>
<RelativeLayout android:id="@+id/umeng_socialize_follow" android:layout_width="fill_parent"
android:layout_height="40dp" android:layout_alignParentBottom="true"
android:background="#AAAAAA" android:visibility="visible">
<CheckBox android:id="@+id/umeng_socialize_follow_check" android:layout_width="20dp"
android:layout_height="20dp" android:layout_centerVertical="true"
android:layout_marginLeft="20dp" android:checked="true" android:visibility="gone" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/umeng_socialize_follow_check" android:text="关注官方微博"
android:textColor="#f8f8f8" android:textSize="16sp" android:visibility="gone" />
</RelativeLayout>
<!--<LinearLayout-->
<!--android:id="@+id/webView_container"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_above="@id/umeng_socialize_follow"-->
<!--android:layout_below="@id/umeng_socialize_titlebar"-->
<!--android:orientation="horizontal"-->
<!--android:visibility="visible" />-->
<WebView android:id="@+id/webView" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_above="@id/umeng_socialize_follow"
android:layout_below="@id/umeng_socialize_titlebar" android:background="#F2F5F6"
android:visibility="visible" />
<RelativeLayout android:id="@+id/progress_bar_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_below="@id/umeng_socialize_titlebar"
android:background="#F2F5F6">
<LinearLayout android:layout_width="80dp" android:layout_height="80dp"
android:layout_centerInParent="true" android:orientation="horizontal">
<ProgressBar android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_margin="10dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><resources>
<color name="umeng_socialize_comments_bg">#F4F4F4</color>
<color name="umeng_socialize_color_group">#2c3035</color>
<color name="umeng_socialize_list_item_textcolor">#333333</color>
<color name="umeng_socialize_list_item_bgcolor">#FFFFFF</color>
<color name="umeng_socialize_divider">#E6E6E6</color>
<color name="umeng_socialize_text_time">#999999</color>
<color name="umeng_socialize_text_title">#464f61</color>
<color name="umeng_socialize_text_friends_list">#959696</color>
<color name="umeng_socialize_text_share_content">#666666</color>
<color name="umeng_socialize_ucenter_bg">#EEEEEE</color>
<color name="umeng_socialize_text_ucenter">#595959</color>
<color name="umeng_socialize_edit_bg">#C4C4C4</color>
<color name="umeng_socialize_grid_divider_line">#F8F8F8</color>
<color name="umeng_socialize_web_bg">#F4F4F4</color>
<color name="umeng_socialize_shareactivity">#D4E0E5</color>
<color name="umeng_socialize_shareactivitydefault">#ffffff</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="alphabet_size">12dip</dimen>
<dimen name="umeng_socialize_pad_window_height">350dip</dimen>
<dimen name="umeng_socialize_pad_window_width">580dip</dimen>
<!-- 平台名称 -->
<string name="umeng_socialize_text_tencent_key">腾讯微博</string>
<string name="umeng_socialize_text_wenxin_fav">微信收藏</string>
<string name="umeng_socialize_text_sina_key">微博</string>
<string name="umeng_socialize_text_qq_key">QQ</string>
<string name="umeng_socialize_text_qq_zone_key">QQ空间</string>
<string name="umeng_socialize_text_renren_key">人人网</string>
<string name="umeng_socialize_text_douban_key">豆瓣</string>
<string name="umeng_socialize_text_weixin_key">微信</string>
<string name="umeng_socialize_text_weixin_circle_key">微信朋友圈</string>
<string name="umeng_socialize_text_weixin_fav_key">微信收藏</string>
<string name="umeng_socialize_text_add_custom_platform">请配置用户平台</string>
<string name="umeng_example_home_btn_plus">社交分享</string>
<string name="umeng_socialize_text_waitting_share">分享中&#8230;</string>
<string name="umeng_socialize_content_hint">说点啥&#8230;</string>
<string name="umeng_socialize_cancel_btn_str">取消</string>
<string name="umeng_socialize_send_btn_str">发送</string>
<string name="umeng_socialize_female"></string>
<string name="umeng_socialize_male"></string>
<string name="umeng_socialize_share">分享</string>
<string name="umeng_socialize_mail">邮件</string>
<string name="umeng_socialize_sms">短信</string>
<string name="umeng_socialize_sina">新浪</string>
<string name="umeng_socialize_text_yixin_key">易信</string>
<string name="umeng_socialize_text_yixincircle_key">易信朋友圈</string>
<string name="umeng_socialize_text_laiwangdynamic_key">点点虫动态</string>
<string name="umeng_socialize_text_evernote_key">印象笔记</string>
<string name="umeng_socialize_text_ydnote_key">有道云笔记</string>
<string name="umeng_socialize_text_facebook_key">Facebook</string>
<string name="umeng_socialize_text_facebookmessager_key">Facebook Messager</string>
<string name="umeng_socialize_text_twitter_key">Twitter</string>
<string name="umeng_socialize_text_instagram_key">Instagram</string>
<string name="umeng_socialize_text_pinterest_key">Pinterest</string>
<string name="umeng_socialize_text_pocket_key">Pocket</string>
<string name="umeng_socialize_text_linkedin_key">Linkedin</string>
<string name="umeng_socialize_text_foursquare_key">Foursquare</string>
<string name="umeng_socialize_text_whatsapp_key">WhatsApp</string>
<string name="umeng_socialize_text_line_key">LINE</string>
<string name="umeng_socialize_text_flickr_key">Flickr</string>
<string name="umeng_socialize_text_tumblr_key">Tumblr</string>
<string name="umeng_socialize_text_alipay_key">支付宝</string>
<string name="umeng_socialize_text_kakao_key">KakaoTalk</string>
<string name="umeng_socialize_text_googleplus_key">GooglePlus</string>
<string name="umeng_socialize_text_more_key">更多</string>
<string name="umeng_socialize_text_dingding_key">钉钉</string>
<string name="umeng_socialize_text_vkontakte_key">VKontakte</string>
<string name="umeng_socialize_text_dropbox_key">DropBox</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ACPLDialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="umeng_socialize_action_bar_itemlayout">
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:gravity">center_vertical</item>
</style>
<style name="umeng_socialize_action_bar_item_im">
<item name="android:layout_width">25dp</item>
<item name="android:layout_height">25dp</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:layout_centerVertical">true</item>
</style>
<style name="umeng_socialize_action_bar_item_tv">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:text">999</item>
<item name="android:gravity">center</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="umeng_socialize_popup_dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.6</item>
</style>
<style name="Theme.UMDialog" parent="android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="Theme.UMDefault" parent="android:style/Theme.NoTitleBar"></style>
<style name="umeng_socialize_divider">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">@color/umeng_socialize_divider</item>
</style>
<style name="umeng_socialize_list_item">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">55dp</item>
<item name="android:background">@color/umeng_socialize_list_item_bgcolor</item>
<item name="android:paddingBottom">5dp</item>
<item name="android:paddingTop">5dp</item>
</style>
<style name="umeng_socialize_edit_padding">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:background">@color/umeng_socialize_list_item_bgcolor</item>
<item name="android:layout_marginLeft">6dp</item>
<item name="android:layout_marginRight">6dp</item>
<item name="android:layout_marginTop">6dp</item>
<item name="android:layout_marginBottom">6dp</item>
</style>
</resources>
\ No newline at end of file
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in F:\androidstudio\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
#Glide
package com.danding.yang800;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
\ No newline at end of file
package com.danding.yang800;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.View.XScrollView;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
*关于页
* */
public class AboutActivity extends BaseActivity {
@BindView(R.id.about_backTv)
TextView about_backTv;
@BindView(R.id.about_scrollView)
XScrollView about_scrollView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_about);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
ButterKnife.bind(this);
about_scrollView.setPullRefreshEnable(false);
about_scrollView.setPullLoadEnable(false);
View content = LayoutInflater.from(this).inflate(R.layout.about_content, null);
about_scrollView.setView(content);
}
@OnClick({R.id.about_backTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.about_backTv:
finish();
break;
}
}
}
package com.danding.yang800;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.danding.yang800.Adapter.AccountDetailedAdapter;
import com.danding.yang800.Presenter.AccountDetailedActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.View.NetworkProgressDialog;
import com.danding.yang800.View.XListView;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AccountDetailedActivity extends BaseActivity implements XListView.IXListViewListener {
@BindView(R.id.account_detailed_List)
XListView account_detailed_List;
AccountDetailedAdapter adapter;
@BindView(R.id.accountDetailed_backTv)
TextView accountDetailed_backTv;
AccountDetailedActivityPresenter presenter;
private NetworkProgressDialog pd;
int page = 1;
String storeId = "";
private int Count = 0;
SharedPreferences sp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_account_detailed);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
ButterKnife.bind(this);
storeId = sp.getString("storeId", "");
account_detailed_List.setPullRefreshEnable(false);
account_detailed_List.setPullLoadEnable(true);
account_detailed_List.setAutoLoadEnable(true);
account_detailed_List.setXListViewListener(this);
adapter = new AccountDetailedAdapter(this);
presenter = new AccountDetailedActivityPresenter(this, adapter);
presenter.accountDetail(storeId, page + "");
// account_detailed_List.removeFootView();
}
@OnClick({R.id.accountDetailed_backTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.accountDetailed_backTv:
finish();
break;
}
}
@Override
public void onRefresh() {
page = 1;
onLoad();
if (adapter != null) {
adapter.clear();
}
presenter.accountDetail(storeId, page + "");
}
@Override
public void onLoadMore() {
if (adapter.getLists().size() < Count && adapter.getLists().size() > 0) {
page++;
presenter.accountDetail(storeId, page + "");
} else {
account_detailed_List.setPullLoadEnable(false);
onLoad();
}
}
public void onLoad() {
account_detailed_List.stopRefresh();
account_detailed_List.stopLoadMore();
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
public void upadateAdapter(int totalCount) {
Count = totalCount;
if (adapter.getLists().size() > 0 && adapter.getLists().size() != totalCount) {
account_detailed_List.setPullLoadEnable(true);
} else {
account_detailed_List.setPullLoadEnable(false);
}
account_detailed_List.setAdapter(adapter);
adapter.notifyDataSetChanged();
onLoad();
}
}
/*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.danding.yang800.Adapter;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import java.util.LinkedList;
import java.util.List;
/**
* Abstract Wheel adapter.
*/
public abstract class AbstractWheelAdapter implements WheelViewAdapter {
// Observers
private List<DataSetObserver> datasetObservers;
@Override
public View getEmptyItem(View convertView, ViewGroup parent) {
return null;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
if (datasetObservers == null) {
datasetObservers = new LinkedList<DataSetObserver>();
}
datasetObservers.add(observer);
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
if (datasetObservers != null) {
datasetObservers.remove(observer);
}
}
/**
* Notifies observers about data changing
*/
protected void notifyDataChangedEvent() {
if (datasetObservers != null) {
for (DataSetObserver observer : datasetObservers) {
observer.onChanged();
}
}
}
/**
* Notifies observers about invalidating data
*/
protected void notifyDataInvalidatedEvent() {
if (datasetObservers != null) {
for (DataSetObserver observer : datasetObservers) {
observer.onInvalidated();
}
}
}
}
/*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.danding.yang800.Adapter;
import android.content.Context;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* Abstract wheel adapter provides common functionality for adapters.
*/
public abstract class AbstractWheelTextAdapter extends AbstractWheelAdapter {
/**
* Text view resource. Used as a default view for adapter.
*/
public static final int TEXT_VIEW_ITEM_RESOURCE = -1;
/**
* No resource constant.
*/
protected static final int NO_RESOURCE = 0;
/**
* Default text color
*/
public static final int DEFAULT_TEXT_COLOR = 0xFF5f6467;
/**
* Default text color
*/
public static final int LABEL_COLOR = 0xFF700070;
/**
* Default text size
*/
public static int DEFAULT_TEXT_SIZE = 14;
// Text settings
private int textColor = DEFAULT_TEXT_COLOR;
private int textSize = DEFAULT_TEXT_SIZE;
// Current context
protected Context context;
// Layout inflater
protected LayoutInflater inflater;
// Items resources
protected int itemResourceId;
protected int itemTextResourceId;
// Empty items resources
protected int emptyItemResourceId;
/**
* Constructor
*
* @param context the current context
*/
protected AbstractWheelTextAdapter(Context context) {
this(context, TEXT_VIEW_ITEM_RESOURCE);
}
/**
* Constructor
*
* @param context the current context
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
*/
protected AbstractWheelTextAdapter(Context context, int itemResource) {
this(context, itemResource, NO_RESOURCE);
}
/**
* Constructor
*
* @param context the current context
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
* @param itemTextResource the resource ID for a text view in the item layout
*/
protected AbstractWheelTextAdapter(Context context, int itemResource, int itemTextResource) {
this.context = context;
itemResourceId = itemResource;
itemTextResourceId = itemTextResource;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
/**
* Gets text color
*
* @return the text color
*/
public int getTextColor() {
return textColor;
}
/**
* Sets text color
*
* @param textColor the text color to set
*/
public void setTextColor(int textColor) {
this.textColor = textColor;
}
/**
* Gets text size
*
* @return the text size
*/
public int getTextSize() {
return textSize;
}
/**
* Sets text size
*
* @param textSize the text size to set
*/
public void setTextSize(int textSize) {
this.textSize = textSize;
}
/**
* Gets resource Id for items views
*
* @return the item resource Id
*/
public int getItemResource() {
return itemResourceId;
}
/**
* Sets resource Id for items views
*
* @param itemResourceId the resource Id to set
*/
public void setItemResource(int itemResourceId) {
this.itemResourceId = itemResourceId;
}
/**
* Gets resource Id for text view in item layout
*
* @return the item text resource Id
*/
public int getItemTextResource() {
return itemTextResourceId;
}
/**
* Sets resource Id for text view in item layout
*
* @param itemTextResourceId the item text resource Id to set
*/
public void setItemTextResource(int itemTextResourceId) {
this.itemTextResourceId = itemTextResourceId;
}
/**
* Gets resource Id for empty items views
*
* @return the empty item resource Id
*/
public int getEmptyItemResource() {
return emptyItemResourceId;
}
/**
* Sets resource Id for empty items views
*
* @param emptyItemResourceId the empty item resource Id to set
*/
public void setEmptyItemResource(int emptyItemResourceId) {
this.emptyItemResourceId = emptyItemResourceId;
}
/**
* Returns text for specified item
*
* @param index the item index
* @return the text of specified items
*/
protected abstract CharSequence getItemText(int index);
@Override
public View getItem(int index, View convertView, ViewGroup parent) {
if (index >= 0 && index < getItemsCount()) {
if (convertView == null) {
convertView = getView(itemResourceId, parent);
}
TextView textView = getTextView(convertView, itemTextResourceId);
if (textView != null) {
CharSequence text = getItemText(index);
if (text == null) {
text = "";
}
textView.setText(text);
if (itemResourceId == TEXT_VIEW_ITEM_RESOURCE) {
configureTextView(textView);
}
}
return convertView;
}
return null;
}
@Override
public View getEmptyItem(View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getView(emptyItemResourceId, parent);
}
if (emptyItemResourceId == TEXT_VIEW_ITEM_RESOURCE && convertView instanceof TextView) {
configureTextView((TextView) convertView);
}
return convertView;
}
/**
* Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
*
* @param view the text view to be configured
*/
protected void configureTextView(TextView view) {
view.setTextColor(textColor);
view.setGravity(Gravity.CENTER);
view.setTextSize(textSize);
view.setEllipsize(TextUtils.TruncateAt.END);
view.setLines(1);
// view.setCompoundDrawablePadding(20);
// view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
/**
* Loads a text view from view
*
* @param view the text view or layout containing it
* @param textResource the text resource Id in layout
* @return the loaded text view
*/
private TextView getTextView(View view, int textResource) {
TextView text = null;
try {
if (textResource == NO_RESOURCE && view instanceof TextView) {
text = (TextView) view;
} else if (textResource != NO_RESOURCE) {
text = (TextView) view.findViewById(textResource);
}
} catch (ClassCastException e) {
throw new IllegalStateException(
"AbstractWheelAdapter requires the resource ID to be a TextView", e);
}
return text;
}
/**
* Loads view from resources
*
* @param resource the resource Id
* @return the loaded view or null if resource is not set
*/
private View getView(int resource, ViewGroup parent) {
switch (resource) {
case NO_RESOURCE:
return null;
case TEXT_VIEW_ITEM_RESOURCE:
return new TextView(context);
default:
return inflater.inflate(resource, parent, false);
}
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.AccountDetailedInfo;
import com.danding.yang800.Entity.DetailsInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class AccountDetailedAdapter extends MyBaseAdapter<AccountDetailedInfo> {
public AccountDetailedAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.account_detailed_adapter, null);
info = new Info();
info.account_detailed_adapterTv = (TextView) convertView.findViewById(R.id.account_detailed_adapterTv);
info.account_detailed_adapterTimeTv = (TextView) convertView.findViewById(R.id.account_detailed_adapterTimeTv);
info.account_detailed_adapterMoneyTv = (TextView) convertView.findViewById(R.id.account_detailed_adapterMoneyTv);
info.account_detailed_adapterOrderTv = (TextView) convertView.findViewById(R.id.account_detailed_adapterOrderTv);
// info.details_name = (TextView) convertView.findViewById(R.id.details_name);
// info.details_price = (TextView) convertView.findViewById(R.id.details_price);
// info.details_number = (TextView) convertView.findViewById(R.id.details_number);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
// Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.shouye).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.details_image);
info.account_detailed_adapterTv.setText(getItem(position).getOrder());
info.account_detailed_adapterTimeTv.setText(getItem(position).getTime());
if (getItem(position).getMoney().contains("-")){
info.account_detailed_adapterMoneyTv.setText(getItem(position).getMoney());
}else {
info.account_detailed_adapterMoneyTv.setText("+"+getItem(position).getMoney());
}
if (getItem(position).getPackageSn().equals("")){
info.account_detailed_adapterOrderTv.setVisibility(View.GONE);
}else {
info.account_detailed_adapterOrderTv.setVisibility(View.VISIBLE);
info.account_detailed_adapterOrderTv.setText(getItem(position).getPackageSn());
}
info.account_detailed_adapterTimeTv.setText(getItem(position).getTime());
info.account_detailed_adapterTv.setText(getItem(position).getOrder());
// info.details_price.setText("¥" + getItem(position).getPrice());
// info.details_number.setText("x" + getItem(position).getNumber());
return convertView;
}
class Info {
TextView account_detailed_adapterTv;
TextView account_detailed_adapterTimeTv;
TextView account_detailed_adapterMoneyTv;
TextView account_detailed_adapterOrderTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.AfterServiceInfo;
import com.danding.yang800.Entity.DetailsInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class AfterServiceAdapter extends MyBaseAdapter<AfterServiceInfo> {
public AfterServiceAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.afterservice_adapter, null);
info = new Info();
info.afterservice_imageIv = (ImageView) convertView.findViewById(R.id.afterservice_imageIv);
info.afterservice_nameTv = (TextView) convertView.findViewById(R.id.afterservice_nameTv);
info.afterservice_numberTv = (TextView) convertView.findViewById(R.id.afterservice_numberTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.huisebeijing).
diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.afterservice_imageIv);
info.afterservice_nameTv.setText(getItem(position).getName());
info.afterservice_numberTv.setText("x" + getItem(position).getNumber());
return convertView;
}
class Info {
ImageView afterservice_imageIv;
TextView afterservice_nameTv;
TextView afterservice_numberTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class AideAdapter extends MyBaseAdapter<SortListInfo> {
public AideAdapter(Context context) {
super(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.aide_item, null);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
return convertView;
}
class Info {
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.OrderInfo;
import com.danding.yang800.LogisticsActivity;
import com.danding.yang800.OrderManageActivity;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class AllrderAdapter extends MyBaseAdapter<OrderInfo> {
// private RequestQueue mQueue;
SharedPreferences sp;
OrderManageActivity context;
// private ImageLoader mImageLoader;
public AllrderAdapter(OrderManageActivity context) {
super(context);
this.context = context;
// mQueue = SingleRequestQueue.getRequestQueue(context);
// mImageLoader = new ImageLoader(mQueue, new BitmapCache());
sp = context.getSharedPreferences("variable", Context.MODE_PRIVATE);
}
String order_needpay;
String order_tax;
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.order_info_layout, null);
info = new Info();
info.order_infolayout = (LinearLayout) convertView
.findViewById(R.id.order_infolayout);
info.orderinfo_statusTV = (TextView) convertView
.findViewById(R.id.orderinfo_statusTV);
info.order_infoorderdeal = (LinearLayout) convertView
.findViewById(R.id.order_infoorderdeal);
info.order_infopayorder = (TextView) convertView
.findViewById(R.id.order_infopayorder);
info.order_creatTimeTv = (TextView) convertView
.findViewById(R.id.order_creatTimeTv);
info.order_needpayTv = (TextView) convertView
.findViewById(R.id.order_needpayTv);
info.order_shippongInfotV = (TextView) convertView
.findViewById(R.id.order_shippongInfotV);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
View view;
info.order_infolayout.removeAllViews();
LinearLayout lineLayout = new LinearLayout(context);
lineLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lineLayout.setLayoutParams(layoutParams);
for (int i = 0; i < getItem(position).getOrderContent().length; i++) {
view = LayoutInflater.from(context).inflate(
R.layout.shopinfo_layout, null);
TextView shop_infotv = (TextView) view
.findViewById(R.id.shop_infotv);
order_needpay = getItem(position).getAmount();
order_tax = getItem(position).getTotalTax();
shop_infotv.setText(getItem(position).getOrderContent()[i]);
TextView mycollet_moneyTv = (TextView) view
.findViewById(R.id.mycollet_moneyTv);
mycollet_moneyTv.setText("¥" + getItem(position).getShopPrice()[i]);
TextView mycollet_numTv = (TextView) view
.findViewById(R.id.mycollet_numTv);
mycollet_numTv.setText("x" + getItem(position).getShopNumber()[i]);
ImageView shop_IV = (ImageView) view.findViewById(R.id.shop_IV);
// shop_IV.setTag(getItem(position).getUrl()[i]);
// ImageLoader.ImageListener listener = BitmapUtil.getImageListener(shop_IV,R.drawable.huisebeijing);
// mImageLoader.get(ConfigUtil.getImageUrl(getItem(position).getUrl()[i]), listener);
Glide.with(context).load(getItem(position).getUrl()[i]).
error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(shop_IV);
lineLayout.addView(view);
if (getItem(position).getOrderContent().length > 1 && i < getItem(position).getOrderContent().length - 1) {
View myview = LayoutInflater.from(context).inflate(
R.layout.order_manage_addview, null);
lineLayout.addView(myview);
}
}
info.order_infolayout.addView(lineLayout);
info.order_infopayorder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, LogisticsActivity.class);
intent.putExtra("packageSn", getItem(position).getPackageSn());
context.startActivity(intent);
}
});
info.order_needpayTv.setText(order_needpay);
info.order_shippongInfotV.setText("(含税费¥" + order_tax + " 运费¥" + getItem(position).getTotalExpPrice() + ")");
info.orderinfo_statusTV.setText(getItem(position).getStatusDesc());
info.order_creatTimeTv.setText(getItem(position).getCreateTime());
if (getItem(position).isShowExpress()) {
// orderinfo_statusTV.setText("待付款");
info.order_infoorderdeal.setVisibility(View.VISIBLE);
} else {
info.order_infoorderdeal.setVisibility(View.GONE);
}
return convertView;
}
class Info {
LinearLayout order_infolayout;
LinearLayout order_infoorderdeal;
TextView orderinfo_statusTV;
TextView order_infopayorder;
TextView order_needpayTv;
TextView order_shippongInfotV;
TextView order_creatTimeTv;
}
}
/*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.danding.yang800.Adapter;
import android.content.Context;
/**
* The simple Array wheel adapter
*
* @param <T>
* the element type
*/
public class ArrayWheelAdapter<T> extends AbstractWheelTextAdapter {
// items
private T items[];
/**
* Constructor
*
* @param context
* the current context
* @param items
* the items
*/
public ArrayWheelAdapter(Context context, T items[]) {
super(context);
// setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE);
this.items = items;
}
@Override
public CharSequence getItemText(int index) {
if (index >= 0 && index < items.length) {
T item = items[index];
if (item instanceof CharSequence) {
return (CharSequence) item;
}
return item.toString();
}
return null;
}
@Override
public int getItemsCount() {
return items.length;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.DetailsInfo;
import com.danding.yang800.General.SingleRequestQueue;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
import java.io.Serializable;
public class DetailsAdapter extends MyBaseAdapter<DetailsInfo> {
public DetailsAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.details_adapter, null);
info = new Info();
info.details_image = (ImageView) convertView.findViewById(R.id.details_image);
info.details_name = (TextView) convertView.findViewById(R.id.details_name);
info.details_price = (TextView) convertView.findViewById(R.id.details_price);
info.details_number = (TextView) convertView.findViewById(R.id.details_number);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.details_image);
info.details_name.setText(getItem(position).getName());
info.details_price.setText("¥" + getItem(position).getPrice());
info.details_number.setText("x" + getItem(position).getNumber());
return convertView;
}
class Info {
ImageView details_image;
TextView details_name;
TextView details_price;
TextView details_number;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class DocumentAdapter extends MyBaseAdapter<SortListInfo> {
public DocumentAdapter(Context context) {
super(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.document_item, null);
info = new Info();
info.document_itemIv= (ImageView) convertView.findViewById(R.id.document_itemIv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.document_itemIv);
return convertView;
}
class Info {
ImageView document_itemIv;
}
}
package com.danding.yang800.Adapter;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
import com.danding.yang800.DocumentActivity;
import com.danding.yang800.Entity.ThumbViewInfo;
import com.danding.yang800.R;
import com.danding.yang800.View.PreviewLayout;
import com.zhy.autolayout.utils.AutoUtils;
import java.util.List;
/**
* Created by Administrator on 2017/7/26.
*/
public class DocumentRecyAdapter extends RecyclerView.Adapter<DocumentRecyAdapter.ViewHolder> implements View.OnClickListener {
private PreviewLayout mPreviewLayout;
private DocumentActivity ctx;
private List<ThumbViewInfo> infos;
private FrameLayout mContentContainer;
public DocumentRecyAdapter(DocumentActivity ctx, List<ThumbViewInfo> infos, FrameLayout mContentContainer) {
super();
this.ctx = ctx;
this.infos = infos;
this.mContentContainer = mContentContainer;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
// 创建一个View,简单起见直接使用系统提供的布局,就是一个TextView
View view = LayoutInflater.from(ctx).inflate(R.layout.document_item, viewGroup, false);
// 创建一个ViewHolder
ViewHolder holder = new ViewHolder(view);
holder.document_itemIv = (ImageView) view.findViewById(R.id.document_itemIv);
holder.document_itemIv.setOnClickListener(this);
return holder;
}
@Override
public void onBindViewHolder(final ViewHolder viewHolder, int position) {
// 绑定数据到ViewHolder上
//将position保存在itemView的Tag中,以便点击时进行获取
ThumbViewInfo info = infos.get(position);
Glide.with(ctx)
.load(info.getUrl())
.error(R.drawable.huisebeijing)
.into(new GlideDrawableImageViewTarget(viewHolder.document_itemIv) {
public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) {
super.onResourceReady(drawable, anim);
viewHolder.document_itemIv.setImageDrawable(drawable);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
viewHolder.document_itemIv.setOnClickListener(null);
viewHolder.document_itemIv.setImageDrawable(errorDrawable);
}
});
viewHolder.document_itemIv.setTag(R.id.recyItem_id, position);
}
@Override
public int getItemCount() {
return infos.size();
}
@Override
public void onClick(View v) {
ctx.openImage((int) v.getTag(R.id.recyItem_id));
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ImageView document_itemIv;
public ViewHolder(View itemView) {
super(itemView);
AutoUtils.autoSize(itemView);
}
}
}
\ No newline at end of file
package com.danding.yang800.Adapter;
public interface DragGridBaseAdapter {
public void reorderItems(int oldPosition, int newPosition);
public void setHideItem(int hidePosition);
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.GiftListInfo;
import com.danding.yang800.Entity.InviteNoteInfo;
import com.danding.yang800.GiftListActivity;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class GiftListAdapter extends MyBaseAdapter<GiftListInfo> {
GiftListActivity context;
public GiftListAdapter(GiftListActivity context) {
super(context);
this.context = context;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.gistlist_adapter, null);
info = new Info();
info.giftlist_Iv = (ImageView) convertView.findViewById(R.id.giftlist_Iv);
info.giftlist_nameTv = (TextView) convertView.findViewById(R.id.giftlist_nameTv);
info.giftlist_priceIntTv = (TextView) convertView.findViewById(R.id.giftlist_priceIntTv);
info.giftlist_priceTv = (TextView) convertView.findViewById(R.id.giftlist_priceTv);
info.giftList_adapterBuyTv = (TextView) convertView.findViewById(R.id.giftList_adapterBuyTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
info.giftList_adapterBuyTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
context.toGiftInfo(getItem(position).getStoreSkuSn());
}
});
info.giftlist_nameTv.setText(getItem(position).getSkuName());
info.giftlist_priceIntTv.setText("¥" + getItem(position).getPriceInt());
info.giftlist_priceTv.setText( getItem(position).getPrice());
Glide.with(context).load(getItem(position).getImageUrl()).diskCacheStrategy(DiskCacheStrategy.ALL).into(info.giftlist_Iv);
return convertView;
}
class Info {
ImageView giftlist_Iv;
TextView giftlist_nameTv;
TextView giftlist_priceIntTv;
TextView giftlist_priceTv;
TextView giftList_adapterBuyTv;
}
}
package com.danding.yang800.Adapter;
import java.util.Collections;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.GoodsInfo;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class GoodsSortAdapter extends MyBaseAdapter<GoodsInfo> implements
DragGridBaseAdapter {
private int mHidePosition = -1;
public GoodsSortAdapter(Context context) {
super(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
// if (convertView == null) {
convertView = inflater.inflate(R.layout.grid_item_layout, null);
info = new Info();
info.item_image = (ImageView) convertView
.findViewById(R.id.grid_item_Iv);
//info.item_text = (TextView) convertView.findViewById(R.id.item_text);
// convertView.setTag(info);
// if(position == mHidePosition){
// convertView.setVisibility(View.INVISIBLE);
// }
// } else {
// info = (Info) convertView.getTag();
// }
// if (getItem(position).getUrl().contains("http")) {
// info.item_image.setDefaultImageResId(R.drawable.ic_launcher);
// info.item_image.setErrorImageResId(R.drawable.ic_launcher);
// info.item_image.setImageUrl(getItem(position).getUrl(),
// mImageLoader);
// } else {
// info.item_image.setDefaultImageResId(R.drawable.ic_launcher);
// info.item_image.setErrorImageResId(R.drawable.ic_launcher);
// info.item_image.setImageUrl("", mImageLoader);
// }
AutoUtils.autoSize(convertView);
Glide.with(context).load(ConfigUtil.getImageUrl(getItem(position).getImgUrl(), 210, 210)).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.item_image);
//info.item_text.setText(getItem(position).getName());
return convertView;
}
class Info {
ImageView item_image;
TextView item_text;
}
@Override
public void reorderItems(int oldPosition, int newPosition) {
GoodsInfo imageInfo = lists.get(oldPosition);
// ImageInfo imageInfo2 = lists.get(oldPosition-1);
if (oldPosition < newPosition) {
for (int i = oldPosition; i < newPosition; i++) {
Collections.swap(lists, i, i + 1);
}
} else if (oldPosition > newPosition) {
for (int i = oldPosition; i > newPosition; i--) {
Collections.swap(lists, i, i - 1);
}
}
lists.set(newPosition, imageInfo);
// lists.set(oldPosition, imageInfo2);
}
@Override
public void setHideItem(int hidePosition) {
this.mHidePosition = hidePosition;
notifyDataSetChanged();
}
}
package com.danding.yang800.Adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.ImageFolder;
import com.danding.yang800.General.ImagePicker;
import com.danding.yang800.R;
import com.danding.yang800.Util.GeneralUtil;
import java.util.ArrayList;
import java.util.List;
public class ImageFolderAdapter extends BaseAdapter {
private ImagePicker imagePicker;
private Activity mActivity;
private LayoutInflater mInflater;
private int mImageSize;
private List<ImageFolder> imageFolders;
private int lastSelected = 0;
public ImageFolderAdapter(Activity activity, List<ImageFolder> folders) {
mActivity = activity;
if (folders != null && folders.size() > 0) imageFolders = folders;
else imageFolders = new ArrayList<>();
imagePicker = ImagePicker.getInstance();
mImageSize = GeneralUtil.getImageItemWidth(mActivity);
mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void refreshData(List<ImageFolder> folders) {
if (folders != null && folders.size() > 0) imageFolders = folders;
else imageFolders.clear();
notifyDataSetChanged();
}
@Override
public int getCount() {
return imageFolders.size();
}
@Override
public ImageFolder getItem(int position) {
return imageFolders.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.adapter_folder_list_item, parent, false);
holder = new ViewHolder(convertView);
} else {
holder = (ViewHolder) convertView.getTag();
}
ImageFolder folder = getItem(position);
holder.folderName.setText(folder.name);
holder.imageCount.setText(mActivity.getString(R.string.folder_image_count, folder.images.size()));
Glide.with(mActivity).load(folder.cover.path).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(holder.cover);
// imagePicker.getImageLoader().displayImage(mActivity, folder.cover.path, holder.cover, mImageSize, mImageSize);
if (lastSelected == position) {
holder.folderCheck.setVisibility(View.VISIBLE);
} else {
holder.folderCheck.setVisibility(View.INVISIBLE);
}
return convertView;
}
public void setSelectIndex(int i) {
if (lastSelected == i) {
return;
}
lastSelected = i;
notifyDataSetChanged();
}
public int getSelectIndex() {
return lastSelected;
}
private class ViewHolder {
ImageView cover;
TextView folderName;
TextView imageCount;
ImageView folderCheck;
public ViewHolder(View view) {
cover = (ImageView) view.findViewById(R.id.iv_cover);
folderName = (TextView) view.findViewById(R.id.tv_folder_name);
imageCount = (TextView) view.findViewById(R.id.tv_image_count);
folderCheck = (ImageView) view.findViewById(R.id.iv_folder_check);
view.setTag(this);
}
}
}
package com.danding.yang800.Adapter;
import android.app.Activity;
import android.support.v4.view.PagerAdapter;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.ImageItem;
import com.danding.yang800.General.ImagePicker;
import com.danding.yang800.Util.GeneralUtil;
import java.util.ArrayList;
import butterknife.internal.Utils;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
public class ImagePageAdapter extends PagerAdapter {
private int screenWidth;
private int screenHeight;
private ImagePicker imagePicker;
private ArrayList<ImageItem> images = new ArrayList<>();
private Activity mActivity;
public PhotoViewClickListener listener;
public ImagePageAdapter(Activity activity, ArrayList<ImageItem> images) {
this.mActivity = activity;
this.images = images;
DisplayMetrics dm = GeneralUtil.getScreenPix(activity);
screenWidth = dm.widthPixels;
screenHeight = dm.heightPixels;
imagePicker = ImagePicker.getInstance();
}
public void setData(ArrayList<ImageItem> images) {
this.images = images;
}
public void setPhotoViewClickListener(PhotoViewClickListener listener) {
this.listener = listener;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(mActivity);
ImageItem imageItem = images.get(position);
Glide.with(mActivity).load(imageItem.path).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(photoView);
//imagePicker.getImageLoader().displayImage(mActivity, imageItem.path, photoView, screenWidth, screenHeight);
photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
public void onPhotoTap(View view, float x, float y) {
if (listener != null) listener.OnPhotoTapListener(view, x, y);
}
});
container.addView(photoView);
return photoView;
}
@Override
public int getCount() {
return images.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
public interface PhotoViewClickListener {
void OnPhotoTapListener(View view, float v, float v1);
}
}
package com.danding.yang800.Adapter;
import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.GoodsSortInfo;
import com.danding.yang800.Entity.ImageItem;
import com.danding.yang800.General.ImagePicker;
import com.danding.yang800.PictureCheckActivity;
import com.danding.yang800.R;
import java.util.ArrayList;
import java.util.List;
/**
* ================================================
* 作 者:ikkong (ikkong@163.com),修改 jeasonlzy(廖子尧)
* 版 本:1.0
* 创建日期:2016/5/19
* 描 述:
* 修订历史:微信图片选择的Adapter, 感谢 ikkong 的提交
* ================================================
*/
public class ImagePickerAdapter extends RecyclerView.Adapter<ImagePickerAdapter.SelectedPicViewHolder> {
private int maxImgCount;
private Context mContext;
private List<ImageItem> mData;
private LayoutInflater mInflater;
private OnRecyclerViewItemClickListener listener;
private boolean isAdded; //是否额外添加了最后一个图片
public interface OnRecyclerViewItemClickListener {
void onItemClick(View view, int position);
}
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
this.listener = listener;
}
public void setImages(List<ImageItem> data) {
mData = new ArrayList<>(data);
if (getItemCount() < maxImgCount) {
mData.add(new ImageItem());
isAdded = true;
} else {
isAdded = false;
}
notifyDataSetChanged();
}
public List<ImageItem> getImages() {
//由于图片未选满时,最后一张显示添加图片,因此这个方法返回真正的已选图片
if (isAdded) return new ArrayList<>(mData.subList(0, mData.size() - 1));
else return mData;
}
public ImagePickerAdapter(Context mContext, List<ImageItem> data, int maxImgCount) {
this.mContext = mContext;
this.maxImgCount = maxImgCount;
this.mInflater = LayoutInflater.from(mContext);
setImages(data);
}
@Override
public SelectedPicViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new SelectedPicViewHolder(mInflater.inflate(R.layout.list_item_image, parent, false));
}
@Override
public void onBindViewHolder(SelectedPicViewHolder holder, int position) {
holder.bind(position);
}
@Override
public int getItemCount() {
return mData.size();
}
public class SelectedPicViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private ImageView iv_img;
private int clickPosition;
public SelectedPicViewHolder(View itemView) {
super(itemView);
iv_img = (ImageView) itemView.findViewById(R.id.iv_img);
}
public void bind(int position) {
//设置条目的点击事件
itemView.setOnClickListener(this);
//根据条目位置设置图片
ImageItem item = mData.get(position);
if (isAdded && position == getItemCount() - 1) {
iv_img.setImageResource(R.drawable.shenhe_sc);
clickPosition = PictureCheckActivity.IMAGE_ITEM_ADD;
} else {
Glide.with(mContext).load(item.path).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv_img);
//ImagePicker.getInstance().getImageLoader().displayImage((Activity) mContext, item.path, iv_img, 0, 0);
clickPosition = position;
}
}
@Override
public void onClick(View v) {
if (listener != null) listener.onItemClick(v, clickPosition);
}
}
}
\ No newline at end of file
package com.danding.yang800.Adapter;
import android.Manifest;
import android.app.Activity;
import android.support.v4.app.ActivityCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.ImageItem;
import com.danding.yang800.General.ImagePicker;
import com.danding.yang800.ImageBaseActivity;
import com.danding.yang800.ImageGridActivity;
import com.danding.yang800.R;
import com.danding.yang800.Util.GeneralUtil;
import com.danding.yang800.View.SuperCheckBox;
import java.util.ArrayList;
/**
* 加载相册图片的RecyclerView适配器
* <p>
* 用于替换原项目的GridView,使用局部刷新解决选中照片出现闪动问题
* <p>
* 替换为RecyclerView后只是不再会导致全局刷新,
* <p>
* 但还是会出现明显的重新加载图片,可能是picasso图片加载框架的问题
* <p>
* Author: nanchen
* Email: liushilin520@foxmail.com
* Date: 2017-04-05 10:04
*/
public class ImageRecyclerAdapter extends RecyclerView.Adapter<ViewHolder> {
private static final int ITEM_TYPE_CAMERA = 0; //第一个条目是相机
private static final int ITEM_TYPE_NORMAL = 1; //第一个条目不是相机
private ImagePicker imagePicker;
private Activity mActivity;
private ArrayList<ImageItem> images; //当前需要显示的所有的图片数据
private ArrayList<ImageItem> mSelectedImages; //全局保存的已经选中的图片数据
private boolean isShowCamera; //是否显示拍照按钮
private int mImageSize; //每个条目的大小
private LayoutInflater mInflater;
private OnImageItemClickListener listener; //图片被点击的监听
public void setOnImageItemClickListener(OnImageItemClickListener listener) {
this.listener = listener;
}
public interface OnImageItemClickListener {
void onImageItemClick(View view, ImageItem imageItem, int position);
}
public void refreshData(ArrayList<ImageItem> images) {
if (images == null || images.size() == 0) this.images = new ArrayList<>();
else this.images = images;
notifyDataSetChanged();
}
/**
* 构造方法
*/
public ImageRecyclerAdapter(Activity activity, ArrayList<ImageItem> images) {
this.mActivity = activity;
if (images == null || images.size() == 0) this.images = new ArrayList<>();
else this.images = images;
mImageSize = GeneralUtil.getImageItemWidth(mActivity);
imagePicker = ImagePicker.getInstance();
isShowCamera = imagePicker.isShowCamera();
mSelectedImages = imagePicker.getSelectedImages();
mInflater = LayoutInflater.from(activity);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == ITEM_TYPE_CAMERA) {
return new CameraViewHolder(mInflater.inflate(R.layout.adapter_camera_item, parent, false));
}
return new ImageViewHolder(mInflater.inflate(R.layout.adapter_image_list_item, parent, false));
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (holder instanceof CameraViewHolder) {
((CameraViewHolder) holder).bindCamera();
} else if (holder instanceof ImageViewHolder) {
((ImageViewHolder) holder).bind(position);
}
}
@Override
public int getItemViewType(int position) {
if (isShowCamera) return position == 0 ? ITEM_TYPE_CAMERA : ITEM_TYPE_NORMAL;
return ITEM_TYPE_NORMAL;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemCount() {
return isShowCamera ? images.size() + 1 : images.size();
}
public ImageItem getItem(int position) {
if (isShowCamera) {
if (position == 0) return null;
return images.get(position - 1);
} else {
return images.get(position);
}
}
private class ImageViewHolder extends ViewHolder {
View rootView;
ImageView ivThumb;
View mask;
SuperCheckBox cbCheck;
ImageViewHolder(View itemView) {
super(itemView);
rootView = itemView;
ivThumb = (ImageView) itemView.findViewById(R.id.iv_thumb);
mask = itemView.findViewById(R.id.mask);
cbCheck = (SuperCheckBox) itemView.findViewById(R.id.cb_check);
itemView.setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mImageSize)); //让图片是个正方形
}
void bind(final int position) {
final ImageItem imageItem = getItem(position);
ivThumb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) listener.onImageItemClick(rootView, imageItem, position);
}
});
cbCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int selectLimit = imagePicker.getSelectLimit();
if (cbCheck.isChecked() && mSelectedImages.size() >= selectLimit) {
Toast.makeText(mActivity.getApplicationContext(), mActivity.getString(R.string.select_limit, selectLimit), Toast.LENGTH_SHORT).show();
cbCheck.setChecked(false);
mask.setVisibility(View.GONE);
} else {
imagePicker.addSelectedImageItem(position, imageItem, cbCheck.isChecked());
mask.setVisibility(View.VISIBLE);
}
}
});
//根据是否多选,显示或隐藏checkbox
if (imagePicker.isMultiMode()) {
cbCheck.setVisibility(View.VISIBLE);
boolean checked = mSelectedImages.contains(imageItem);
if (checked) {
mask.setVisibility(View.VISIBLE);
cbCheck.setChecked(true);
} else {
mask.setVisibility(View.GONE);
cbCheck.setChecked(false);
}
} else {
cbCheck.setVisibility(View.GONE);
}
Glide.with(mActivity).load(imageItem.path).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(ivThumb);
//imagePicker.getImageLoader().displayImage(mActivity, imageItem.path, ivThumb, mImageSize, mImageSize); //显示图片
}
}
private class CameraViewHolder extends ViewHolder {
View mItemView;
CameraViewHolder(View itemView) {
super(itemView);
mItemView = itemView;
}
void bindCamera() {
mItemView.setLayoutParams(new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mImageSize)); //让图片是个正方形
mItemView.setTag(null);
mItemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!((ImageBaseActivity) mActivity).checkPermission(Manifest.permission.CAMERA)) {
ActivityCompat.requestPermissions(mActivity, new String[]{Manifest.permission.CAMERA}, ImageGridActivity.REQUEST_PERMISSION_CAMERA);
} else {
imagePicker.takePicture(mActivity, ImagePicker.REQUEST_CODE_TAKE);
}
}
});
}
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.danding.yang800.Entity.InviteNoteInfo;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class InviteNoteAdapter extends MyBaseAdapter<InviteNoteInfo> {
public InviteNoteAdapter(Context context) {
super(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.invite_note_adapter, null);
info = new Info();
info.inviteAdapter_nameTv = (TextView) convertView.findViewById(R.id.inviteAdapter_nameTv);
info.inviteAdapter_numberTv = (TextView) convertView.findViewById(R.id.inviteAdapter_numberTv);
info.inviteAdapter_timeTv = (TextView) convertView.findViewById(R.id.inviteAdapter_timeTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
info.inviteAdapter_nameTv.setText(getItem(position).getName());
info.inviteAdapter_numberTv.setText(getItem(position).getNumber());
info.inviteAdapter_timeTv.setText(getItem(position).getTime());
return convertView;
}
class Info {
TextView inviteAdapter_nameTv;
TextView inviteAdapter_numberTv;
TextView inviteAdapter_timeTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.danding.yang800.Entity.LogisticInfo;
import com.danding.yang800.LogisticsActivity;
import com.danding.yang800.R;
public class LogisticsAdapter extends MyBaseAdapter<LogisticInfo> {
public LogisticsAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// Info info = null;
// if (convertView == null) {
convertView = inflater
.inflate(R.layout.logistics_adapter, null);
// info = new Info();
TextView logisticadapter_statusTv = (TextView) convertView.findViewById(R.id.logisticadapter_statusTv);
TextView logisticadapter_statustimeTv = (TextView) convertView.findViewById(R.id.logisticadapter_statustimeTv);
LinearLayout logisticadapter_infolayout = (LinearLayout) convertView
.findViewById(R.id.logisticadapter_infolayout);
LinearLayout lineLayout = new LinearLayout(context);
lineLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
lineLayout.setLayoutParams(layoutParams);
View view = LayoutInflater.from(context).inflate(
R.layout.logistics_adapteradd, null);
ImageView logisticsadapter_iv = (ImageView) view.findViewById(R.id.logisticsadapter_iv);
View logisticsadapter_view = (View) view.findViewById(R.id.logisticsadapter_view);
lineLayout.addView(view);
logisticadapter_infolayout.addView(lineLayout);
if (position == 0) {
logisticadapter_statusTv.setTextColor(ContextCompat.getColor(context, R.color.pink));
logisticadapter_statustimeTv.setTextColor(ContextCompat.getColor(context, R.color.pink));
logisticsadapter_view.setVisibility(View.INVISIBLE);
ViewGroup.LayoutParams para;
para = logisticsadapter_iv.getLayoutParams();
para.height = 50;
para.width = 50;
logisticsadapter_iv.setLayoutParams(para);
logisticsadapter_iv.setImageDrawable(context.getResources().getDrawable(
R.drawable.logistics_icon));
}
logisticadapter_statusTv.setText(getItem(position).getStatus());
logisticadapter_statustimeTv.setText(getItem(position).getTime());
// convertView.setTag(info);
// } else {
// info = (Info) convertView.getTag();
// }
return convertView;
}
// class Info {
// TextView logisticadapter_statusTv;
// TextView logisticadapter_statustimeTv;
// LinearLayout logisticadapter_infolayout;
// }
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.MarketInfo;
import com.danding.yang800.Entity.MarketShopInfo;
import com.danding.yang800.R;
import com.danding.yang800.View.MyDialog;
import com.zhy.autolayout.utils.AutoUtils;
import jp.wasabeef.glide.transformations.CropCircleTransformation;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
public class MarketInfoAdapter extends MyBaseAdapter<MarketShopInfo> {
public MarketInfoAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.marketshopinfo_adapter, null);
info = new Info();
info.marketShopInfo_adapterIv = (ImageView) convertView.findViewById(R.id.marketShopInfo_adapterIv);
info.marketShopInfo_adapterNameTv = (TextView) convertView.findViewById(R.id.marketShopInfo_adapterNameTv);
info.marketShopInfo_adapterTimeTv = (TextView) convertView.findViewById(R.id.marketShopInfo_adapterTimeTv);
info.marketShopInfo_adapterStatusTv = (TextView) convertView.findViewById(R.id.marketShopInfo_adapterStatusTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(ConfigUtil.getImageUrl(getItem(position).getUrl(), 80, 80)).error(R.drawable.huisebeijing)
.bitmapTransform(new CropCircleTransformation(context)).crossFade(1000)
.into(info.marketShopInfo_adapterIv);
info.marketShopInfo_adapterNameTv.setText(getItem(position).getName());
info.marketShopInfo_adapterTimeTv.setText(getItem(position).getTime());
info.marketShopInfo_adapterStatusTv.setText(getItem(position).getStatus());
return convertView;
}
class Info {
ImageView marketShopInfo_adapterIv;
TextView marketShopInfo_adapterNameTv;
TextView marketShopInfo_adapterTimeTv;
TextView marketShopInfo_adapterStatusTv;
}
}
package com.danding.yang800.Adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.danding.yang800.BaseActivity;
import com.danding.yang800.Entity.MarketPlatInfo;
import com.danding.yang800.Fragment.MarketPlatformFrag;
import com.danding.yang800.Presenter.MarketPlatformFragPresenter;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class MarketPlatAdapter extends MyBaseAdapter<MarketPlatInfo> {
BaseActivity context;
MarketPlatformFrag frag;
MarketPlatformFragPresenter presenter;
public MarketPlatAdapter(BaseActivity context, MarketPlatformFrag frag) {
super(context);
this.context = context;
this.frag = frag;
presenter = new MarketPlatformFragPresenter(frag, this);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.market_plat_adapter, null);
info = new Info();
info.platAdapter_shareLayout = (RelativeLayout) convertView.findViewById(R.id.platAdapter_shareLayout);
info.marketPlatAdapter_ticketNameTv = (TextView) convertView.findViewById(R.id.marketPlatAdapter_ticketNameTv);
info.marketPlatAdapter_ticketUseTv = (TextView) convertView.findViewById(R.id.marketPlatAdapter_ticketUseTv);
info.marketPlatAdapter_ticketUseTimeTv = (TextView) convertView.findViewById(R.id.marketPlatAdapter_ticketUseTimeTv);
info.marketPlatAdapter_ticketPriceTv = (TextView) convertView.findViewById(R.id.marketPlatAdapter_ticketPriceTv);
info.marketPlatAdapter_shareLayout = (LinearLayout) convertView.findViewById(R.id.marketPlatAdapter_shareLayout);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
info.platAdapter_shareLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
share(position);
}
});
info.marketPlatAdapter_ticketNameTv.setText(getItem(position).getName());
info.marketPlatAdapter_ticketUseTv.setText(getItem(position).getReceiveRuleDesc());
info.marketPlatAdapter_ticketUseTimeTv.setText("使用期限:" + getItem(position).getStartTime() + "-" + getItem(position).getEndTime());
info.marketPlatAdapter_ticketPriceTv.setText(getItem(position).getConditionFee());
if (getItem(position).isCanShare()) {
info.marketPlatAdapter_shareLayout.setVisibility(View.VISIBLE);
} else {
info.marketPlatAdapter_shareLayout.setVisibility(View.GONE);
}
return convertView;
}
class Info {
RelativeLayout platAdapter_shareLayout;
TextView marketPlatAdapter_ticketNameTv;
TextView marketPlatAdapter_ticketUseTv;
TextView marketPlatAdapter_ticketUseTimeTv;
TextView marketPlatAdapter_ticketPriceTv;
LinearLayout marketPlatAdapter_shareLayout;
}
private void share(int position) {
presenter.check(getItem(position).getId() + "", position);
// ShareUtil.share(context, "https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-live-pusher.html", "11", "222");
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.DetailsInfo;
import com.danding.yang800.Entity.MarketInfo;
import com.danding.yang800.R;
import com.danding.yang800.Util.CacheManageUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.MyDialog;
import com.zhy.autolayout.utils.AutoUtils;
public class MarketShopAdapter extends MyBaseAdapter<MarketInfo> {
public MarketShopAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.market_normal_adapter, null);
info = new Info();
info.maketAdapter_normalLayout = (LinearLayout) convertView.findViewById(R.id.maketAdapter_normalLayout);
info.maketAdapter_cancelLayout = (LinearLayout) convertView.findViewById(R.id.maketAdapter_cancelLayout);
info.maketAdapter_editLayout = (LinearLayout) convertView.findViewById(R.id.maketAdapter_editLayout);
info.maketAdapter_conutTv = (TextView) convertView.findViewById(R.id.maketAdapter_conutTv);
info.maketAdapter_sendTv = (TextView) convertView.findViewById(R.id.maketAdapter_sendTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
if (getItem(position).getStatus() == 0) {
info.maketAdapter_normalLayout.setVisibility(View.VISIBLE);
info.maketAdapter_cancelLayout.setVisibility(View.GONE);
info.maketAdapter_editLayout.setVisibility(View.GONE);
info.maketAdapter_conutTv.setText("已领取并使用:1/20");
} else if (getItem(position).getStatus() == 1) {
info.maketAdapter_normalLayout.setVisibility(View.GONE);
info.maketAdapter_cancelLayout.setVisibility(View.VISIBLE);
info.maketAdapter_editLayout.setVisibility(View.GONE);
} else if (getItem(position).getStatus() == 2) {
info.maketAdapter_normalLayout.setVisibility(View.GONE);
info.maketAdapter_cancelLayout.setVisibility(View.GONE);
info.maketAdapter_editLayout.setVisibility(View.VISIBLE);
} else if (getItem(position).getStatus() == 10) {
info.maketAdapter_normalLayout.setVisibility(View.VISIBLE);
info.maketAdapter_cancelLayout.setVisibility(View.GONE);
info.maketAdapter_editLayout.setVisibility(View.GONE);
info.maketAdapter_conutTv.setText("每一用户限领1张(共3000张)");
}
info.maketAdapter_sendTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final MyDialog okCancelDialog = MyDialog.createBuilder(context).setAlertTitle("发布营销活动").
setMsg("确定支付100元吗?").setRemark("(支付后,未被领用的券可作废)");
okCancelDialog.setOKOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
okCancelDialog.dismiss();
}
});
okCancelDialog.setOnCancelListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
okCancelDialog.dismiss();
}
});
okCancelDialog.show();
}
});
return convertView;
}
class Info {
LinearLayout maketAdapter_normalLayout;
LinearLayout maketAdapter_cancelLayout;
LinearLayout maketAdapter_editLayout;
TextView maketAdapter_conutTv;
TextView maketAdapter_sendTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.danding.yang800.BaseActivity;
import com.danding.yang800.MarketActivity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public abstract class MyBaseAdapter<T> extends BaseAdapter {
public ArrayList<T> lists;
protected LayoutInflater inflater;
protected BaseActivity ctx;
protected Context context;
public MyBaseAdapter(Context context) {
lists = new ArrayList<T>();
this.context = context;
inflater = LayoutInflater.from(context);
// inflater=(LayoutInflater)
// context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public MyBaseAdapter(BaseActivity ctx) {
lists = new ArrayList<T>();
this.ctx = ctx;
inflater = LayoutInflater.from(ctx);
// inflater=(LayoutInflater)
// context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void addData(T t) {
lists.add(t);
}
public void delData(T t) {
lists.remove(t);
}
public void delData(int index) {
lists.remove(index);
}
public void addDataList(List<T> l) {
lists.addAll(l);
}
public void clear() {
lists.clear();
}
public ArrayList<T> getLists() {
return lists;
}
public void setList(ArrayList<T> lists) {
this.lists = lists;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return lists.size();
}
@Override
public T getItem(int position) {
// TODO Auto-generated method stub
return lists.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public abstract View getView(int position, View convertView,
ViewGroup parent);
}
package com.danding.yang800.Adapter;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
public class MyPagerAdapter extends PagerAdapter {
private List<View> lists;
private List<String> titles;
public MyPagerAdapter() {
super();
lists = new ArrayList<View>();
titles = new ArrayList<String>();
}
public void addView(View v) {
lists.add(v);
}
public void delView(View v) {
lists.remove(v);
}
public void addTitle(String t) {
titles.add(t);
}
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
// TODO Auto-generated method stub
}
public void delTitle(String t) {
titles.remove(t);
}
@Override
public CharSequence getPageTitle(int position) {
// TODO Auto-generated method stub
return titles.get(position);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return lists.size();
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// TODO Auto-generated method stub
container.removeView(lists.get(position));
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// TODO Auto-generated method stub
View v = lists.get(position);
container.addView(v);
return v;
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
// TODO Auto-generated method stub
return arg0 == arg1;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class NewsAdapter extends MyBaseAdapter<SortListInfo> {
public NewsAdapter(Context context) {
super(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.news_item, null);
info = new Info();
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
return convertView;
}
class Info {
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.GoodsSortInfo;
import com.danding.yang800.Entity.RefundInfo;
import com.danding.yang800.General.SingleRequestQueue;
import com.danding.yang800.R;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.listener.OnConvertViewClickListener;
public class RefundAdapter extends MyBaseAdapter<RefundInfo> {
private RequestQueue mQueue;
public RefundAdapter(Context context) {
super(context);
mQueue = SingleRequestQueue.getRequestQueue(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.refund_adapterlayout, null);
info = new Info();
info.refund_addLayout = (LinearLayout) convertView
.findViewById(R.id.refund_addLayout);
info.refund_number = (TextView) convertView
.findViewById(R.id.refund_number);
info.refund_reduceLayout = (LinearLayout) convertView
.findViewById(R.id.refund_reduceLayout);
info.refund_adaptercheck = (CheckBox) convertView
.findViewById(R.id.refund_adaptercheck);
info.refund_adapterIV = (ImageView) convertView
.findViewById(R.id.refund_adapterIV);
info.refund_adaptername = (TextView) convertView
.findViewById(R.id.refund_adaptername);
info.refund_adapternumber = (TextView) convertView
.findViewById(R.id.refund_adapternumber);
info.refund_adapterpriceedit = (TextView) convertView
.findViewById(R.id.refund_adapterpriceedit);
info.refund_adaptercheckLayout = (RelativeLayout) convertView
.findViewById(R.id.refund_adaptercheckLayout);
final int num = Integer.parseInt(getItem(position).getInfo().getNumber());
info.refund_addLayout.setOnClickListener(new OnConvertViewClickListener(convertView, R.id.ab__id_adapter_item_position) {
@Override
public void onClickCallBack(View registedView, int positionIds) {
int posi = Integer.parseInt(String.valueOf(registedView.getTag(positionIds)));
int number = Integer.parseInt(getItem(posi).getInfo().getNumber());
if (number >= num) {
ToastUtil.show(context, "退货数量不能大于购买数量");
return;
}
number++;
TextView refund_number = (TextView) registedView
.findViewById(R.id.refund_number);
TextView refund_adapternumber = (TextView) registedView
.findViewById(R.id.refund_adapternumber);
refund_adapternumber.setText("x" + number);
refund_number.setText(number + "");
getItem(posi).getInfo().setNumber(number + "");
}
});
info.refund_adaptercheckLayout.setOnClickListener(new OnConvertViewClickListener(convertView, R.id.ab__id_adapter_item_position) {
@Override
public void onClickCallBack(View registedView, int positionIds) {
CheckBox refund_adaptercheck = (CheckBox) registedView
.findViewById(R.id.refund_adaptercheck);
refund_adaptercheck.setChecked(!getItem(position).isChecked());
}
});
info.refund_reduceLayout.setOnClickListener(new OnConvertViewClickListener(convertView, R.id.ab__id_adapter_item_position) {
@Override
public void onClickCallBack(View registedView, int positionIds) {
int posi = Integer.parseInt(String.valueOf(registedView.getTag(positionIds)));
int number = Integer.parseInt(getItem(posi).getInfo().getNumber());
TextView refund_number = (TextView) registedView
.findViewById(R.id.refund_number);
if (number == 1) {
ToastUtil.show(context, "数量不能再少了");
} else {
number--;
TextView refund_adapternumber = (TextView) registedView
.findViewById(R.id.refund_adapternumber);
refund_adapternumber.setText("x" + number);
refund_number.setText(number + "");
getItem(posi).getInfo().setNumber(number + "");
}
}
});
//
//
convertView.setTag(info);
} else {
info = (Info) convertView.getTag();
}
convertView.setTag(R.id.ab__id_adapter_item_position, position);
info.refund_adaptercheck
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
getItem(position).setChecked(isChecked);
}
});
convertView.setTag(R.id.ab__id_adapter_item_position, position);
Glide.with(context).load(getItem(position).getInfo().getUrl()).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(info.refund_adapterIV);
info.refund_adaptername.setText(getItem(position).getInfo().getName());
info.refund_adapternumber.setText("x" + getItem(position).getInfo().getNumber());
info.refund_number.setText(getItem(position).getInfo().getNumber());
info.refund_adapterpriceedit.setText("¥" + getItem(position).getInfo().getPrice());
info.refund_adaptercheck.setChecked(getItem(position).isChecked());
return convertView;
}
class Info {
CheckBox refund_adaptercheck;
ImageView refund_adapterIV;
TextView refund_adaptername;
TextView refund_adapternumber;
TextView refund_adapterpriceedit;
TextView refund_number;
LinearLayout refund_reduceLayout, refund_addLayout;
RelativeLayout refund_adaptercheckLayout;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.ImageItem;
import com.danding.yang800.PictureCheckActivity;
import com.danding.yang800.R;
import java.util.ArrayList;
import java.util.List;
public class RefundImagePickerAdapter extends RecyclerView.Adapter<RefundImagePickerAdapter.SelectedPicViewHolder> {
private int maxImgCount;
private Context mContext;
private List<ImageItem> mData;
private LayoutInflater mInflater;
private OnRecyclerViewItemClickListener listener;
private boolean isAdded; //是否额外添加了最后一个图片
public interface OnRecyclerViewItemClickListener {
void onItemClick(View view, int position);
void onItemClick(int position);
}
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
this.listener = listener;
}
public void setImages(List<ImageItem> data) {
mData = new ArrayList<>(data);
if (getItemCount() < maxImgCount) {
mData.add(new ImageItem());
isAdded = true;
} else {
isAdded = false;
}
notifyDataSetChanged();
}
public List<ImageItem> getImages() {
//由于图片未选满时,最后一张显示添加图片,因此这个方法返回真正的已选图片
if (isAdded) return new ArrayList<>(mData.subList(0, mData.size() - 1));
else return mData;
}
public RefundImagePickerAdapter(Context mContext, List<ImageItem> data, int maxImgCount) {
this.mContext = mContext;
this.maxImgCount = maxImgCount;
this.mInflater = LayoutInflater.from(mContext);
setImages(data);
}
@Override
public SelectedPicViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new SelectedPicViewHolder(mInflater.inflate(R.layout.refund_item_image, parent, false));
}
@Override
public void onBindViewHolder(SelectedPicViewHolder holder, int position) {
holder.bind(position);
}
@Override
public int getItemCount() {
return mData.size();
}
public class SelectedPicViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private ImageView refundiv_img;
private ImageView refundiv_cancelIv;
private int clickPosition;
public SelectedPicViewHolder(View itemView) {
super(itemView);
refundiv_img = (ImageView) itemView.findViewById(R.id.refundiv_img);
refundiv_cancelIv = (ImageView) itemView.findViewById(R.id.refundiv_cancelIv);
}
public void bind(final int position) {
//设置条目的点击事件
itemView.setOnClickListener(this);
refundiv_cancelIv.setOnClickListener(this);
//根据条目位置设置图片
ImageItem item = mData.get(position);
if (isAdded && position == getItemCount() - 1) {
refundiv_img.setImageResource(R.drawable.shouhou_sc);
clickPosition = PictureCheckActivity.IMAGE_ITEM_ADD;
refundiv_cancelIv.setVisibility(View.INVISIBLE);
} else {
// ImagePicker.getInstance().getImageLoader().displayImage((Activity) mContext, item.path, refundiv_img, 0, 0);
refundiv_cancelIv.setVisibility(View.VISIBLE);
Glide.with(mContext).load(item.path).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(refundiv_img);
clickPosition = position;
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.refundiv_cancelIv:
if (listener != null) listener.onItemClick(clickPosition);
break;
default:
if (listener != null) listener.onItemClick(v, clickPosition);
break;
}
}
}
}
\ No newline at end of file
package com.danding.yang800.Adapter;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.SeeShopInfo;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.R;
import com.danding.yang800.SeeActivity;
import com.zhy.autolayout.utils.AutoUtils;
public class SeeShopAdapter extends MyBaseAdapter<SeeShopInfo> {
SeeActivity context;
public SeeShopAdapter(SeeActivity context) {
super(context);
this.context = context;
sp = context.getSharedPreferences("variable", Context.MODE_PRIVATE);
}
SharedPreferences sp;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.see_shop_item, null);
info = new Info();
info.seeshop_goodsIv = (ImageView) convertView.findViewById(R.id.seeshop_goodsIv);
info.seeshop_noneIv = (ImageView) convertView.findViewById(R.id.seeshop_noneIv);
info.seeshop_goodsNameTv = (TextView) convertView.findViewById(R.id.seeshop_goodsNameTv);
info.seeshop_goodsPriceTv = (TextView) convertView.findViewById(R.id.seeshop_goodsPriceTv);
info.seeshop_expFreeTv = (TextView) convertView.findViewById(R.id.seeshop_expFreeTv);
info.seeshop_taxFreeTv = (TextView) convertView.findViewById(R.id.seeshop_taxFreeTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(ConfigUtil.getImageUrl(getItem(position).getGoodsImgUrl(), 210, 210)).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(info.seeshop_goodsIv);
info.seeshop_goodsNameTv.setText(getItem(position).getGoodsName());
info.seeshop_goodsPriceTv.setText("¥" + getItem(position).getPrice());
if (getItem(position).isExpFree()) {
info.seeshop_expFreeTv.setVisibility(View.VISIBLE);
} else {
info.seeshop_expFreeTv.setVisibility(View.GONE);
}
if (getItem(position).isTaxFree()) {
info.seeshop_taxFreeTv.setVisibility(View.VISIBLE);
} else {
info.seeshop_taxFreeTv.setVisibility(View.GONE);
}
if (getItem(position).getStats().equals("3")) {
info.seeshop_noneIv.setVisibility(View.VISIBLE);
} else {
info.seeshop_noneIv.setVisibility(View.GONE);
}
return convertView;
}
class Info {
ImageView seeshop_goodsIv;
ImageView seeshop_noneIv;
TextView seeshop_goodsNameTv;
TextView seeshop_goodsPriceTv;
TextView seeshop_expFreeTv;
TextView seeshop_taxFreeTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.SeeShopInfo;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.R;
import com.danding.yang800.SeeActivity;
import com.zhy.autolayout.utils.AutoUtils;
public class SeeShopTwoAdapter extends MyBaseAdapter<SeeShopInfo> {
SeeActivity context;
public SeeShopTwoAdapter(SeeActivity context) {
super(context);
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.see_shop_twoitem, null);
info = new Info();
info.seeshoptwo_goodsIv = (ImageView) convertView.findViewById(R.id.seeshoptwo_goodsIv);
info.seeshoptwo_noneIv = (ImageView) convertView.findViewById(R.id.seeshoptwo_noneIv);
info.seeshoptwo_goodsNameTv = (TextView) convertView.findViewById(R.id.seeshoptwo_goodsNameTv);
info.seeshoptwo_goodsPrcieIv = (TextView) convertView.findViewById(R.id.seeshoptwo_goodsPrcieIv);
info.seeshoptwo_expFreeTv = (TextView) convertView.findViewById(R.id.seeshoptwo_expFreeTv);
info.seeshoptwo_taxFreeTv = (TextView) convertView.findViewById(R.id.seeshoptwo_taxFreeTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
Glide.with(context).load(ConfigUtil.getImageUrl(getItem(position).getGoodsImgUrl(), 300, 300)).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(info.seeshoptwo_goodsIv);
info.seeshoptwo_goodsNameTv.setText(getItem(position).getGoodsName());
info.seeshoptwo_goodsPrcieIv.setText("¥" + getItem(position).getPrice());
if (getItem(position).isExpFree()) {
info.seeshoptwo_expFreeTv.setVisibility(View.VISIBLE);
} else {
info.seeshoptwo_expFreeTv.setVisibility(View.GONE);
}
if (getItem(position).isTaxFree()) {
info.seeshoptwo_taxFreeTv.setVisibility(View.VISIBLE);
} else {
info.seeshoptwo_taxFreeTv.setVisibility(View.GONE);
}
if (getItem(position).getStats().equals("3")) {
info.seeshoptwo_noneIv.setVisibility(View.VISIBLE);
} else {
info.seeshoptwo_noneIv.setVisibility(View.GONE);
}
return convertView;
}
class Info {
ImageView seeshoptwo_goodsIv;
ImageView seeshoptwo_noneIv;
TextView seeshoptwo_goodsNameTv;
TextView seeshoptwo_goodsPrcieIv;
TextView seeshoptwo_expFreeTv;
TextView seeshoptwo_taxFreeTv;
}
}
package com.danding.yang800.Adapter;
import java.util.ArrayList;
import java.util.List;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.danding.yang800.Entity.GoodsSortInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by baoyz on 2014/6/29.
*/
public class SelectgoodAdapter extends RecyclerView.Adapter<SelectgoodAdapter.ViewHolder> implements View.OnClickListener {
private Context ctx;
// 数据集
public ArrayList<GoodsSortInfo> infos;
public List<Boolean> isClicks;
public SelectgoodAdapter(Context ctx, ArrayList<GoodsSortInfo> infos) {
super();
this.ctx = ctx;
this.infos = infos;
isClicks = new ArrayList<>();
for (int i = 0; i < infos.size(); i++) {
if (i == 0) {
isClicks.add(true);
} else {
isClicks.add(false);
}
}
}
public interface OnItemClickListener {
/*position此处是每一个Item所在的位置,作为Tag*/
public void setOnItemClick(View v, int position);
}
private OnItemClickListener listener = null;
/*暴露给外部的接口,给内部类的对象赋值*/
public void setOnItemClickListener(OnItemClickListener listener) {
this.listener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
// 创建一个View,简单起见直接使用系统提供的布局,就是一个TextView
View view = LayoutInflater.from(ctx).inflate(R.layout.select_adapter_item, viewGroup, false);
// 创建一个ViewHolder
ViewHolder holder = new ViewHolder(view);
holder.mTextView = (TextView) view.findViewById(R.id.item);
holder.mTextView.setOnClickListener(this);
return holder;
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
// 绑定数据到ViewHolder上
//将position保存在itemView的Tag中,以便点击时进行获取
if (isClicks.get(position)) {
viewHolder.mTextView.setTextColor(Color.parseColor("#ffffff"));
viewHolder.mTextView.setBackgroundColor(ContextCompat.getColor(ctx, R.color.hhpink));
} else {
viewHolder.mTextView.setTextColor(Color.parseColor("#fcc6c6"));
viewHolder.mTextView.setBackgroundColor(ContextCompat.getColor(ctx, R.color.pink));
}
viewHolder.mTextView.setTag(position);
GoodsSortInfo info = infos.get(position);
viewHolder.mTextView.setText(info.getSortName());
}
@Override
public int getItemCount() {
return infos.size();
}
@Override
public void onClick(View v) {
if (listener != null) {
v.setBackgroundColor(ContextCompat.getColor(ctx, R.color.hhpink));
listener.setOnItemClick(v, (int) v.getTag());
for (int i = 0; i < isClicks.size(); i++) {
isClicks.set(i, false);
infos.get(i).setClicks(false);
}
isClicks.set((int) v.getTag(), true);
infos.get((int) v.getTag()).setClicks(true);
}
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView mTextView;
public ViewHolder(View itemView) {
super(itemView);
AutoUtils.autoSize(itemView);
}
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.danding.yang800.Entity.AccountDetailedInfo;
import com.danding.yang800.Entity.TakeNotesInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
public class TakeNotesAdapter extends MyBaseAdapter<TakeNotesInfo> {
public TakeNotesAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.take_notes_adapter, null);
info = new Info();
info.take_notes_adapterTv = (TextView) convertView.findViewById(R.id.take_notes_adapterTv);
info.take_notes_adapterTimeTv = (TextView) convertView.findViewById(R.id.take_notes_adapterTimeTv);
info.take_notes_adapterStateTv = (TextView) convertView.findViewById(R.id.take_notes_adapterStateTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
// Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.shouye).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.details_image);
// info.details_price.setText("¥" + getItem(position).getPrice());
// info.details_number.setText("x" + getItem(position).getNumber());
info.take_notes_adapterTv.setText(getItem(position).getMoney());
info.take_notes_adapterTimeTv.setText(getItem(position).getTime());
info.take_notes_adapterStateTv.setText(getItem(position).getState());
return convertView;
}
class Info {
TextView take_notes_adapterTv;
TextView take_notes_adapterTimeTv;
TextView take_notes_adapterStateTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.Entity.MarketInfo;
import com.danding.yang800.Entity.TicketNotUseInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;
import jp.wasabeef.glide.transformations.CropCircleTransformation;
public class TicketNotUseAdapter extends MyBaseAdapter<TicketNotUseInfo> {
public TicketNotUseAdapter(Context context) {
super(context);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.ticket_notuse_adapter, null);
info = new Info();
info.ticketNotUseAdapter_botLayout = (LinearLayout) convertView.findViewById(R.id.ticketNotUseAdapter_botLayout);
info.ticketNotUseAdapter_wxIv = (ImageView) convertView.findViewById(R.id.ticketNotUseAdapter_wxIv);
info.ticketNotUseAdapter_rightIv = (ImageView) convertView.findViewById(R.id.ticketNotUseAdapter_rightIv);
info.ticketNotUseAdapter_priceTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_priceTv);
info.ticketNotUseAdapter_nameTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_nameTv);
info.ticketNotUseAdapter_useTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_useTv);
info.ticketNotUseAdapter_timeTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_timeTv);
info.ticketNotUseAdapter_wxNameTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_wxNameTv);
info.ticketNotUseAdapter_getTimeTv = (TextView) convertView.findViewById(R.id.ticketNotUseAdapter_getTimeTv);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
if (getItem(position).getStatus() == 3) {
info.ticketNotUseAdapter_botLayout.setVisibility(View.VISIBLE);
Glide.with(context).load(ConfigUtil.getImageUrl(getItem(position).getUserReceiveAvatar(), 32, 32)).error(R.drawable.huisebeijing)
.bitmapTransform(new CropCircleTransformation(context)).crossFade(1000)
.into(info.ticketNotUseAdapter_wxIv);
info.ticketNotUseAdapter_wxNameTv.setText(getItem(position).getUserReceiveName());
info.ticketNotUseAdapter_getTimeTv.setText("领取时间:" + getItem(position).getUserReceiveTime());
} else {
info.ticketNotUseAdapter_botLayout.setVisibility(View.GONE);
}
info.ticketNotUseAdapter_priceTv.setText(getItem(position).getDiscountFee() + "");
info.ticketNotUseAdapter_nameTv.setText(getItem(position).getName());
info.ticketNotUseAdapter_useTv.setText(getItem(position).getCondition());
info.ticketNotUseAdapter_timeTv.setText("使用期限:" + getItem(position).getUserTimeRange());
if (getItem(position).getStatus() == -1) {
info.ticketNotUseAdapter_rightIv.setImageDrawable(context.getResources().getDrawable(R.drawable.overdue));
} else if (getItem(position).getStatus() == 2) {
info.ticketNotUseAdapter_rightIv.setImageDrawable(context.getResources().getDrawable(R.drawable.used));
} else {
info.ticketNotUseAdapter_rightIv.setImageDrawable(context.getResources().getDrawable(R.drawable.overgive));
}
return convertView;
}
class Info {
LinearLayout ticketNotUseAdapter_botLayout;
ImageView ticketNotUseAdapter_wxIv;
TextView ticketNotUseAdapter_priceTv;
TextView ticketNotUseAdapter_nameTv;
TextView ticketNotUseAdapter_useTv;
TextView ticketNotUseAdapter_timeTv;
ImageView ticketNotUseAdapter_rightIv;
TextView ticketNotUseAdapter_wxNameTv;
TextView ticketNotUseAdapter_getTimeTv;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.danding.yang800.BaseActivity;
import com.danding.yang800.Entity.MarketInfo;
import com.danding.yang800.Entity.TicketNotUseInfo;
import com.danding.yang800.Fragment.MyTicketUsedFrag;
import com.danding.yang800.Presenter.MarketPlatformFragPresenter;
import com.danding.yang800.Presenter.MyTicketUsedFragPresenter;
import com.danding.yang800.R;
import com.danding.yang800.View.MyDialog;
import com.zhy.autolayout.utils.AutoUtils;
public class TicketUsedAdapter extends MyBaseAdapter<TicketNotUseInfo> {
MyTicketUsedFragPresenter presenter;
private MyTicketUsedFrag frag;
BaseActivity context;
public TicketUsedAdapter(BaseActivity context, MyTicketUsedFrag frag) {
super(context);
this.frag = frag;
this.context = context;
presenter = new MyTicketUsedFragPresenter(frag, this);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater
.inflate(R.layout.ticket_used_adapter, null);
info = new Info();
info.ticketUsedAdapter_discountTv = (TextView) convertView.findViewById(R.id.ticketUsedAdapter_discountTv);
info.ticketUsedAdapter_nameTv = (TextView) convertView.findViewById(R.id.ticketUsedAdapter_nameTv);
info.ticketUsedAdapter_conditionTv = (TextView) convertView.findViewById(R.id.ticketUsedAdapter_conditionTv);
info.ticketUsedAdapter_timeTv = (TextView) convertView.findViewById(R.id.ticketUsedAdapter_timeTv);
info.ticketUsedAdapter_shareLayout = (LinearLayout) convertView.findViewById(R.id.ticketUsedAdapter_shareLayout);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
info.ticketUsedAdapter_discountTv.setText(getItem(position).getDiscountFee() + "");
info.ticketUsedAdapter_nameTv.setText(getItem(position).getName());
info.ticketUsedAdapter_conditionTv.setText(getItem(position).getCondition());
info.ticketUsedAdapter_timeTv.setText("使用期限:" + getItem(position).getUserTimeRange());
if (getItem(position).isCanShare()) {
info.ticketUsedAdapter_shareLayout.setVisibility(View.VISIBLE);
} else {
info.ticketUsedAdapter_shareLayout.setVisibility(View.GONE);
}
info.ticketUsedAdapter_shareLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
share(position);
}
});
return convertView;
}
private void share(int position) {
presenter.check(getItem(position).getPromotionId() + "", position, getItem(position).getUserPromotionId());
}
class Info {
TextView ticketUsedAdapter_discountTv;
TextView ticketUsedAdapter_nameTv;
TextView ticketUsedAdapter_conditionTv;
TextView ticketUsedAdapter_timeTv;
LinearLayout ticketUsedAdapter_shareLayout;
}
}
package com.danding.yang800.Adapter;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.OrderInfo;
import com.danding.yang800.Entity.WaitProfitInfo;
import com.danding.yang800.General.SingleRequestQueue;
import com.danding.yang800.LogisticsActivity;
import com.danding.yang800.OrderManageActivity;
import com.danding.yang800.R;
import com.danding.yang800.Util.BitmapCache;
import com.danding.yang800.WaitProfitActivity;
import com.zhy.autolayout.utils.AutoUtils;
public class WaitProfitAdapter extends MyBaseAdapter<WaitProfitInfo> {
private RequestQueue mQueue;
SharedPreferences sp;
WaitProfitActivity context;
private ImageLoader mImageLoader;
public WaitProfitAdapter(WaitProfitActivity context) {
super(context);
this.context = context;
mQueue = SingleRequestQueue.getRequestQueue(context);
mImageLoader = new ImageLoader(mQueue, new BitmapCache());
sp = context.getSharedPreferences("variable", Context.MODE_PRIVATE);
}
String order_needpay;
String order_tax;
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Info info = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.order_info_layout, null);
info = new Info();
info.order_infolayout = (LinearLayout) convertView
.findViewById(R.id.order_infolayout);
info.orderinfo_statusTV = (TextView) convertView
.findViewById(R.id.orderinfo_statusTV);
info.order_infoorderdeal = (LinearLayout) convertView
.findViewById(R.id.order_infoorderdeal);
info.order_infopayorder = (TextView) convertView
.findViewById(R.id.order_infopayorder);
info.order_creatTimeTv = (TextView) convertView
.findViewById(R.id.order_creatTimeTv);
info.order_needpayTv = (TextView) convertView
.findViewById(R.id.order_needpayTv);
info.order_shippongInfotV = (TextView) convertView
.findViewById(R.id.order_shippongInfotV);
info.order_line = (TextView) convertView
.findViewById(R.id.order_line);
convertView.setTag(info);
AutoUtils.autoSize(convertView);
} else {
info = (Info) convertView.getTag();
}
info.order_line.setVisibility(View.GONE);
View view;
info.order_infolayout.removeAllViews();
LinearLayout lineLayout = new LinearLayout(context);
lineLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lineLayout.setLayoutParams(layoutParams);
for (int i = 0; i < getItem(position).getOrderContent().length; i++) {
view = LayoutInflater.from(context).inflate(
R.layout.waitprofit_adapter_layout, null);
TextView shop_infotv = (TextView) view
.findViewById(R.id.shop_infotv);
order_needpay = getItem(position).getAmount();
order_tax = getItem(position).getTotalTax();
shop_infotv.setText(getItem(position).getOrderContent()[i]);
TextView mycollet_moneyTv = (TextView) view
.findViewById(R.id.mycollet_moneyTv);
mycollet_moneyTv.setText("单价:" + getItem(position).getShopPrice()[i]);
TextView mycollet_numTv = (TextView) view
.findViewById(R.id.mycollet_numTv);
TextView waitprofit_incomeTv = (TextView) view
.findViewById(R.id.waitprofit_incomeTv);
waitprofit_incomeTv.setText(getItem(position).getIncome()[i]);
mycollet_numTv.setText("件数" + getItem(position).getShopNumber()[i]);
ImageView shop_IV = (ImageView) view.findViewById(R.id.shop_IV);
// shop_IV.setTag(getItem(position).getUrl()[i]);
// ImageLoader.ImageListener listener = BitmapUtil.getImageListener(shop_IV,R.drawable.huisebeijing);
// mImageLoader.get(ConfigUtil.getImageUrl(getItem(position).getUrl()[i]), listener);
Glide.with(context).load(getItem(position).getUrl()[i]).
error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(shop_IV);
lineLayout.addView(view);
if (getItem(position).getOrderContent().length > 1 && i < getItem(position).getOrderContent().length - 1) {
View myview = LayoutInflater.from(context).inflate(
R.layout.order_manage_addview, null);
lineLayout.addView(myview);
}
}
info.order_infolayout.addView(lineLayout);
info.order_infopayorder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, LogisticsActivity.class);
intent.putExtra("packageSn", getItem(position).getPackageSn());
context.startActivity(intent);
}
});
info.order_needpayTv.setText(order_needpay);
info.order_shippongInfotV.setText("(含税费¥" + order_tax + " 运费¥" + getItem(position).getTotalExpPrice() + ")");
info.orderinfo_statusTV.setText(getItem(position).getStatusDesc());
info.order_creatTimeTv.setText(getItem(position).getCreateTime());
info.order_infoorderdeal.setVisibility(View.GONE);
return convertView;
}
class Info {
LinearLayout order_infolayout;
LinearLayout order_infoorderdeal;
TextView orderinfo_statusTV;
TextView order_infopayorder;
TextView order_needpayTv;
TextView order_shippongInfotV;
TextView order_creatTimeTv;
TextView order_line;
}
}
/*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.danding.yang800.Adapter;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
/**
* Wheel items adapter interface
*/
public interface WheelViewAdapter {
/**
* Gets items count
* @return the count of wheel items
*/
public int getItemsCount();
/**
* Get a View that displays the data at the specified position in the data set
*
* @param index the item index
* @param convertView the old view to reuse if possible
* @param parent the parent that this view will eventually be attached to
* @return the wheel item View
*/
public View getItem(int index, View convertView, ViewGroup parent);
/**
* Get a View that displays an empty wheel item placed before the first or after
* the last wheel item.
*
* @param convertView the old view to reuse if possible
* @param parent the parent that this view will eventually be attached to
* @return the empty item View
*/
public View getEmptyItem(View convertView, ViewGroup parent);
/**
* Register an observer that is called when changes happen to the data used by this adapter.
* @param observer the observer to be registered
*/
public void registerDataSetObserver(DataSetObserver observer);
/**
* Unregister an observer that has previously been registered
* @param observer the observer to be unregistered
*/
void unregisterDataSetObserver(DataSetObserver observer);
}
package com.danding.yang800;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.danding.yang800.Adapter.AfterServiceAdapter;
import com.danding.yang800.Entity.AfterServiceInfo;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.Presenter.AfterServiceActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.yanzhenjie.sofia.Sofia;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AfterServiceActivity extends BaseActivity {
@BindView(R.id.orderdetails_list)
ListView orderdetails_list;
@BindView(R.id.orderdetails_scrollview)
ScrollView orderdetails_scrollview;
@BindView(R.id.afterservice_writeLogisticsTv)
TextView afterservice_writeLogisticsTv;
@BindView(R.id.afterService_backTv)
TextView afterService_backTv;
@BindView(R.id.afterService_statusDescTv)
TextView afterService_statusDescTv;
@BindView(R.id.refund_snTv)
TextView refund_snTv;
@BindView(R.id.refund_typeDescTv)
TextView refund_typeDescTv;
@BindView(R.id.refund_applyRemarkTv)
TextView refund_applyRemarkTv;
@BindView(R.id.refund_totalAmountTv)
TextView refund_totalAmountTv;
@BindView(R.id.refund_addressNameTv)
TextView refund_addressNameTv;
@BindView(R.id.refund_addressNumberTv)
TextView refund_addressNumberTv;
@BindView(R.id.refund_addressTv)
TextView refund_addressTv;
@BindView(R.id.afterservice_cancelTv)
TextView afterservice_cancelTv;
@BindView(R.id.refund_addressLayout)
LinearLayout refund_addressLayout;
@BindView(R.id.refund_bottomLayout)
LinearLayout refund_bottomLayout;
@BindView(R.id.afterService_moneyLaoyout)
RelativeLayout afterService_moneyLaoyout;
AfterServiceAdapter adapter;
String packageSn;
AfterServiceActivityPresenter presenter;
String cancelId;
String addressName;
String addressPhone;
String addressDesc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_after_service);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
ButterKnife.bind(this);
Intent intent = getIntent();
packageSn = intent.getStringExtra("packageSn");
adapter = new AfterServiceAdapter(this);
presenter = new AfterServiceActivityPresenter(this, adapter);
presenter.getInfo(packageSn);
orderdetails_scrollview.smoothScrollTo(0, 20);
}
@OnClick({R.id.afterservice_writeLogisticsTv, R.id.afterService_backTv, R.id.afterservice_cancelTv
})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.afterService_backTv:
finish();
break;
case R.id.afterservice_writeLogisticsTv:
Intent intent = new Intent(AfterServiceActivity.this, WriteLogisticsActivity.class);
intent.putExtra("addressName", addressName);
intent.putExtra("addressPhone", addressPhone);
intent.putExtra("addressDesc", addressDesc);
intent.putExtra("cancelId", cancelId);
startActivityForResult(intent, 0);
break;
case R.id.afterservice_cancelTv:
presenter.cacel(cancelId);
break;
}
}
public void initData(String sn, String statusDesc, String typeDesc, String statusValue, String totalAmount,
String receiver, String receiverAddress, String receiverPhone, String applyRemark, String id) {
addressName = receiver;
addressPhone = receiverPhone;
addressDesc = receiverAddress;
cancelId = id;
orderdetails_list.setAdapter(adapter);
refund_snTv.setText(sn);
afterService_statusDescTv.setText(statusDesc);
refund_typeDescTv.setText(typeDesc);
refund_applyRemarkTv.setText(applyRemark);
refund_totalAmountTv.setText(totalAmount);
if (statusValue.equals("20")) {
refund_addressLayout.setVisibility(View.VISIBLE);
}else {
refund_addressLayout.setVisibility(View.GONE);
}
if (statusValue.equals("5")) {
afterService_moneyLaoyout.setVisibility(View.VISIBLE);
}else {
afterService_moneyLaoyout.setVisibility(View.GONE);
}
if (statusValue.equals("20") || statusValue.equals("1")) {
refund_bottomLayout.setVisibility(View.VISIBLE);
if (statusValue.equals("20")) {
afterservice_writeLogisticsTv.setVisibility(View.VISIBLE);
refund_addressNameTv.setText(receiver);
refund_addressNumberTv.setText(receiverPhone);
refund_addressTv.setText(receiverAddress);
} else {
afterservice_writeLogisticsTv.setVisibility(View.GONE);
}
if (statusValue.equals("1")) {
afterservice_cancelTv.setVisibility(View.VISIBLE);
} else {
afterservice_cancelTv.setVisibility(View.GONE);
}
} else {
refund_bottomLayout.setVisibility(View.GONE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (data != null) {
if (adapter != null) {
adapter.clear();
}
presenter.getInfo(packageSn);
}
}
}
}
package com.danding.yang800;
import android.graphics.Bitmap;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.danding.yang800.Util.ImgUtils;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.XScrollView;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AssureActivity extends BaseActivity {
@BindView(R.id.assure_backTv)
TextView assure_backTv;
@BindView(R.id.assure_scrollView)
XScrollView assure_scrollView;
ImageView assure_Iv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_assure);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
ButterKnife.bind(this);
assure_scrollView.setPullRefreshEnable(false);
assure_scrollView.setPullLoadEnable(false);
View content = LayoutInflater.from(this).inflate(R.layout.assure_content, null);
assure_Iv = (ImageView) content.findViewById(R.id.assure_Iv);
Glide.with(this).load(R.drawable.assure).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
assure_Iv.setImageBitmap(resource);
}
});
assure_scrollView.setView(content);
}
@OnClick({R.id.assure_backTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.assure_backTv:
finish();
break;
}
}
}
package com.danding.yang800;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.Presenter.BaseActivityPresenter;
import com.danding.yang800.Reciver.NetBroadCastReciver;
import com.danding.yang800.Service.LoginKeepService;
import com.danding.yang800.Util.NetUtil;
import com.umeng.analytics.MobclickAgent;
import java.util.ArrayList;
import java.util.Iterator;
public class BaseActivity extends AppCompatActivity implements NetBroadCastReciver.NetEvevt {
public static NetBroadCastReciver.NetEvevt evevt;
protected static ArrayList<BaseActivity> activityLists = new ArrayList<BaseActivity>();
private int netMobile;
SharedPreferences sp;
BaseActivityPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
activityLists.add(this);
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
presenter = new BaseActivityPresenter(this);
evevt = this;
// inspectNet();
// boolean netConnect = this.isNetConnect();
// if (netConnect) {
// } else {
// ToastUtil.show(this, "当前无网络");
// }
}
public boolean inspectNet() {
this.netMobile = NetUtil.getNetWorkState(BaseActivity.this);
return isNetConnect();
// if (netMobile == NetUtil.NETWORK_WIFI) {
// System.out.println("inspectNet:连接wifi");
// } else if (netMobile == NetUtil.NETWORK_MOBILE) {
// System.out.println("inspectNet:连接移动数据");
// } else if (netMobile == NetUtil.NETWORK_NONE) {
// System.out.println("inspectNet:当前没有网络");
//
// }
}
/**
* 网络变化之后的类型
*/
@Override
public void onNetChange(int netMobile) {
// TODO Auto-generated method stub
this.netMobile = netMobile;
//isNetConnect();
// boolean netConnect = this.isNetConnect();
// if (netConnect) {
// } else {
// ToastUtil.show(this, "当前无网络");【
// }
}
/**
* 判断有无网络 。
*
* @return true 有网, false 没有网络.
*/
public boolean isNetConnect() {
if (netMobile == NetUtil.NETWORK_WIFI) {
return true;
} else if (netMobile == NetUtil.NETWORK_MOBILE) {
return true;
} else if (netMobile == NetUtil.NETWORK_NONE) {
return false;
}
return false;
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
MobclickAgent.onPause(this);
super.onPause();
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
activityLists.remove(this);
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
if (Yang800App.iflogin) {
presenter.keepLogin();
}
if (sp.getBoolean("login", false)) {
if (!isWorked("com.danding.yang800.Service.LoginKeepService")) {
Intent startIntent = new Intent(
this,
LoginKeepService.class);
startService(startIntent);
}
}
}
private boolean isWorked(String className) {
ActivityManager myManager = (ActivityManager) this
.getApplicationContext().getSystemService(
this.ACTIVITY_SERVICE);
ArrayList<ActivityManager.RunningServiceInfo> runningService = (ArrayList<ActivityManager.RunningServiceInfo>) myManager
.getRunningServices(300);
for (int i = 0; i < runningService.size(); i++) {
if (runningService.get(i).service.getClassName().toString()
.equals(className)) {
return true;
}
}
return false;
}
protected void startActivity(Class<?> targetClass, int enterAnimID,
int exitAnimId) {
Intent intent = new Intent(this, targetClass);
startActivity(intent);
overridePendingTransition(enterAnimID, exitAnimId);
}
protected void startActivity(Class<?> targetClass) {
Intent intent = new Intent(this, targetClass);
startActivity(intent);
}
protected void startActivity(Class<?> targetClass, Bundle bundle) {
Intent intent = new Intent(this, targetClass);
intent.putExtras(bundle);
startActivity(intent);
}
protected void finish(int enterAnimID, int exitAnimId) {
finish();
overridePendingTransition(enterAnimID, exitAnimId);
}
public static void finishAll() {
Iterator<BaseActivity> it = activityLists.iterator();
while (it.hasNext()) {
it.next().finish();
}
}
}
package com.danding.yang800;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import android.os.Message;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.danding.yang800.Presenter.BindActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.View.AuthCodeCountDown;
import com.danding.yang800.View.NetworkProgressDialog;
import com.umeng.analytics.MobclickAgent;
import com.yanzhenjie.sofia.Sofia;
import java.util.UUID;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class BindPhoneActivity extends BaseActivity {
@BindView(R.id.bindphone_backTv)
TextView bindphone_backTv;
@BindView(R.id.bindphone_NameEdit)
EditText bindphone_NameEdit;
@BindView(R.id.bindphone_CodeEdit)
EditText bindphone_CodeEdit;
@BindView(R.id.bindphone_codeTv)
TextView bindphone_codeTv;
@BindView(R.id.bindphone_codeNoTv)
TextView bindphone_codeNoTv;
@BindView(R.id.bindphone_button)
TextView bindphone_button;
@BindView(R.id.bindPhone_wxNickNameTv)
TextView bindPhone_wxNickNameTv;
private NetworkProgressDialog pd;
BindActivityPresenter presenter;
private PopupWindow popupWindow;
SharedPreferences sp;
String epCode = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_bind_phone);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
ButterKnife.bind(this);
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
Intent intent = getIntent();
String nickName = intent.getStringExtra("nickName");
nickName="微信昵称";
bindPhone_wxNickNameTv.setText(nickName);
presenter = new BindActivityPresenter(this);
if (sp.getString("epCode", "").equals("")) {
epCode = UUID.randomUUID().toString();
sp.edit().putString("epCode", epCode).commit();
} else {
epCode = sp.getString("epCode", "");
}
}
@OnClick({R.id.bindphone_backTv, R.id.bindphone_NameEdit, R.id.bindphone_CodeEdit, R.id.bindphone_codeTv, R.id.bindphone_codeNoTv
, R.id.bindphone_button})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.bindphone_backTv:
finish();
break;
case R.id.bindphone_codeTv:
presenter.smsSend(bindphone_NameEdit.getText().toString().trim());
break;
case R.id.bindphone_codeNoTv:
showWindow();
break;
case R.id.bindphone_button:
String name = bindphone_NameEdit.getText().toString().trim();
String code = bindphone_CodeEdit.getText().toString().trim();
presenter.login(name, code, epCode);
// startActivity(MainActivity.class);
// BaseActivity.finishAll();
break;
}
}
public void showWindow() {
View contentView = LayoutInflater.from(this).inflate(
R.layout.layout_popupwindows_smscode, null);
popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT, true);
contentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
popupWindow.dismiss();
}
});
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAtLocation(contentView, Gravity.BOTTOM, 0, 0);
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
public void sendSuccess() {
AuthCodeCountDown mAuthCodeDown = new AuthCodeCountDown(60 * 1000 + 1100, bindphone_codeTv);
mAuthCodeDown.start();
bindphone_codeTv.setEnabled(false);
}
public void loginSuccess() {
// startActivity(PictureCheckActivity.class);
// finish();
// if (status.equals("99")) {
// if (!isWorked("com.danding.yang800.Service.LoginKeepService")) {
// Intent startIntent = new Intent(
// this,
// LoginKeepService.class);
// startService(startIntent);
// }
sp.edit().putBoolean("login", true).commit();
String cookie = sp.getString("Cookie", "") + ";S_INFO=" + (100000000 + sp.getInt("userId", 999999999))
+ ";D_INFO=" + (100000000 + sp.getInt("userId", 999999999));
sp.edit().putString("Cookie", cookie).commit();
MobclickAgent.onProfileSignIn(sp.getInt("userId", 999999999)+"");
Intent intent = new Intent(BindPhoneActivity.this, MainActivity.class);
startActivity(intent);
finish();
// } else if (status.equals("3")) {
// ToastUtil.show(this, "微信截图审核未通过");
// startActivity(PictureCheckActivity.class);
// } else if (status.equals("2")) {
// ToastUtil.show(this, "微信截图审核中");
// finish();
// } else if (status.equals("1")) {
// startActivity(PictureCheckActivity.class);
// finish();
// }
}
public void toMain() {
MobclickAgent.onProfileSignIn(sp.getInt("userId", 999999999)+"");
startActivity(MainActivity.class);
}
public void toGifitInfo(String storeSkuSn) {
Intent intent = new Intent(BindPhoneActivity.this, GiftInfoActivity.class);
intent.putExtra("storeSkuSn", storeSkuSn);
startActivity(intent);
}
public void toGiftList() {
startActivity(GiftListActivity.class);
}
}
package com.danding.yang800;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.danding.yang800.Presenter.ChangePhoneActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.NetworkProgressDialog;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ChangePhoneActivity extends BaseActivity {
@BindView(R.id.changePhone_backTv)
TextView changePhone_backTv;
@BindView(R.id.changephone_saveTv)
TextView changephone_saveTv;
private NetworkProgressDialog pd;
@BindView(R.id.changePhone_newPhoneEdit)
EditText changePhone_newPhoneEdit;
@BindView(R.id.changePhone_newPhoneAgainEdit)
EditText changePhone_newPhoneAgainEdit;
ChangePhoneActivityPresenter presenter;
SharedPreferences sp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_change_phone);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
ButterKnife.bind(this);
presenter = new ChangePhoneActivityPresenter(this);
changePhone_newPhoneEdit.requestFocus();
}
@OnClick({R.id.changePhone_backTv, R.id.changephone_saveTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.changePhone_backTv:
finish();
break;
case R.id.changephone_saveTv:
presenter.updateMobile(sp.getInt("userId", 0)+"", changePhone_newPhoneEdit.getText().toString().trim(),
changePhone_newPhoneAgainEdit.getText().toString().trim());
break;
}
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
public void updateMobileSuccess() {
dismissDialog();
ToastUtil.show(this, "更改成功");
finish();
}
}
package com.danding.yang800;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Config.ConfigUtil;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.Presenter.ChangePriceActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.NetworkProgressDialog;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ChangePriceActivity extends BaseActivity {
@BindView(R.id.changeprice_backTv)
TextView changeprice_backTv;
@BindView(R.id.changeprice_goodsIv)
ImageView changeprice_goodsIv;
@BindView(R.id.changeprice_goodsNameTv)
TextView changeprice_goodsNameTv;
@BindView(R.id.changeprice_skuSupplyPriceTv)
TextView changeprice_skuSupplyPriceTv;
@BindView(R.id.changeprice_skuMarketPriceTv)
TextView changeprice_skuMarketPriceTv;
@BindView(R.id.changeprice_storePriceTv)
TextView changeprice_storePriceTv;
@BindView(R.id.changeprice_savePrcieTv)
TextView changeprice_savePrcieTv;
@BindView(R.id.changeprice_PriceEdit)
EditText changeprice_PriceEdit;
ChangePriceActivityPresenter presenter;
String goodsSn = "";
String skuSn = "";
int position;
private NetworkProgressDialog pd;
double MarketPrice = 0;
SharedPreferences sp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_change_price);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
ButterKnife.bind(this);
Intent intent = getIntent();
goodsSn = intent.getStringExtra("goodsSn");
skuSn = intent.getStringExtra("skuSn");
position = intent.getIntExtra("position", 999);
presenter = new ChangePriceActivityPresenter(this);
initDialog();
presenter.getGoodsInfo(sp.getString("storeId", ""), goodsSn, skuSn);
changeprice_PriceEdit.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable edt) {
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
public void onTextChanged(CharSequence s, int arg1, int arg2, int arg3) {
if (s.toString().contains(".")) {
if (s.length() - 1 - s.toString().indexOf(".") > 2) {
s = s.toString().subSequence(0,
s.toString().indexOf(".") + 3);
changeprice_PriceEdit.setText(s);
changeprice_PriceEdit.setSelection(s.length());
}
}
if (s.toString().trim().substring(0).equals(".")) {
s = "0" + s;
changeprice_PriceEdit.setText(s);
changeprice_PriceEdit.setSelection(2);
}
if (s.toString().startsWith("0")
&& s.toString().trim().length() > 1) {
if (!s.toString().substring(1, 2).equals(".")) {
changeprice_PriceEdit.setText(s.subSequence(0, 1));
changeprice_PriceEdit.setSelection(1);
return;
}
}
}
});
}
@OnClick({R.id.changeprice_backTv, R.id.changeprice_savePrcieTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.changeprice_backTv:
finish();
break;
case R.id.changeprice_savePrcieTv:
presenter.updatePrice(sp.getString("storeId", ""), skuSn, changeprice_PriceEdit.getText().toString().trim(), MarketPrice);
break;
}
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
public void updateData(String goodsName, String skuImageUrl, String skuMarketPrice, double skuMarketPriceDouble, String skuSupplyPrice, String storePrice) {
MarketPrice = skuMarketPriceDouble;
changeprice_goodsNameTv.setText(goodsName);
Glide.with(this).load(ConfigUtil.getImageUrl(skuImageUrl, 133, 130)).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(changeprice_goodsIv);
changeprice_skuSupplyPriceTv.setText("¥" + skuSupplyPrice);
changeprice_skuMarketPriceTv.setText("¥" + skuMarketPrice);
changeprice_storePriceTv.setText("¥" + storePrice);
}
public void saveSuccess() {
Intent intent = new Intent();
intent.putExtra("position", position);
setResult(0, intent);// 设置resultCode,onActivityResult()中能获取到
finish();
}
}
package com.danding.yang800;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.danding.yang800.Presenter.ChangeNameActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.View.NetworkProgressDialog;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ChangeShopNameActivity extends BaseActivity {
@BindView(R.id.shopname_backTv)
TextView shopname_backTv;
@BindView(R.id.changenickname_edit)
EditText changenickname_edit;
@BindView(R.id.changenickname_tvsure)
TextView changenickname_tvsure;
ChangeNameActivityPresenter presenter;
private NetworkProgressDialog pd = null;
String storeId = "";
boolean authentication = false;
private String shopName = "";
SharedPreferences sp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_change_shop_name);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
ButterKnife.bind(this);
storeId = sp.getString("storeId", "");
presenter = new ChangeNameActivityPresenter(this);
Intent intent = getIntent();
authentication = intent.getBooleanExtra("authentication", false);
shopName = intent.getStringExtra("shopName");
changenickname_edit.setText(shopName);
}
@OnClick({R.id.shopname_backTv, R.id.changenickname_tvsure})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.shopname_backTv:
finish();
break;
case R.id.changenickname_tvsure:
initDialog();
presenter.updateInfo(storeId, authentication, changenickname_edit.getText().toString().trim());
break;
}
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
}
package com.danding.yang800;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.danding.yang800.Presenter.ChangeTakePassActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.NetworkProgressDialog;
import com.yanzhenjie.sofia.Sofia;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ChangeTakePassActivity extends BaseActivity {
@BindView(R.id.changeTakePass_backTv)
TextView changeTakePass_backTv;
@BindView(R.id.changeTakePass_saveTv)
TextView changeTakePass_saveTv;
@BindView(R.id.changeTakePass_OldPassEdit)
EditText changeTakePass_OldPassEdit;
@BindView(R.id.changeTakePass_newPassEdit)
EditText changeTakePass_newPassEdit;
@BindView(R.id.changeTakePass_newPassAgainEdit)
EditText changeTakePass_newPassAgainEdit;
private NetworkProgressDialog pd;
ChangeTakePassActivityPresenter presenter;
SharedPreferences sp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// int type = StatusColorUtil.StatusBarLightMode(this);
// if (type > 0) {
// StatusColorUtil.setStatusBarColor(this, R.color.white);
// StatusColorUtil.StatusBarLightMode(this, type);
// }
setContentView(R.layout.activity_change_take_pass);
Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
sp = getSharedPreferences("variable", Context.MODE_PRIVATE);
ButterKnife.bind(this);
presenter = new ChangeTakePassActivityPresenter(this);
}
@OnClick({R.id.changeTakePass_backTv, R.id.changeTakePass_saveTv})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.changeTakePass_backTv:
finish();
break;
case R.id.changeTakePass_saveTv:
presenter.updateWithdrawCashPassword(sp.getInt("userId", 0)+"", changeTakePass_OldPassEdit.getText().toString().trim(),
changeTakePass_newPassEdit.getText().toString().trim(), changeTakePass_newPassAgainEdit.getText().toString().trim());
break;
}
}
public void initDialog() {
if (pd == null) {
pd = NetworkProgressDialog.createDialog(this);
if (!pd.isShowing()) {
pd.show();
}
}
}
public void dismissDialog() {
if (pd != null) {
pd.dismiss();
pd = null;
NetworkProgressDialog.clear();
}
}
public void successData() {
ToastUtil.show(this, "修改成功");
finish();
}
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment