Skip to content

Commit

Permalink
chore: Remove unused/not working main drawer menu items,
Browse files Browse the repository at this point in the history
  • Loading branch information
hasrat-ali committed Apr 3, 2022
1 parent 0e70cf6 commit 7aee8ce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 85 deletions.
4 changes: 0 additions & 4 deletions app/src/main/java/com/besome/sketch/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
y.g();
}
break;

case 505:
if (o != null) o.i();
break;
}
}
}
Expand Down
88 changes: 15 additions & 73 deletions app/src/main/java/com/besome/sketch/MainDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.besome.sketch.help.ProgramInfoActivity;
import com.besome.sketch.help.SystemSettingActivity;
import com.besome.sketch.language.LanguageActivity;
import com.besome.sketch.tools.NewKeyStoreActivity;
import com.sketchware.remod.Resources;

Expand Down Expand Up @@ -86,22 +85,6 @@ public final void h() {
changeLogDialog(a);
}

/**
* Configure the drawer item that's either "Subscribe" or "Purchase List"
*/
public void i() {
if (g.h()) {
DrawerItem eMenu_orders = DrawerItem.eMenu_orders;
eMenu_orders.i = Resources.drawable.cart_filled_48;
eMenu_orders.h = xB.b().a(getContext(), Resources.string.main_drawer_title_purchase_list);
} else {
DrawerItem eMenu_orders = DrawerItem.eMenu_orders;
eMenu_orders.i = Resources.drawable.lock_48;
eMenu_orders.h = xB.b().a(getContext(), Resources.string.main_drawer_title_subscribe);
}
b.c();
}

