Fix free version dialog
This commit is contained in:
parent
f09e99ca8c
commit
1c80a423b7
2 changed files with 27 additions and 21 deletions
|
@ -90,14 +90,16 @@
|
|||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fullVersionLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/list_content_padding"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="54dp"
|
||||
|
@ -154,17 +156,20 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/osmLiveLayoutTopDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="54dp"
|
||||
android:layout_marginTop="@dimen/list_content_padding"
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/osmLiveLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/list_content_padding"
|
||||
android:layout_marginBottom="@dimen/list_content_padding"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
|
@ -220,13 +225,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="54dp"
|
||||
android:layout_marginTop="@dimen/list_content_padding"
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -1,34 +1,42 @@
|
|||
package net.osmand.plus.download.ui;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity.FreeVersionDialog;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public class FreeVersionDialogFragment extends DialogFragment {
|
||||
|
||||
|
||||
private FreeVersionDialog dialog;
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setNegativeButton(R.string.later, null);
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.free_version_banner, null);
|
||||
boolean hidePlus = false;
|
||||
try {
|
||||
String devId = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
if (!Algorithms.isEmpty(devId)) {
|
||||
hidePlus = devId.hashCode() % 20 == 8;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignored
|
||||
}
|
||||
view.findViewById(R.id.osmLiveLayoutTopDivider).setVisibility(hidePlus ? View.GONE : View.VISIBLE);
|
||||
view.findViewById(R.id.fullVersionLayout).setVisibility(hidePlus ? View.GONE : View.VISIBLE);
|
||||
builder.setView(view);
|
||||
dialog = new DownloadActivity.FreeVersionDialog(view, getDownloadActivity(), true);
|
||||
dialog.initFreeVersionBanner();
|
||||
|
|
Loading…
Reference in a new issue