| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.support.v4.widget.SwipeRefreshLayout; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | |
| | | import com.weikou.beibeivideo.entity.Attention; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.yeshi.buwanshequ.R; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.mine.MyFavouriteActivity; |
| | | import com.weikou.beibeivideo.util.JsonUtil; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.util.ui.TopStatusSettings; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | ListView lv_follow; |
| | | |
| | | RefreshLayout rl_refresh; |
| | | MySwipeRefreshLayout rl_refresh; |
| | | |
| | | TextView tv_middle; |
| | | |
| | |
| | | protected void onCreate(Bundle arg0) { |
| | | super.onCreate(arg0); |
| | | setContentView(R.layout.activity_follow); |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | Window window = getWindow(); |
| | | window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, |
| | | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
| | | int result = 0; |
| | | int resourceId = getResources().getIdentifier("status_bar_height", |
| | | "dimen", "android"); |
| | | if (resourceId > 0) { |
| | | result = getResources().getDimensionPixelSize(resourceId); |
| | | } |
| | | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, |
| | | result); |
| | | findViewById(R.id.v_status_bar).setLayoutParams(params); |
| | | } else { |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | ll_no_data = (LinearLayout) findViewById(R.id.ll_no_data); |
| | | lv_follow = (ListView) findViewById(R.id.lv_activity_follow); |
| | | lv_follow.addHeaderView(new View(this)); |
| | | rl_refresh = (RefreshLayout) findViewById(R.id.rl_follow_activity); |
| | | rl_refresh = findViewById(R.id.rl_follow_activity); |
| | | ll_no_login = (LinearLayout) findViewById(R.id.ll_no_login); |
| | | tv_login = (TextView) findViewById(R.id.tv_follow_login); |
| | | tv_middle = (TextView) findViewById(R.id.tv_top_bar_middle); |
| | |
| | | tv_login.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | startActivity(new Intent(FollowActivity.this, LoginActivity.class)); |
| | | UserUtil.toLogin(FollowActivity.this); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | getAttentionList(uid, loginUid); |
| | | } |
| | | }); |
| | | rl_refresh.setOnLoadListener(new RefreshLayout.OnLoadListener() { |
| | | rl_refresh.setOnLoadListener(new MySwipeRefreshLayout.OnLoadListener() { |
| | | @Override |
| | | public void onLoad() { |
| | | cPage++; |
| | |
| | | return; |
| | | } |
| | | |
| | | Gson gson = new GsonBuilder() |
| | | .setPrettyPrinting() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<Attention> list = gson.fromJson(jsonObject |
| | | List<Attention> list = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<Attention>>() { |
| | | }.getType()); |