package io.dcloud.H5B79C397.fragment;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.android.volley.VolleyError;
import com.vanda.vandalibnetwork.fragment.BaseFragment;
import java.util.Map;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.onekeyshare.OnekeyShare;
import cn.sharesdk.sina.weibo.SinaWeibo;
import cn.sharesdk.tencent.qq.QQ;
import cn.sharesdk.wechat.friends.Wechat;
import cn.sharesdk.wechat.moments.WechatMoments;
import io.dcloud.H5B79C397.R;
import io.dcloud.H5B79C397.Urls;
import io.dcloud.H5B79C397.activity.BottomMenu;
import io.dcloud.H5B79C397.activity.LoginActivity;
import io.dcloud.H5B79C397.activity.Myself_About_fae;
import io.dcloud.H5B79C397.activity.Myself_Invitation;
import io.dcloud.H5B79C397.activity.Myself_help;
import io.dcloud.H5B79C397.activity.Myself_setting;
import io.dcloud.H5B79C397.activity.RegisterActivity;
import io.dcloud.H5B79C397.activity.user_management;
import io.dcloud.H5B79C397.pojo.InformmationData;
import io.dcloud.H5B79C397.util.ActionBarUtil;
import io.dcloud.H5B79C397.util.ExtUtils;
/**
* 用户个人信息界面
*/
public class MyselfFragment extends BaseFragment<InformmationData> implements View.OnClickListener {
private Context mContext;
private View view;
private BottomMenu menuWindow;
private RelativeLayout layout_advise, layout_collect, layout_logo, layout_share, layout_qr_code, layout_help, layout_set, layout_url;
private Button btnLogin, btnRegister;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_information, container, false );
initView();
return view;
}
@Override
public void onStart() {
super .onStart();
}
private void initView() {
new ActionBarUtil(view, R.id.actionBar, R.id.Back, R.id.Title, R.id.Activity, "我的管理中心" , getActivity(), 2 );
layout_advise = (RelativeLayout) view.findViewById(R.id.myself_advise);
layout_collect = (RelativeLayout) view.findViewById(R.id.myself_collect);
layout_logo = (RelativeLayout) view.findViewById(R.id.myself_logo);
layout_share = (RelativeLayout) view.findViewById(R.id.myself_share);
layout_qr_code = (RelativeLayout) view.findViewById(R.id.myself_qr_code);
layout_help = (RelativeLayout) view.findViewById(R.id.myself_help);
layout_set = (RelativeLayout) view.findViewById(R.id.myself_set);
layout_url = (RelativeLayout) view.findViewById(R.id.myself_url);
btnLogin = (Button) view.findViewById(R.id.myself_login);
btnRegister = (Button) view.findViewById(R.id.myself_register);
layout_advise.setOnClickListener( this );
layout_collect.setOnClickListener( this );
layout_logo.setOnClickListener( this );
layout_share.setOnClickListener( this );
layout_qr_code.setOnClickListener( this );
layout_help.setOnClickListener( this );
layout_set.setOnClickListener( this );
layout_url.setOnClickListener( this );
btnLogin.setOnClickListener( this );
btnRegister.setOnClickListener( this );
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.myself_advise:
startActivity( new Intent(getActivity(), user_management. class ));
break ;
case R.id.myself_collect:
break ;
case R.id.myself_logo:
Intent intent= new Intent(getActivity(),Myself_About_fae. class );
startActivity(intent);
break ;
case R.id.myself_share:
menuWindow = new BottomMenu(mContext, clickListener);
menuWindow.show();
break ;
case R.id.myself_qr_code:
startActivity( new Intent(getActivity(), Myself_Invitation. class ));
break ;
case R.id.myself_help:
startActivity( new Intent(getActivity(), Myself_help. class ));
break ;
case R.id.myself_set:
startActivity( new Intent(getActivity(), Myself_setting. class ));
break ;
case R.id.myself_url:
Uri uri = Uri.parse( "http://www.fae.cn/" );
Intent intent1 = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent1);
break ;
case R.id.myself_login:
startActivity( new Intent(getActivity(), LoginActivity. class ));
break ;
case R.id.myself_register:
startActivity( new Intent(getActivity(), RegisterActivity. class ));
break ;
default :
break ;
}
}
private View.OnClickListener clickListener = new View.OnClickListener(){
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn1:
showZiDingYi(Wechat.NAME);
break ;
case R.id.btn2:
showZiDingYi(WechatMoments.NAME);
Toast.makeText(mContext, "这是微信朋友圈" ,Toast.LENGTH_SHORT).show();
break ;
case R.id.sina:
showZiDingYi(SinaWeibo.NAME);
break ;
case R.id.QQ:
showZiDingYi(QQ.NAME);
break ;
case R.id.more:
Toast.makeText(mContext, "这是更多" ,Toast.LENGTH_SHORT).show();
break ;
default :
break ;
}
}
};
private void showZiDingYi(String ss){
ShareSDK.initSDK(getActivity());
OnekeyShare oks = new OnekeyShare();
oks.setSilent( false );
oks.setDialogMode();
oks.setText( "xxxxxxxxx" );
//oks.setImageUrl("http://sharesdk.cn");
oks.setPlatform(ss);
oks.show(getActivity());
}
public static MyselfFragment newInstance(Context context) {
MyselfFragment fragment = new MyselfFragment();
fragment.mContext = context;
return fragment;
}
public MyselfFragment() {
// Required empty public constructor
}
@Override
protected void processData(InformmationData response) {
super .processData(response);
if (response != null ) {
}
}
@Override
protected void errorData(VolleyError volleyError) {
super .errorData(volleyError);
ExtUtils.errorLog( "-----MyselfFragment----volleyError--------->" , volleyError + "" );
}
@Override
protected String getRequestUrl() {
return Urls.URL_PREFIX + "" ;
}
@Override
protected Class<InformmationData> getResponseDataClass() {
return InformmationData. class ;
}
@Override
protected Map<String, String> getParamMap() {
return null ;
}
}
|