Search in sources :

Example 1 with VersionUpdate

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);
}
Also used : VersionUpdate(com.mnnyang.gzuclassschedule.utils.VersionUpdate) TextView(android.widget.TextView)

Example 2 with VersionUpdate

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);
}
Also used : VersionUpdate(com.mnnyang.gzuclassschedule.utils.VersionUpdate)

Example 3 with VersionUpdate

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));
        }
    });
}
Also used : Version(com.mnnyang.gzuclassschedule.data.bean.Version) VersionUpdate(com.mnnyang.gzuclassschedule.utils.VersionUpdate)

Aggregations

VersionUpdate (com.mnnyang.gzuclassschedule.utils.VersionUpdate)3 TextView (android.widget.TextView)1 Version (com.mnnyang.gzuclassschedule.data.bean.Version)1