mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 19:35:10 +01:00
Inline hide pro banner
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -92,24 +92,37 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBatteryOptimizations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSupport"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/tvHintPro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="36dp"
|
||||
android:padding="6dp"
|
||||
android:text="@string/title_pro_support"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibHintPro"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/vSeparatorBatteryOptimizations" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibHintPro"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/title_legend_close_hint"
|
||||
android:padding="9dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvHintPro"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tvHintPro"
|
||||
app:srcCompat="@drawable/twotone_close_24" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vSeparatorSupport"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/colorSeparator"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSupport" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvHintPro" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvHintSupport"
|
||||
@@ -497,10 +510,10 @@
|
||||
app:constraint_referenced_ids="tvBatteryOptimizations,vSeparatorBatteryOptimizations" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpSupport"
|
||||
android:id="@+id/grpPro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvSupport,vSeparatorSupport" />
|
||||
app:constraint_referenced_ids="tvHintPro,ibHintPro,vSeparatorSupport" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpHintSupport"
|
||||
|
||||
Reference in New Issue
Block a user