Browse Source

Changed to built-in toolbar/hamburger

pull/70/head
Ezerous 4 years ago
parent
commit
dda8d60990
  1. 1
      app/src/main/assets/svg/hamburger.svg
  2. 20
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  3. 5
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 11
      app/src/main/res/drawable-anydpi/ic_hamburger.xml
  5. BIN
      app/src/main/res/drawable-hdpi/ic_hamburger.png
  6. BIN
      app/src/main/res/drawable-mdpi/ic_hamburger.png
  7. BIN
      app/src/main/res/drawable-xhdpi/ic_hamburger.png
  8. BIN
      app/src/main/res/drawable-xxhdpi/ic_hamburger.png
  9. 26
      app/src/main/res/layout/activity_main.xml
  10. 2
      app/src/main/res/values/strings.xml
  11. 2
      app/src/main/res/values/styles.xml

1
app/src/main/assets/svg/hamburger.svg

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>

Before

Width:  |  Height:  |  Size: 200 B

20
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -59,7 +59,6 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
private SectionsPagerAdapter sectionsPagerAdapter;
private ViewPager viewPager;
private TabLayout tabLayout;
private ImageView drawerButton;
//Fix for vector drawables on android <21
static {
@ -87,12 +86,15 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
return; //Avoid executing the code below
}
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("");
setSupportActionBar(toolbar);
//Initialize drawer
createDrawer();
tabLayout = findViewById(R.id.tabs);
viewPager = findViewById(R.id.container);
drawerButton = findViewById(R.id.main_activity_open_drawer_btn);
//Create the adapter that will return a fragment for each section of the activity
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
@ -114,7 +116,6 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
updateTabIcon(i);
setMainActivity(this);
setDrawerButtonListener();
}
@Override
@ -292,17 +293,4 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
}
}
}
private void setDrawerButtonListener()
{
this.drawerButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
drawer.openDrawer();
}
});
}
}

5
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -721,11 +721,10 @@ public abstract class BaseActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int permsRequestCode, @NonNull String[] permissions
, @NonNull int[] grantResults) {
switch (permsRequestCode) {
case DOWNLOAD_REQUEST_CODE:
super.onRequestPermissionsResult(permsRequestCode, permissions, grantResults);
if (permsRequestCode == DOWNLOAD_REQUEST_CODE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
prepareDownload(tempThmmyFile);
break;
}
}

11
app/src/main/res/drawable-anydpi/ic_hamburger.xml

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<path
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"
android:fillColor="#000000"/>
</vector>

BIN
app/src/main/res/drawable-hdpi/ic_hamburger.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

BIN
app/src/main/res/drawable-mdpi/ic_hamburger.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

BIN
app/src/main/res/drawable-xhdpi/ic_hamburger.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 B

BIN
app/src/main/res/drawable-xxhdpi/ic_hamburger.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

26
app/src/main/res/layout/activity_main.xml

@ -17,30 +17,28 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/main_activity_open_drawer_btn"
android:layout_width="35dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_margin="2sp"
android:layout_marginStart="2sp"
android:contentDescription="@string/drawer_button_cnt_desc"
app:srcCompat="@drawable/ic_hamburger" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="@style/ToolbarTheme"/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1.0"
app:tabMaxWidth="0dp"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"
app:tabIconTint="@color/activity_main_tabs_selector" />
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
@ -48,5 +46,5 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

2
app/src/main/res/values/strings.xml

@ -234,6 +234,4 @@
<!--SessionManager-->
<string name="session_shared_prefs">SessionSharedPrefs</string>
<string name="drawer_button_cnt_desc">Button to open the drawer menu</string>
</resources>

2
app/src/main/res/values/styles.xml

@ -57,7 +57,7 @@
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:colorBackground">@color/colorPrimary</item>
<item name="android:colorBackground">@color/primary</item>
<item name="colorControlNormal">@android:color/white</item>
</style>

Loading…
Cancel
Save