Skip to content

Commit

Permalink
Merge pull request #83 from HiddenRamblings/polish_amiibo_image_view
Browse files Browse the repository at this point in the history
Fix Edit Tag Data and optimise amiibo views
  • Loading branch information
North101 authored Aug 28, 2017
2 parents 55c49d1 + b18618f commit 8449480
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 180 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@EActivity(R.layout.activity_editor_tp)
@OptionsMenu({R.menu.editor_menu})
public class EditorTP extends AppCompatActivity {
public static final int WOLF_LINK_ID = 0x01030000;
public static final long WOLF_LINK_ID = 0x01030000024F0902L;

private static final String TAG = "EditorTP";

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/hiddenramblings/tagmo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,16 @@ public void onDismissed(Snackbar snackbar, int event) {

int ssbVisibility = View.GONE;
int tpVisibility = View.GONE;
try {
long amiiboId = TagUtil.amiiboIdFromTag(currentTagData);
if (amiiboId == EditorTP.WOLF_LINK_ID) {
tpVisibility = View.VISIBLE;
} else {
ssbVisibility = View.VISIBLE;
}
} catch (Exception e) {
e.printStackTrace();
}

AmiiboView fragment = (AmiiboView) getSupportFragmentManager().findFragmentById(R.id.amiiboInfoView);
if (fragment != null) {
Expand Down
84 changes: 37 additions & 47 deletions app/src/main/res/layout/amiibo_compact_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,30 @@
android:foreground="@drawable/card_foreground"
app:cardCornerRadius="@dimen/card_radius">

<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp">
android:orientation="horizontal"
android:padding="8dp">

<ImageView
android:id="@+id/imageAmiibo"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:visibility="gone"/>

<RelativeLayout
android:id="@+id/group0"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp">

<ImageView
android:id="@+id/imageAmiibo"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:visibility="gone"/>
android:layout_gravity="center_vertical"
android:layout_weight="1">

<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/imageAmiibo"
android:text="NAME"
android:textColor="@color/tag_text"
android:textSize="16dp"/>
Expand All @@ -49,9 +44,7 @@
android:id="@+id/group1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@id/txtName"
android:layout_toRightOf="@id/imageAmiibo">
android:layout_below="@+id/txtName">

<View
android:id="@+id/divider1"
Expand Down Expand Up @@ -86,9 +79,7 @@
android:id="@+id/group2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@id/group1"
android:layout_toRightOf="@id/imageAmiibo">
android:layout_below="@+id/group1">

<View
android:id="@+id/divider2"
Expand Down Expand Up @@ -121,30 +112,29 @@
android:id="@+id/txtTagInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignBottom="@id/group2"
android:layout_alignTop="@id/txtName"
android:gravity="center"
android:text=""/>
</RelativeLayout>

<TextView
android:id="@+id/txtPath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/group0"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="PATH"
android:textSize="10dp"
android:visibility="gone"/>
<TextView
android:id="@+id/txtPath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/group2"
android:text="PATH"
android:textSize="10dp"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>

<TextView
android:id="@+id/txtCharacter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="CHARACTER"
android:textColor="@color/tag_text"
android:textSize="10dp"
android:visibility="gone"/>
</RelativeLayout>
<TextView
android:id="@+id/txtCharacter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="CHARACTER"
android:textColor="@color/tag_text"
android:textSize="10dp"
android:visibility="gone"/>
</android.support.v7.widget.CardView>
77 changes: 34 additions & 43 deletions app/src/main/res/layout/amiibo_large_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,27 @@
android:foreground="@drawable/card_foreground"
app:cardCornerRadius="@dimen/card_radius">

<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp">
android:orientation="vertical"
android:padding="8dp">

<RelativeLayout
android:id="@+id/group0"
<ImageView
android:id="@+id/imageAmiibo"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="150dp"
android:visibility="gone"/>

<ImageView
android:id="@+id/imageAmiibo"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:visibility="gone"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imageAmiibo"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:text="NAME"
android:textColor="@color/tag_text"
android:textSize="16dp"/>
Expand All @@ -45,9 +41,7 @@
android:id="@+id/group1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtName"
android:paddingLeft="8dp"
android:paddingRight="8dp">
android:layout_below="@+id/txtName">

<View
android:id="@+id/divider1"
Expand Down Expand Up @@ -82,9 +76,7 @@
android:id="@+id/group2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/group1"
android:paddingLeft="8dp"
android:paddingRight="8dp">
android:layout_below="@+id/group1">

<View
android:id="@+id/divider2"
Expand Down Expand Up @@ -117,30 +109,29 @@
android:id="@+id/txtTagInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignBottom="@id/group2"
android:layout_alignTop="@id/txtName"
android:gravity="center"
android:text=""/>
</RelativeLayout>

<TextView
android:id="@+id/txtPath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/group0"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="PATH"
android:textSize="10dp"
android:visibility="gone"/>
<TextView
android:id="@+id/txtPath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/group2"
android:text="PATH"
android:textSize="10dp"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>

<TextView
android:id="@+id/txtCharacter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="CHARACTER"
android:textColor="@color/tag_text"
android:textSize="10dp"
android:visibility="gone"/>
</RelativeLayout>
<TextView
android:id="@+id/txtCharacter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="CHARACTER"
android:textColor="@color/tag_text"
android:textSize="10dp"
android:visibility="gone"/>
</android.support.v7.widget.CardView>
Loading

0 comments on commit 8449480

Please sign in to comment.