use of com.shu.studentmanager.activity.MainActivity in project student-manager by SYYANI.
the class CourseAdapter method enSureDelete.
private void enSureDelete(CourseTeacher courseTeacher) {
Log.d(TAG, "enSureDelete: " + courseTeacher.toString());
String url = "http://101.35.20.64:10086/course/deleteById/" + courseTeacher.getCid();
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder().url(url).method("GET", null).build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Log.d(TAG, "run: "+response.body().string());
Boolean insert_true = Boolean.parseBoolean(response.body().string());
final MainActivity mainActivity;
mainActivity = (MainActivity) context;
if (insert_true) {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_SUCCESS;
handler.sendMessage(message);
} else {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_FAILURE;
handler.sendMessage(message);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
use of com.shu.studentmanager.activity.MainActivity in project student-manager by SYYANI.
the class CourseOpenAdapter method enSureOpen.
private void enSureOpen(CourseTeacher courseTeacher) {
Log.d(TAG, "enSureOpen: " + courseTeacher.toString());
StudentManagerApplication application = (StudentManagerApplication) context.getApplicationContext();
String url = "http://101.35.20.64:10086/courseTeacher/insert/" + courseTeacher.getCid() + "/" + application.getId() + "/" + application.getCurrentTerm();
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder().url(url).method("GET", null).build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Log.d(TAG, "run: "+response.body().string());
Boolean insert_true = Boolean.parseBoolean(response.body().string());
final MainActivity mainActivity;
mainActivity = (MainActivity) context;
if (insert_true) {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_SUCCESS;
handler.sendMessage(message);
} else {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_FAILURE;
handler.sendMessage(message);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
use of com.shu.studentmanager.activity.MainActivity in project student-manager by SYYANI.
the class CourseOpenedAdapter method enSureDelete.
private void enSureDelete(CourseStudent courseStudent) {
Log.d(TAG, "enSureDelete: select course");
Log.d(TAG, "enSureDelete: " + courseStudent.toString());
StudentManagerApplication application = (StudentManagerApplication) context.getApplicationContext();
String url = "http://101.35.20.64:10086/course/deleteById/" + courseStudent.getCid();
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder().url(url).method("GET", null).build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Log.d(TAG, "run: "+response.body().string());
Boolean insert_true = Boolean.parseBoolean(response.body().string());
final MainActivity mainActivity;
mainActivity = (MainActivity) context;
if (insert_true) {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_SUCCESS;
handler.sendMessage(message);
} else {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_FAILURE;
handler.sendMessage(message);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
use of com.shu.studentmanager.activity.MainActivity in project student-manager by SYYANI.
the class ScoreTeacherAdapter method enSureChange.
private void enSureChange(String input, ScoreTeacher scoreTeacher) {
String url = "http://101.35.20.64:10086/SCT/updateById/" + scoreTeacher.getSid() + '/' + scoreTeacher.getCid() + '/' + scoreTeacher.getTid() + '/' + scoreTeacher.getTerm() + '/' + input;
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder().url(url).method("GET", null).build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Log.d(TAG, "run: "+response.body().string());
Boolean insert_true = Boolean.parseBoolean(response.body().string());
final MainActivity mainActivity;
mainActivity = (MainActivity) context;
if (insert_true) {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_SUCCESS;
handler.sendMessage(message);
} else {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_FAILURE;
handler.sendMessage(message);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
use of com.shu.studentmanager.activity.MainActivity in project student-manager by SYYANI.
the class CourseManageAdapter method enSureDelete.
private void enSureDelete(CourseTeacher courseTeacher) {
Log.d(TAG, "enSureDelete: " + courseTeacher.toString());
StudentManagerApplication application = (StudentManagerApplication) context.getApplicationContext();
String url = "http://101.35.20.64:10086/course/deleteById/" + courseTeacher.getCid();
new Thread() {
@Override
public void run() {
super.run();
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder().url(url).method("GET", null).build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Log.d(TAG, "run: "+response.body().string());
Boolean insert_true = Boolean.parseBoolean(response.body().string());
final MainActivity mainActivity;
mainActivity = (MainActivity) context;
if (insert_true) {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_SUCCESS;
handler.sendMessage(message);
} else {
Handler handler = mainActivity.getHandler_main_activity();
Message message = handler.obtainMessage();
message.what = RequestConstant.REQUEST_FAILURE;
handler.sendMessage(message);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
Aggregations