use of com.mnnyang.gzuclassschedule.utils.VersionUpdate in project GzuClassSchedule by mnnyang.
the class AboutActivity method initVersionName.
private void initVersionName() {
TextView tvVersionName = findViewById(R.id.tv_version);
VersionUpdate vu = new VersionUpdate();
String versionName = vu.getLocalVersionName(app.mContext);
tvVersionName.setText(versionName);
}
use of com.mnnyang.gzuclassschedule.utils.VersionUpdate in project GzuClassSchedule by mnnyang.
the class SettingActivity method initDefaultValues.
private void initDefaultValues() {
sinShowNoon.setChecked(PreferenceManager.getDefaultSharedPreferences(getBaseContext()).getBoolean(getString(R.string.app_preference_show_noon), false));
sinHideFab.setChecked(PreferenceManager.getDefaultSharedPreferences(getBaseContext()).getBoolean(getString(R.string.app_preference_hide_fab), true));
VersionUpdate vu = new VersionUpdate();
String versionName = vu.getLocalVersionName(app.mContext);
sinAbout.setSummary(versionName);
}
use of com.mnnyang.gzuclassschedule.utils.VersionUpdate in project GzuClassSchedule by mnnyang.
the class AboutPresenter method checkUpdate.
@Override
public void checkUpdate() {
mView.showNotice(app.mContext.getString(R.string.checking_for_updates));
final VersionUpdate versionUpdate = new VersionUpdate();
versionUpdate.checkUpdate(new HttpCallback<Version>() {
@Override
public void onSuccess(Version version) {
if (version == null) {
LogUtil.e(this, "version object is null");
return;
}
int localVersion = versionUpdate.getLocalVersion(app.mContext);
LogUtil.d(this, String.valueOf(version.getCode()));
if (version.getVersion() > localVersion) {
mView.showUpdateVersionInfo(version);
} else {
mView.showNotice(app.mContext.getString(R.string.already_the_latest_version));
}
}
@Override
public void onFail(String errMsg) {
LogUtil.e(this, errMsg);
ToastUtils.show(app.mContext.getString(R.string.access_err));
}
});
}
Aggregations