Skip to content

Commit

Permalink
✨launcher icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ohmae committed Aug 22, 2019
1 parent 47ccf37 commit 3ba3f76
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 78 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_size = 2

[{*.yml,*.yaml}]
indent_size = 2
Binary file added .idea/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .idea/icon_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 38 additions & 35 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,76 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="net.mm2d.guidemo">
xmlns:tools="http://schemas.android.com/tools"
package="net.mm2d.guidemo"
>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".theme.ThemeSelectActivity">
</activity>
<activity android:name=".theme.ThemeCheckCompatActivity">
</activity>
<activity android:name=".theme.ThemeSelectActivity" />
<activity android:name=".theme.ThemeCheckCompatActivity" />
<activity
android:name=".theme.ThemeCheckBaseActivity"
android:theme="@style/AppBaseTheme">
</activity>
<activity android:name=".navi.NavigationSelectActivity">
</activity>
android:theme="@style/AppBaseTheme"
/>
<activity android:name=".navi.NavigationSelectActivity" />
<activity
android:name=".navi.NavigationDrawerV4Activity"
android:theme="@style/AppBaseTheme">
</activity>
<activity android:name=".navi.NavigationDrawerV7Activity">
</activity>
android:theme="@style/AppBaseTheme"
/>
<activity android:name=".navi.NavigationDrawerV7Activity" />
<activity
android:name=".navi.NavigationDrawerMaterialActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".navi.ItemListActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".navi.ItemDetailActivity"
android:parentActivityName=".navi.ItemListActivity"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AppTheme.NoActionBar"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".navi.ItemListActivity"/>
android:value=".navi.ItemListActivity"
/>
</activity>
<activity
android:name=".navi.TabbedActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".navi.ScrollingActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".navi.SettingsActivity"
android:label="@string/title_activity_settings">
</activity>
android:label="@string/title_activity_settings"
/>
<activity
android:name=".navi.NavigationDrawerBlurActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".navi.ViewPagerActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"
/>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -32,6 +38,7 @@
import net.mm2d.guidemo.R;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
Expand All @@ -41,7 +48,7 @@
import androidx.drawerlayout.widget.DrawerLayout.DrawerListener;

public class NavigationDrawerBlurActivity extends AppCompatActivity
implements OnNavigationItemSelectedListener, DrawerListener {
implements OnNavigationItemSelectedListener, DrawerListener {
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mToggle;
private NavigationView mNavigationView;
Expand All @@ -55,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(toolbar);
mDrawerLayout = findViewById(R.id.drawer_layout);
mToggle = new ActionBarDrawerToggle(
this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerLayout.addDrawerListener(mToggle);
mDrawerLayout.setScrimColor(Color.TRANSPARENT);
mToggle.syncState();
Expand Down Expand Up @@ -100,15 +107,15 @@ public long getItemId(int position) {

@Override
public View getView(
int position,
View convertView,
ViewGroup parent) {
int position,
View convertView,
ViewGroup parent) {
final View view;
if (convertView != null) {
view = convertView;
} else {
final ImageView image = new AppCompatImageView(getBaseContext());
image.setImageResource(R.drawable.ic_adb);
image.setImageResource(R.drawable.ic_account);
final GridView.LayoutParams params = new GridView.LayoutParams(size, size);
image.setLayoutParams(params);
image.setPadding(padding, padding, padding, padding);
Expand Down Expand Up @@ -171,8 +178,8 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {

@Override
public void onDrawerSlide(
@NonNull View drawerView,
float slideOffset) {
@NonNull View drawerView,
float slideOffset) {
final int width = mNavigationView.getWidth();
mMenuBackground.setOffset(width * (1.0f - slideOffset));
}
Expand Down Expand Up @@ -212,7 +219,11 @@ void capture() {
mView.setDrawingCacheEnabled(true);
final Bitmap cache = mView.getDrawingCache();
if (cache != null) {
mBitmap = fastBlur(cache, (int) (20 * mDensity), Color.argb(0x90, 0xe0, 0xf8, 0xff));
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
mBitmap = blur(cache, 25, Color.argb(0x90, 0xe0, 0xf8, 0xff));
} else {
mBitmap = fastBlur(cache, 25, Color.argb(0x90, 0xe0, 0xf8, 0xff));
}
}
mView.setDrawingCacheEnabled(false);
}
Expand Down Expand Up @@ -244,6 +255,26 @@ public int getOpacity() {
return PixelFormat.OPAQUE;
}

@RequiresApi(api = VERSION_CODES.JELLY_BEAN_MR1)
private Bitmap blur(
final @NonNull Bitmap sentBitmap,
final int radius,
final int color) {
final Bitmap bitmap = Bitmap.createBitmap(sentBitmap.getWidth(), sentBitmap.getHeight(), sentBitmap.getConfig());
final RenderScript rs = RenderScript.create(mView.getContext());
final ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
final Allocation input = Allocation.createFromBitmap(rs, sentBitmap);
final Allocation output = Allocation.createFromBitmap(rs, bitmap);
blur.setRadius(radius);
blur.setInput(input);
blur.forEach(output);
output.copyTo(bitmap);
rs.destroy();
final Canvas canvas = new Canvas(bitmap);
canvas.drawColor(color);
return bitmap;
}

/**
* Stack Blur v1.0 from
* http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
Expand Down Expand Up @@ -273,9 +304,9 @@ public int getOpacity() {
* Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com>
*/
Bitmap fastBlur(
Bitmap sentBitmap,
int radius,
int color) {
Bitmap sentBitmap,
int radius,
int color) {
final Bitmap bitmap = Bitmap.createBitmap(sentBitmap);
if (radius < 1) {
return (null);
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/res/drawable-anydpi-v21/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48"
>
<path
android:fillColor="#fff"
android:pathData="M24,24m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"
/>
<path
android:fillColor="#76ff03"
android:pathData="M24,24m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
/>
<path
android:fillColor="#ccff90"
android:pathData="M24,24m-14,0a14,14 0,1 1,28 0a14,14 0,1 1,-28 0"
/>
<path
android:fillColor="#fff"
android:pathData="M24,24m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
/>
</vector>
Binary file added app/src/main/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_account.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"
/>
</vector>
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_adb.xml

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_theme_check.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand All @@ -183,7 +183,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_theme_check_app_compat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand All @@ -183,7 +183,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_theme_check_legacy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand All @@ -155,7 +155,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
Expand Down
18 changes: 11 additions & 7 deletions app/src/main/res/layout/nav_header_navigation_drawer_blur.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,34 @@
android:background="@drawable/side_nav_bar_alpha"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
>

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@android:drawable/sym_def_app_icon"/>
android:src="@drawable/ic_launcher"
/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="Android Studio"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
android:text="Example"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
/>

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="android.studio@android.com"/>
android:text="example@example.com"
/>

</LinearLayout>
Loading

0 comments on commit 3ba3f76

Please sign in to comment.