improved profile style

This commit is contained in:
Mariotaku Lee 2017-04-14 22:17:20 +08:00
parent 61f2d7180a
commit 47eaf41e49
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
7 changed files with 130 additions and 40 deletions

View File

@ -1,39 +0,0 @@
package org.mariotaku.twidere.graphic;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
/**
* Created by mariotaku on 16/3/30.
*/
public class WindowBackgroundDrawable extends Drawable {
private final int color;
public WindowBackgroundDrawable(int color) {
this.color = color;
}
@Override
public void draw(@NonNull Canvas canvas) {
canvas.drawColor(color);
}
@Override
public void setAlpha(int alpha) {
// No-op
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
// No-op
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
}

View File

@ -329,7 +329,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
}
internal fun updateAccountActions() {
val activity = activity as HomeActivity
val activity = activity as? HomeActivity ?: return
val tabs = activity.tabs
val account = accountsAdapter.selectedAccount ?: return
var hasDmTab = false

View File

@ -0,0 +1,60 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.graphic
import android.graphics.Canvas
import android.graphics.ColorFilter
import android.graphics.PixelFormat
import android.graphics.drawable.Drawable
/**
* Created by mariotaku on 16/3/30.
*/
class WindowBackgroundDrawable(private val color: Int) : Drawable() {
override fun draw(canvas: Canvas) {
canvas.drawColor(color)
}
override fun setAlpha(alpha: Int) {
// No-op
}
override fun setColorFilter(colorFilter: ColorFilter?) {
// No-op
}
override fun getOpacity(): Int {
return PixelFormat.TRANSLUCENT
}
override fun getConstantState(): Drawable.ConstantState {
return State(color)
}
class State(private val color: Int) : ConstantState() {
override fun newDrawable() = WindowBackgroundDrawable(color)
override fun getChangingConfigurations() = 0
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<fraction name="aspect_ratio_profile_banner">250%p</fraction>
</resources>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<fraction name="aspect_ratio_profile_banner">300%p</fraction>
</resources>

View File

@ -1,4 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<fraction name="aspect_ratio_profile_banner">200%p</fraction>