change log dialog added

This commit is contained in:
h4h13 2018-08-06 16:17:35 +05:30
parent d870e3ce63
commit b07effd80b

View file

@ -1,13 +1,5 @@
package code.name.monkey.retromusic.ui.activities;
import static code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK;
import static code.name.monkey.retromusic.Constants.APP_TWITTER_LINK;
import static code.name.monkey.retromusic.Constants.GITHUB_PROJECT;
import static code.name.monkey.retromusic.Constants.GOOGLE_PLUS_COMMUNITY;
import static code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY;
import static code.name.monkey.retromusic.Constants.TELEGRAM_CHANGE_LOG;
import static code.name.monkey.retromusic.Constants.TRANSLATE;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@ -19,15 +11,27 @@ import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.afollestad.materialdialogs.MaterialDialog;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.ChangelogDialog;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.util.NavigationUtil;
import static code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK;
import static code.name.monkey.retromusic.Constants.APP_TWITTER_LINK;
import static code.name.monkey.retromusic.Constants.GITHUB_PROJECT;
import static code.name.monkey.retromusic.Constants.GOOGLE_PLUS_COMMUNITY;
import static code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY;
import static code.name.monkey.retromusic.Constants.TELEGRAM_CHANGE_LOG;
import static code.name.monkey.retromusic.Constants.TRANSLATE;
/**
* @author Hemanth S (h4h13)
*/
@ -124,7 +128,7 @@ public class AboutActivity extends AbsBaseActivity {
openUrl(APP_TWITTER_LINK);
break;
case R.id.changelog:
openUrl(TELEGRAM_CHANGE_LOG);
showChangeLogOptions();
break;
case R.id.open_source:
NavigationUtil.goToOpenSource(this);
@ -132,6 +136,23 @@ public class AboutActivity extends AbsBaseActivity {
}
}
private void showChangeLogOptions() {
new MaterialDialog.Builder(this)
.items(new String[]{"Telegram Channel", "App"})
.itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
if (position == 0) {
openUrl(TELEGRAM_CHANGE_LOG);
} else {
ChangelogDialog.create().show(getSupportFragmentManager(), "change-log");
}
}
})
.build()
.show();
}
private String getAppVersion() {
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);