正在查看: Biko v2.0.23 应用的 ParticipantActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 ParticipantActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.chat;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import app.callpe.adapters.ParticipantAdapter;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.APIError;
import app.callpe.data.model.ErrorHandler;
import app.callpe.data.model.StreamerModel;
import app.callpe.databinding.ActivityParticipantBinding;
import app.callpe.service.ApiService;
import app.callpe.ui.home.StreamerDetailActivity;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
import javax.inject.Inject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
public class ParticipantActivity extends Hilt_ParticipantActivity implements ParticipantAdapter.ParticipantItemAdapterClickListener {
private static final String TAG = "ParticipantDetail";
@Inject
ApiService apiService;
ActivityParticipantBinding binding;
private ParticipantAdapter participantAdapter;
private RecyclerView participantRecyclerView;
private long taskId = 0;
private final ArrayList<StreamerModel> participantArrayList = new ArrayList<>();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityParticipantBinding inflate = ActivityParticipantBinding.inflate(getLayoutInflater());
this.binding = inflate;
setContentView(inflate.getRoot());
setUpToolbar();
setRecycler();
getParticipantResponse();
setSwipeToRefresh();
}
private void setRecycler() {
this.participantRecyclerView = this.binding.participantRecyclerView;
this.binding.participantRecyclerView.setLayoutManager(new CustomLinearLayoutManager(this));
}
private void setUpToolbar() {
try {
getIntent().getStringExtra("taskTitle");
this.binding.participantToolbar.setTitle("Participants");
setSupportActionBar(this.binding.participantToolbar);
((ActionBar) Objects.requireNonNull(getSupportActionBar())).setDisplayHomeAsUpEnabled(true);
} catch (Exception e) {
Timber.e(e, "setUpToolbar: Error ", new Object[0]);
}
}
public void setProgress(boolean isVisible) {
if (isVisible) {
this.binding.participantProgress.setVisibility(0);
} else {
this.binding.participantProgress.setVisibility(8);
}
}
private void setSwipeToRefresh() {
this.binding.participantRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public final void onRefresh() {
ParticipantActivity.this.m1114x629cbe5();
}
});
}
void m1114x629cbe5() {
getParticipantResponse();
this.binding.participantRefreshLayout.setRefreshing(false);
}
private void getParticipantResponse() {
setProgress(true);
this.taskId = getIntent().getLongExtra("taskId", 0L);
final String string = SharedPref.getString(this, PrefKeys.ACCOUNT_ID);
Timber.d("getChatResponse: task id %s", new Object[]{Long.valueOf(this.taskId)});
this.apiService.getAllStreamerParticipants().enqueue(new Callback<ArrayList<StreamerModel>>() {
public void onResponse(Call<ArrayList<StreamerModel>> call, Response<ArrayList<StreamerModel>> response) {
Timber.e("onResponse: %s", new Object[]{response.raw()});
ParticipantActivity.this.setProgress(false);
if (response.isSuccessful()) {
if (response.body() != null) {
Timber.e("onResponse: size %s", new Object[]{Integer.valueOf(((ArrayList) response.body()).size())});
ParticipantActivity.this.participantArrayList.clear();
ParticipantActivity.this.participantArrayList.addAll((Collection) response.body());
ParticipantActivity participantActivity = ParticipantActivity.this;
?? r2 = ParticipantActivity.this;
participantActivity.participantAdapter = new ParticipantAdapter(r2, r2, ((ParticipantActivity) r2).participantArrayList, ParticipantActivity.this, string);
ParticipantActivity.this.participantRecyclerView.setAdapter(ParticipantActivity.this.participantAdapter);
return;
}
return;
}
try {
APIError parseError = ErrorHandler.parseError(response);
Toast.makeText((Context) ParticipantActivity.this, (CharSequence) (ParticipantActivity.this.getString(2131952996) + ": " + parseError.getReason()), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
public void onFailure(Call<ArrayList<StreamerModel>> call, Throwable t) {
ParticipantActivity.this.setProgress(false);
Helper.noNetworkToast(ParticipantActivity.this, t);
}
});
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() != 16908332) {
return true;
}
onBackPressed();
return true;
}
@Override
public void onItemClick(int index, StreamerModel participantModel, ParticipantAdapter.ViewHolder holder) {
Intent intent = new Intent((Context) this, (Class<?>) StreamerDetailActivity.class);
intent.putExtra("id", participantModel.getId());
startActivity(intent);
}
}