Inline hide pro banner

This commit is contained in:
M66B
2023-06-16 11:33:34 +02:00
parent 97aab8b8a5
commit 8d4f396757
3 changed files with 41 additions and 17 deletions

View File

@@ -251,7 +251,8 @@ public class FragmentMessages extends FragmentBase
private TextView tvAirplane;
private TextView tvNotifications;
private TextView tvBatteryOptimizations;
private TextView tvSupport;
private TextView tvHintPro;
private ImageButton ibHintPro;
private ImageButton ibHintSupport;
private ImageButton ibHintSwipe;
private ImageButton ibHintSelect;
@@ -275,7 +276,7 @@ public class FragmentMessages extends FragmentBase
private Group grpAirplane;
private Group grpNotifications;
private Group grpBatteryOptimizations;
private Group grpSupport;
private Group grpPro;
private Group grpHintSupport;
private Group grpHintSwipe;
private Group grpHintSelect;
@@ -557,7 +558,8 @@ public class FragmentMessages extends FragmentBase
tvAirplane = view.findViewById(R.id.tvAirplane);
tvNotifications = view.findViewById(R.id.tvNotifications);
tvBatteryOptimizations = view.findViewById(R.id.tvBatteryOptimizations);
tvSupport = view.findViewById(R.id.tvSupport);
tvHintPro = view.findViewById(R.id.tvHintPro);
ibHintPro = view.findViewById(R.id.ibHintPro);
ibHintSupport = view.findViewById(R.id.ibHintSupport);
ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
ibHintSelect = view.findViewById(R.id.ibHintSelect);
@@ -582,7 +584,7 @@ public class FragmentMessages extends FragmentBase
grpAirplane = view.findViewById(R.id.grpAirplane);
grpNotifications = view.findViewById(R.id.grpNotifications);
grpBatteryOptimizations = view.findViewById(R.id.grpBatteryOptimizations);
grpSupport = view.findViewById(R.id.grpSupport);
grpPro = view.findViewById(R.id.grpPro);
grpHintSupport = view.findViewById(R.id.grpHintSupport);
grpHintSwipe = view.findViewById(R.id.grpHintSwipe);
grpHintSelect = view.findViewById(R.id.grpHintSelect);
@@ -657,11 +659,20 @@ public class FragmentMessages extends FragmentBase
}
});
grpSupport.setVisibility(View.GONE);
tvSupport.setOnClickListener(new View.OnClickListener() {
grpPro.setVisibility(View.GONE);
tvHintPro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(), ActivityBilling.class));
startActivity(new Intent(v.getContext(), ActivityBilling.class));
}
});
ibHintPro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
long banner_hidden = new Date().getTime() + FragmentPro.HIDE_BANNER * 7 * 24 * 3600 * 1000L;
prefs.edit().putLong("banner_hidden", banner_hidden).apply();
startActivity(new Intent(v.getContext(), ActivityBilling.class));
}
});
@@ -5147,11 +5158,11 @@ public class FragmentMessages extends FragmentBase
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (grpSupport != null &&
if (grpPro != null &&
("pro".equals(key) || "banner_hidden".equals(key))) {
boolean pro = ActivityBilling.isPro(getContext());
long banner_hidden = prefs.getLong("banner_hidden", 0);
grpSupport.setVisibility(
grpPro.setVisibility(
!pro && banner_hidden == 0 && viewType == AdapterMessage.ViewType.UNIFIED
? View.VISIBLE : View.GONE);
}

View File

@@ -68,7 +68,7 @@ public class FragmentPro extends FragmentBase implements SharedPreferences.OnSha
private Button btnConsume;
private ImageView ivConnected;
private static final int HIDE_BANNER = 4; // weeks
static final int HIDE_BANNER = 4; // weeks
@Override
@Nullable