public final void a(Context context) {
a = context;
f = new EA(context);
Expand Down Expand Up @@ -181,10 +164,6 @@ public final void d() {
programInfoItem.i = Resources.drawable.side_menu_info_icon_over_white;
programInfoItem.h = xB.b().a(getContext(), Resources.string.main_drawer_title_program_information);

DrawerItem languageSettingsItem = DrawerItem.eMenu_language_settings;
languageSettingsItem.i = Resources.drawable.language_48;
languageSettingsItem.h = xB.b().a(getContext(), Resources.string.main_drawer_title_language_settings);

DrawerItem exportUrlsItem = DrawerItem.eMenu_export_urls;
exportUrlsItem.i = Resources.drawable.ic_export_his_white_48dp;
exportUrlsItem.h = "Developer Tools";
Expand Down Expand Up @@ -259,7 +238,7 @@ enum DrawerItem {
eMenu_docs,
eMenu_system_settings,
eMenu_program_info,
eMenu_language_settings,
//eMenu_language_settings,
eMenu_export_urls,
eMenu_create_keystore;

Expand Down Expand Up @@ -300,76 +279,43 @@ public int b(int i) {

public RecyclerView.v b(ViewGroup viewGroup, int i) {
if (i == 0) {
return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(
return new EmptyViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(
Resources.layout.main_drawer_header,
viewGroup,
false
));
}
return new b(LayoutInflater.from(viewGroup.getContext()).inflate(
return new MenuItemHolder(LayoutInflater.from(viewGroup.getContext()).inflate(
Resources.layout.main_drawer_item,
viewGroup,
false
));
}

public void b(RecyclerView.v vh, int i) {
if (vh instanceof ViewHolder) {
ViewHolder viewHolder = (ViewHolder) vh;
if (f.a()) {
viewHolder.u.setVisibility(VISIBLE);
viewHolder.t.setVisibility(VISIBLE);
if (f.g().isEmpty()) {
viewHolder.u.setText(f.e());
} else {
viewHolder.u.setText(f.g());
}
if (f.m()) {
viewHolder.t.setImageResource(Resources.drawable.facebook_50);
} else if (f.n()) {
viewHolder.t.setImageResource(Resources.drawable.google_96);
} else {
viewHolder.t.setVisibility(GONE);
}
} else {
viewHolder.u.setVisibility(GONE);
viewHolder.t.setVisibility(GONE);
}
} else if (vh instanceof b) {
b bVar = (b) vh;
bVar.t.setImageResource(DrawerItem.values()[i > 0 ? i - 1 : i].d());
TextView textView = bVar.u;
DrawerItem[] values = DrawerItem.values();
if (i > 0) {
i--;
public void b(RecyclerView.v viewHolder, int i) {
if (!(viewHolder instanceof EmptyViewHolder)) {
if (viewHolder instanceof MenuItemHolder) {
MenuItemHolder menuItemHolder = (MenuItemHolder) viewHolder;
menuItemHolder.t.setImageResource(DrawerItem.values()[i > 0 ? i - 1 : i].d());
DrawerItem[] values = DrawerItem.values();
if (i > 0) i--;
menuItemHolder.u.setText(values[i].e());
}
textView.setText(values[i].e());
}
}

/* renamed from: com.besome.sketch.MainDrawer$a$a reason: collision with other inner class name */
/* renamed from: C0000a reason: C0000a is a weird name, also no references to it outside
* MainDrawer.java, so it's easy to rename */
class ViewHolder extends RecyclerView.v {

public ImageView t;
public TextView u;
public TextView v;

public ViewHolder(View view) {
class EmptyViewHolder extends RecyclerView.v {
public EmptyViewHolder(View view) {
super(view);
t = view.findViewById(Resources.id.img_user_icon);
u = view.findViewById(Resources.id.tv_login_id);
v = view.findViewById(Resources.id.tv_expire_date);
}
}

class b extends RecyclerView.v {
class MenuItemHolder extends RecyclerView.v {

public ImageView t;
public TextView u;

public b(View view) {
public MenuItemHolder(View view) {
super(view);
u = view.findViewById(Resources.id.tv_menu_name);
t = view.findViewById(Resources.id.img_icon);
Expand All @@ -395,10 +341,6 @@ public void onClick(View v) {
Intent intent = new Intent(activity, ProgramInfoActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
activity.startActivityForResult(intent, 105);
} else if (id == DrawerItem.eMenu_language_settings.ordinal()) {
Intent intent = new Intent(activity, LanguageActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
activity.startActivity(intent);
} else if (id == DrawerItem.eMenu_export_urls.ordinal()) {
Intent intent = new Intent(activity, Tools.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
Expand Down
24 changes: 16 additions & 8 deletions app/src/main/res/layout/main_drawer_header.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@id/layout_main_drawer_header" android:background="#fffafafa" android:layout_width="320.0dip" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:gravity="bottom" android:orientation="vertical" android:background="@drawable/side_menu_bg_puzzle" android:paddingLeft="16.0dip" android:paddingTop="8.0dip" android:paddingRight="16.0dip" android:paddingBottom="8.0dip" android:clickable="true" android:layout_width="fill_parent" android:layout_height="200.0dip" android:paddingStart="16.0dip" android:paddingEnd="16.0dip" android:elevation="8.0dip">
<LinearLayout android:gravity="top" android:orientation="horizontal" android:paddingTop="8.0dip" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_weight="1.0">
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:id="@id/img_user_icon" android:layout_width="24.0dip" android:layout_height="24.0dip" android:src="@drawable/google_96" />
<TextView android:textSize="14.0sp" android:textColor="@color/color_primary" android:gravity="center_vertical" android:layout_gravity="center_vertical" android:id="@id/tv_login_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="8.0dip" />
</LinearLayout>
</LinearLayout>
<TextView android:textSize="12.0sp" android:textColor="#ff576a73" android:gravity="center_vertical" android:id="@id/tv_expire_date" android:paddingLeft="4.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="24.0dip" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="200.0dip"
android:background="@drawable/side_menu_bg_puzzle"
android:clickable="true"
android:elevation="8.0dip"
android:gravity="bottom"
android:orientation="vertical"
android:paddingStart="16.0dip"
android:paddingLeft="16.0dip"
android:paddingTop="8.0dip"
android:paddingEnd="16.0dip"
android:paddingRight="16.0dip"
android:paddingBottom="8.0dip">

</LinearLayout>
</LinearLayout>

0 comments on commit 7aee8ce

Please sign in to comment.