Skip to content

Commit

Permalink
Add dialog with Pro features
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Sep 2, 2015
1 parent 58eebc3 commit e0737b3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.view.View;

import com.afollestad.materialdialogs.MaterialDialog;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
import com.gc.materialdesign.widgets.SnackBar;
import com.javiersantos.mlmanager.AppInfo;
import com.javiersantos.mlmanager.MLManagerApplication;
import com.javiersantos.mlmanager.R;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;

import java.io.File;

Expand Down Expand Up @@ -104,4 +110,47 @@ public void onClick(View view) {
return snackBar;
}

public static MaterialDialog showProFeatures(final Context context) {
final MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(context);
adapter.add(new MaterialSimpleListItem.Builder(context)
.content(context.getResources().getString(R.string.pro_feature_1))
.icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_visibility_off).color(Color.GRAY).sizeDp(18))
.build());
adapter.add(new MaterialSimpleListItem.Builder(context)
.content(context.getResources().getString(R.string.pro_feature_2))
.icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_list).color(Color.GRAY).sizeDp(18))
.build());
adapter.add(new MaterialSimpleListItem.Builder(context)
.content(context.getResources().getString(R.string.pro_feature_3))
.icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_phonelink_erase).color(Color.GRAY).sizeDp(18))
.build());
adapter.add(new MaterialSimpleListItem.Builder(context)
.content(context.getResources().getString(R.string.pro_feature_4))
.icon(new IconicsDrawable(context).icon(GoogleMaterial.Icon.gmd_delete).color(Color.GRAY).sizeDp(18))
.build());

MaterialDialog.Builder materialBuilder = new MaterialDialog.Builder(context)
.title(context.getResources().getString(R.string.action_buy) + " (" + context.getResources().getString(R.string.action_buy_description) + ")")
.icon(context.getResources().getDrawable(R.mipmap.ic_launcher_pro))
.adapter(adapter, new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence charSequence) {}
})
.positiveText(context.getResources().getString(R.string.action_buy) + " ($1.43)")
.negativeText(context.getResources().getString(R.string.button_later))
.callback(new MaterialDialog.ButtonCallback() {
@Override
public void onPositive(MaterialDialog dialog) {
UtilsApp.goToGooglePlay(context, MLManagerApplication.getProPackage());
}

@Override
public void onNegative(MaterialDialog dialog) {
dialog.dismiss();
}
});

return materialBuilder.show();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public boolean onItemClick(View view, int position, IDrawerItem iDrawerItem) {
recyclerView.setAdapter(appHiddenAdapter);
break;
case 5:
context.startActivity(UtilsApp.goToGooglePlay(MLManagerApplication.getProPackage()));
UtilsDialog.showProFeatures(context);
break;
case 6:
context.startActivity(new Intent(context, SettingsActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
Expand Down

0 comments on commit e0737b3

Please sign in to comment.