mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add a button which will be displayed when nearby permission is not granted thus closest point can't be displayed on main screen. Besides, theme dependent click styles are added to button
This commit is contained in:
parent
69df3c01c9
commit
9fecc07ad7
4 changed files with 91 additions and 73 deletions
|
|
@ -9,6 +9,7 @@ import android.view.View;
|
|||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextSwitcher;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -22,8 +23,8 @@ import fr.free.nrw.commons.notification.Notification;
|
|||
public class NearbyNoificationCardView extends CardView{
|
||||
|
||||
private Context context;
|
||||
private TextSwitcher notificationTextSwitcher;
|
||||
private TextSwitcher notificationTimeSwitcher;
|
||||
private TextView notificationTextSwitcher;
|
||||
private TextView notificationTimeSwitcher;
|
||||
private ImageView notificationIcon;
|
||||
|
||||
public NearbyNoificationCardView(@NonNull Context context) {
|
||||
|
|
|
|||
|
|
@ -7,80 +7,84 @@
|
|||
android:layout_centerVertical="true"
|
||||
android:minHeight="72dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nearby_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:contentDescription="@string/no_image_found"
|
||||
android:visibility="gone"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_location_white_24dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_toRightOf="@id/nearby_icon"
|
||||
android:weightSum="4"
|
||||
>
|
||||
|
||||
<TextSwitcher
|
||||
android:id="@+id/nearby_title"
|
||||
android:layout_width="0dp"
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_toRightOf="@id/nearby_icon"
|
||||
android:text="Tab to see closest wikidata item needs photo"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="test distance">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
</TextSwitcher>
|
||||
|
||||
<TextSwitcher
|
||||
android:id="@+id/nearby_distance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:minWidth="48dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:text="test distance">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
</TextSwitcher>
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
android:theme="?attr/mainScreenNearbyPermissionbutton"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"/>
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nearby_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:contentDescription="@string/no_image_found"
|
||||
android:visibility="gone"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_location_white_24dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_toRightOf="@id/nearby_icon"
|
||||
android:weightSum="4"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nearby_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_toRightOf="@id/nearby_icon"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="test distance"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
>
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nearby_distance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:minWidth="48dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:text="test distance"
|
||||
android:textColor="@android:color/white"
|
||||
android:singleLine="true"
|
||||
>
|
||||
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<attr name="contributionsListBackground" format="reference"/>
|
||||
<attr name="mainTabBackground" format="reference"/>
|
||||
<attr name="mainCardBackground" format="reference"/>
|
||||
<attr name="mainScreenNearbyPermissionbutton" format="reference"/>
|
||||
|
||||
|
||||
<declare-styleable name="CompatTextView">
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<item name="textDisabled">@color/disabled_button_text_color_dark</item>
|
||||
<item name="textEnabled">@color/enabled_button_text_color_dark</item>
|
||||
<item name="mainCardBackground">@color/main_background_dark</item>
|
||||
<item name="mainScreenNearbyPermissionbutton">@style/DarkFlatNearbyPermissionButton</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
|
@ -45,6 +47,8 @@
|
|||
<item name="textDisabled">@color/disabled_button_text_color_light</item>
|
||||
<item name="textEnabled">@color/enabled_button_text_color_light</item>
|
||||
<item name="mainCardBackground">@color/primaryDarkColor</item>
|
||||
<item name="mainScreenNearbyPermissionbutton">@style/LightFlatNearbyPermissionButton</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="DarkSpinnerTheme" parent="DarkAppTheme">
|
||||
|
|
@ -55,6 +59,14 @@
|
|||
<item name="colorControlNormal">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<style name="DarkFlatNearbyPermissionButton" parent="DarkAppTheme">
|
||||
<item name="colorControlHighlight">@color/contributionListDarkBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="LightFlatNearbyPermissionButton" parent="LightAppTheme">
|
||||
<item name="colorControlHighlight">@color/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal" />
|
||||
|
||||
<style name="borderless_dialog">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue