Theme work tab cards

This commit is contained in:
Suphon Thanakornpakapong
2021-10-17 22:59:52 +07:00
parent b4b41801ca
commit 608f237d9e
4 changed files with 43 additions and 3 deletions
+12 -1
View File
@@ -16,9 +16,20 @@
** limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<permission
android:name="${packageName}.permission.READ_SETTINGS"
tools:node="remove" />
<permission
android:name="${packageName}.permission.WRITE_SETTINGS"
tools:node="remove" />
<permission
android:name="${packageName}.permission.HOTSEAT_EDU"
tools:node="remove" />
<application>
<meta-data
android:name="preloaded_fonts"
@@ -103,4 +103,7 @@ object DrawableTokens {
list
}
@JvmField val WorkCard = ResourceDrawableToken<GradientDrawable>(R.drawable.work_card)
.setColor(ColorTokens.Surface)
}
@@ -21,11 +21,20 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import app.lawnchair.font.FontManager;
import app.lawnchair.theme.color.ColorTokens;
import app.lawnchair.theme.drawable.DrawableTokens;
/**
* Work profile toggle switch shown at the bottom of AllApps work tab
*/
@@ -67,9 +76,18 @@ public class WorkEduCard extends FrameLayout implements View.OnClickListener,
@Override
protected void onFinishInflate() {
super.onFinishInflate();
findViewById(R.id.action_btn).setOnClickListener(this);
MarginLayoutParams lp = ((MarginLayoutParams) findViewById(R.id.wrapper).getLayoutParams());
Button button = ViewCompat.requireViewById(this, R.id.action_btn);
button.setOnClickListener(this);
button.setAllCaps(false);
FontManager.INSTANCE.get(getContext()).setCustomFont(button, R.id.font_button);
LinearLayout wrapper = ViewCompat.requireViewById(this, R.id.wrapper);
wrapper.setBackground(DrawableTokens.WorkCard.resolve(getContext()));
MarginLayoutParams lp = ((MarginLayoutParams) wrapper.getLayoutParams());
lp.width = mLauncher.getAppsView().getActiveRecyclerView().getTabWidth();
TextView title = ViewCompat.requireViewById(this, R.id.work_apps_paused_title);
title.setTextColor(ColorTokens.TextColorPrimary.resolveColor(getContext()));
}
@Override
@@ -24,11 +24,17 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import app.lawnchair.font.FontManager;
import app.lawnchair.theme.color.ColorTokens;
/**
* Work profile toggle switch shown at the bottom of AllApps work tab
*/
@@ -56,6 +62,8 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener
super.onFinishInflate();
mBtn = findViewById(R.id.enable_work_apps);
mBtn.setOnClickListener(this);
mBtn.setAllCaps(false);
FontManager.INSTANCE.get(getContext()).setCustomFont(mBtn, R.id.font_button);
}
@Override