Make tagViews useful

This commit is contained in:
Mr. Dragon
2018-04-28 01:35:43 +05:30
parent d834314bd5
commit fd58c53aab
5 changed files with 80 additions and 45 deletions

View File

@@ -6,21 +6,19 @@ import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.dragons.aurora.CircleTransform;
import com.dragons.aurora.R;
import com.dragons.aurora.activities.AccountsActivity;
import com.dragons.aurora.activities.CategoryAppsActivity;
import com.dragons.aurora.view.AdaptiveToolbar;
import com.dragons.aurora.view.TagView;
import com.squareup.picasso.Picasso;
public class HomeFragment extends UtilFragment {
private View view;
AdaptiveToolbar adtb;
private View view;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
@@ -31,18 +29,16 @@ public class HomeFragment extends UtilFragment {
return view;
}
view = inflater.inflate(R.layout.fragment_home, container, false);
/*RelativeLayout open_community = view.findViewById(R.id.open_community);
open_community.setOnClickListener(v -> {
Uri uri = Uri.parse("https://t.me/AuroraOfficial");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
});*/
adtb = view.findViewById(R.id.adtb);
adtb.getAvatar_icon().setOnClickListener(v -> {
Intent intent = new Intent(getContext(), AccountsActivity.class);
intent.putExtra("account_profile_animate", true);
startActivity(intent);
});
initTags();
return view;
}
@@ -69,8 +65,23 @@ public class HomeFragment extends UtilFragment {
.getDrawable(R.drawable.ic_dummy_avatar));
}
}
protected void resetUser() {
(adtb.getAvatar_icon()).setImageDrawable(getResources()
.getDrawable(R.drawable.ic_user_placeholder));
.getDrawable(R.drawable.ic_user_placeholder));
}
protected void initTags()
{
setupTag(view,R.id.tag_gamesAction,"GAME_ACTION");
setupTag(view,R.id.tag_family,"FAMILY");
setupTag(view,R.id.tag_gamesRacing,"GAME_RACING");
setupTag(view,R.id.tag_travel,"TRAVEL_AND_LOCAL");
setupTag(view,R.id.tag_social,"SOCIAL");
}
protected void setupTag(View v, int viewID, String Category) {
TagView tagView = v.findViewById(viewID);
tagView.setOnClickListener(click -> CategoryAppsActivity.start(v.getContext(), Category));
}
}

View File

@@ -33,7 +33,7 @@ import com.dragons.aurora.RecyclerItemTouchHelper;
import com.dragons.aurora.activities.SearchActivity;
import com.dragons.aurora.adapters.SearchHistoryAdapter;
public class SearchFragment extends Fragment implements RecyclerItemTouchHelper.RecyclerItemTouchHelperListener {
public class SearchFragment extends UtilFragment implements RecyclerItemTouchHelper.RecyclerItemTouchHelperListener {
SearchView searchToolbar;
ArrayList<String> listHistory = new ArrayList<>();

View File

@@ -32,33 +32,65 @@
android:layout_marginTop="2dp"
android:nestedScrollingEnabled="false" />
<LinearLayout
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="12dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
android:nestedScrollingEnabled="false"
android:scrollbars="none">
<com.dragons.aurora.view.TagView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
app:DualTagName0="Games"
app:DualTagName1="Featured"
app:TagStyle="Duo">
android:orientation="horizontal">
</com.dragons.aurora.view.TagView>
<com.dragons.aurora.view.TagView
android:id="@+id/tag_gamesAction"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
app:DualTagName0="Games"
app:DualTagName1="Action"
app:TagStyle="Duo" />
<com.dragons.aurora.view.TagView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
app:MonoTagName="Alpha"
app:TagStyle="Mono">
<com.dragons.aurora.view.TagView
android:id="@+id/tag_family"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
app:MonoTagName="Family"
app:TagStyle="Mono" />
</com.dragons.aurora.view.TagView>
<com.dragons.aurora.view.TagView
android:id="@+id/tag_gamesRacing"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="6dp"
app:DualTagName0="Games"
app:DualTagName1="Racing"
app:TagStyle="Duo" />
<com.dragons.aurora.view.TagView
android:id="@+id/tag_travel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
app:MonoTagName="Travel"
app:TagStyle="Mono" />
<com.dragons.aurora.view.TagView
android:id="@+id/tag_social"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
app:MonoTagName="Social"
app:TagStyle="Mono" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<com.dragons.aurora.view.MoreAppsCard
android:layout_width="match_parent"

View File

@@ -4,9 +4,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/top_category_bg"
android:backgroundTint="?attr/colorAccent"
android:clickable="true"
android:focusable="true"
android:backgroundTint="?android:attr/colorForeground"
android:orientation="horizontal">
<TextView
@@ -16,10 +14,8 @@
android:layout_marginBottom="2dp"
android:layout_marginStart="2dp"
android:layout_marginTop="2dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="@font/google_sans"
android:textColor="?attr/colorAccent" />
android:textColor="?android:attr/textColorPrimary" />
<ImageView
android:id="@+id/divider"
@@ -27,8 +23,8 @@
android:layout_height="match_parent"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:alpha="0.6"
android:background="?attr/colorAccent" />
android:alpha="0.8"
android:background="?android:attr/colorForeground" />
<TextView
android:id="@+id/tag_dual_txt1"
@@ -37,9 +33,7 @@
android:layout_marginBottom="2dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="2dp"
android:clickable="true"
android:focusable="true"
android:fontFamily="@font/google_sans"
android:textColor="?attr/colorAccent" />
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>

View File

@@ -4,15 +4,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/top_category_bg"
android:backgroundTint="?attr/colorAccent">
android:backgroundTint="?android:attr/colorForeground">
<TextView
android:id="@+id/tag_mono_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:clickable="true"
android:fontFamily="@font/google_sans"
android:padding="2dp"
android:textColor="?attr/colorAccent" />
android:textColor="?android:attr/textColorPrimary" />
</RelativeLayout>