Dynamic colors - Android 12+ (#1257)

Closes #1222

Need `Android 12L API 32` if want to test on emulator.

Change to Dynamic colors in Settings -> Appearance -> Themes.

Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1257
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
M M Arif 2023-03-10 18:50:15 +00:00
parent a55276dbad
commit fb77e541a0
18 changed files with 305 additions and 59 deletions

View File

@ -54,16 +54,16 @@ configurations {
} }
dependencies { dependencies {
def lifecycle_version = '2.6.0-alpha05' def lifecycle_version = '2.6.0-rc01'
def markwon_version = '4.6.2' def markwon_version = '4.6.2'
def work_version = "2.7.1" def work_version = '2.8.0'
def acra = '5.9.7' def acra = '5.9.7'
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.6.0' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0-alpha01' implementation 'com.google.android.material:material:1.9.0-alpha02'
implementation 'androidx.compose.material3:material3:1.1.0-alpha05' implementation 'androidx.compose.material3:material3:1.1.0-alpha07'
implementation 'androidx.compose.material3:material3-window-size-class:1.1.0-alpha05' implementation 'androidx.compose.material3:material3-window-size-class:1.1.0-alpha07'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01' implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.legacy:legacy-support-v4:1.0.0"
@ -111,7 +111,7 @@ dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
implementation 'androidx.biometric:biometric:1.1.0' implementation 'androidx.biometric:biometric:1.1.0'
implementation 'com.github.chrisvest:stormpot:2.4.2' implementation 'com.github.chrisvest:stormpot:2.4.2'
implementation 'androidx.browser:browser:1.4.0' implementation 'androidx.browser:browser:1.5.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0' implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation('org.codeberg.gitnex:tea4j-autodeploy:3111bc1b18') { implementation('org.codeberg.gitnex:tea4j-autodeploy:3111bc1b18') {
exclude module: 'org.apache.oltu.oauth2.common' exclude module: 'org.apache.oltu.oauth2.common'

View File

@ -16,6 +16,7 @@
android:resizeableActivity="true" android:resizeableActivity="true"
android:roundIcon="@mipmap/app_logo_round" android:roundIcon="@mipmap/app_logo_round"
android:supportsRtl="true" android:supportsRtl="true"
android:exported="true"
tools:targetApi="n"> tools:targetApi="n">
<activity <activity
android:name=".activities.MergePullRequestActivity" android:name=".activities.MergePullRequestActivity"

View File

@ -76,6 +76,9 @@ public abstract class BaseActivity extends AppCompatActivity {
case 7: case 7:
setTheme(R.style.AppThemeSystemPitchBlack); setTheme(R.style.AppThemeSystemPitchBlack);
break; break;
case 8:
setTheme(R.style.AppThemeDynamicSystem);
break;
default: default:
setTheme(R.style.AppThemeSystem); setTheme(R.style.AppThemeSystem);
break; break;

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -724,6 +725,15 @@ public class IssueDetailActivity extends BaseActivity
ctx.getResources() ctx.getResources()
.getColor(R.color.retroThemeColorPrimary, null))); .getColor(R.color.retroThemeColorPrimary, null)));
} }
} else if (tinyDB.getInt("themeId") == 8) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
ImageViewCompat.setImageTintList(
viewBinding.issuePrState,
ColorStateList.valueOf(
ctx.getResources()
.getColor(
android.R.color.system_accent1_300, null)));
}
} else { } else {
ImageViewCompat.setImageTintList( ImageViewCompat.setImageTintList(
viewBinding.issuePrState, viewBinding.issuePrState,
@ -765,6 +775,14 @@ public class IssueDetailActivity extends BaseActivity
ctx.getResources() ctx.getResources()
.getColor(R.color.retroThemeColorPrimary, null))); .getColor(R.color.retroThemeColorPrimary, null)));
} }
} else if (tinyDB.getInt("themeId") == 8) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
ImageViewCompat.setImageTintList(
viewBinding.issuePrState,
ColorStateList.valueOf(
ctx.getResources()
.getColor(android.R.color.system_accent1_300, null)));
}
} else { } else {
ImageViewCompat.setImageTintList( ImageViewCompat.setImageTintList(
viewBinding.issuePrState, viewBinding.issuePrState,

View File

@ -2,6 +2,7 @@ package org.mian.gitnex.activities;
import android.app.Dialog; import android.app.Dialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
@ -47,7 +48,12 @@ public class SettingsAppearanceActivity extends BaseActivity {
LinearLayout darkTimeFrame = activitySettingsAppearanceBinding.darkThemeTimeSelectionFrame; LinearLayout darkTimeFrame = activitySettingsAppearanceBinding.darkThemeTimeSelectionFrame;
customFontList = getResources().getStringArray(R.array.fonts); customFontList = getResources().getStringArray(R.array.fonts);
themeList = getResources().getStringArray(R.array.themes);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || "S".equals(Build.VERSION.CODENAME)) {
themeList = getResources().getStringArray(R.array.themesAndroid12);
} else {
themeList = getResources().getStringArray(R.array.themes);
}
initCloseListener(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);

View File

@ -1,5 +1,7 @@
package org.mian.gitnex.adapters; package org.mian.gitnex.adapters;
import static org.mian.gitnex.helpers.AppUtil.isNightModeThemeDynamic;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
@ -550,6 +552,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
text.indexOf('|'), text.indexOf('|'),
text.indexOf('|') + 1, text.indexOf('|') + 1,
Spannable.SPAN_INCLUSIVE_EXCLUSIVE); Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
if (!isNightModeThemeDynamic(context)) {
textView.setTextColor(
AppUtil.dynamicColorResource(context));
}
textView.setText(spannableString); textView.setText(spannableString);
timelineData.addView(textView); timelineData.addView(textView);
}, },
@ -572,11 +578,9 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
String commitText = String commitText = context.getResources().getString(R.string.commitsText);
context.getResources().getString(R.string.commitsText);
if (Objects.requireNonNull(commitsShaArray).length() == 1) { if (Objects.requireNonNull(commitsShaArray).length() == 1) {
commitText = commitText = context.getResources().getString(R.string.commitText);
context.getResources().getString(R.string.commitText);
} }
String commitString = String commitString =
@ -585,6 +589,9 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
issueComment.getUser().getLogin(), issueComment.getUser().getLogin(),
commitText, commitText,
info); info);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
start.setText(HtmlCompat.fromHtml(commitString, HtmlCompat.FROM_HTML_MODE_LEGACY)); start.setText(HtmlCompat.fromHtml(commitString, HtmlCompat.FROM_HTML_MODE_LEGACY));
start.setTextSize(fontSize); start.setTextSize(fontSize);
@ -643,6 +650,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.isRemovedAssignee()) { if (issueComment.isRemovedAssignee()) {
if (issueComment if (issueComment
@ -694,6 +705,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getMilestone() != null) { if (issueComment.getMilestone() != null) {
start.setText( start.setText(
context.getString( context.getString(
@ -732,6 +747,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issue.getIssueType().equalsIgnoreCase("Issue")) { if (issue.getIssueType().equalsIgnoreCase("Issue")) {
if (issueComment.getType().equals("close")) { if (issueComment.getType().equals("close")) {
start.setText( start.setText(
@ -850,6 +869,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getType().equalsIgnoreCase("review")) { if (issueComment.getType().equalsIgnoreCase("review")) {
timelineView.setVisibility(View.GONE); timelineView.setVisibility(View.GONE);
timelineDividerView.setVisibility(View.GONE); timelineDividerView.setVisibility(View.GONE);
@ -874,6 +897,11 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
else if (issueComment.getType().equalsIgnoreCase("change_title")) { else if (issueComment.getType().equalsIgnoreCase("change_title")) {
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
start.setText( start.setText(
context.getString( context.getString(
R.string.timelineChangeTitle, R.string.timelineChangeTitle,
@ -893,6 +921,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getType().equalsIgnoreCase("lock")) { if (issueComment.getType().equalsIgnoreCase("lock")) {
start.setText( start.setText(
context.getString( context.getString(
@ -921,6 +953,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getType().equalsIgnoreCase("add_dependency")) { if (issueComment.getType().equalsIgnoreCase("add_dependency")) {
start.setText( start.setText(
context.getString( context.getString(
@ -950,6 +986,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getProjectId() > 0) { if (issueComment.getProjectId() > 0) {
start.setText( start.setText(
context.getString( context.getString(
@ -978,6 +1018,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
// TODO pretty-print // TODO pretty-print
if (issueComment.getType().equalsIgnoreCase("added_deadline")) { if (issueComment.getType().equalsIgnoreCase("added_deadline")) {
start.setText( start.setText(
@ -1016,6 +1060,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getType().equalsIgnoreCase("change_target_branch")) { if (issueComment.getType().equalsIgnoreCase("change_target_branch")) {
start.setText( start.setText(
context.getString( context.getString(
@ -1049,6 +1097,10 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView start = new TextView(context); TextView start = new TextView(context);
if (!isNightModeThemeDynamic(context)) {
start.setTextColor(AppUtil.dynamicColorResource(context));
}
if (issueComment.getType().equalsIgnoreCase("start_tracking")) { if (issueComment.getType().equalsIgnoreCase("start_tracking")) {
start.setText( start.setText(
context.getString( context.getString(

View File

@ -2,6 +2,7 @@ package org.mian.gitnex.core;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import com.google.android.material.color.DynamicColors;
import org.acra.ACRA; import org.acra.ACRA;
import org.acra.BuildConfig; import org.acra.BuildConfig;
import org.acra.ReportField; import org.acra.ReportField;
@ -41,6 +42,7 @@ public class MainApplication extends Application {
FontsOverride.setDefaultFont(getBaseContext()); FontsOverride.setDefaultFont(getBaseContext());
Notifications.createChannels(appCtx); Notifications.createChannels(appCtx);
DynamicColors.applyToActivitiesIfAvailable(this);
} }
@Override @Override

View File

@ -663,4 +663,26 @@ public class AppUtil {
void onProgressChanged(short progress); void onProgressChanged(short progress);
} }
public static boolean isNightModeThemeDynamic(Context context) {
TinyDB tinyDB = TinyDB.getInstance(context);
int nightModeFlags =
context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (tinyDB.getInt("themeId") == 8) {
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
} else {
return nightModeFlags == Configuration.UI_MODE_NIGHT_NO;
}
}
public static int dynamicColorResource(Context context) {
int resource = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
resource = context.getResources().getColor(android.R.color.system_accent1_900, null);
}
return resource;
}
} }

View File

@ -1,5 +1,7 @@
package org.mian.gitnex.helpers; package org.mian.gitnex.helpers;
import static org.mian.gitnex.helpers.AppUtil.isNightModeThemeDynamic;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
@ -366,6 +368,10 @@ public class Markdown {
tf = AppUtil.getTypeface(context); tf = AppUtil.getTypeface(context);
} }
textView.setTypeface(tf); textView.setTypeface(tf);
if (!isNightModeThemeDynamic(context)) {
textView.setTextColor(
AppUtil.dynamicColorResource(context));
}
super.beforeSetText(textView, markdown); super.beforeSetText(textView, markdown);
} }

View File

@ -48,6 +48,8 @@
android:id="@+id/nav_view" android:id="@+id/nav_view"
app:headerLayout="@layout/nav_header" app:headerLayout="@layout/nav_header"
android:background="?attr/primaryBackgroundColor" android:background="?attr/primaryBackgroundColor"
app:itemIconTint="?attr/primaryTextColor"
app:itemTextColor="?attr/primaryTextColor"
app:menu="@menu/drawer_menu"/> app:menu="@menu/drawer_menu"/>
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@ -261,7 +261,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/label_title_frame" android:layout_below="@+id/label_title_frame"
android:layout_marginStart="@dimen/dimen24dp" android:layout_marginStart="@dimen/dimen24dp"
android:layout_marginEnd="@dimen/dimen72dp" android:layout_marginEnd="@dimen/dimen84dp"
android:text="@string/settingsLabelsInListHint" android:text="@string/settingsLabelsInListHint"
android:textColor="?attr/hintColor" android:textColor="?attr/hintColor"
android:textSize="@dimen/dimen12sp" /> android:textSize="@dimen/dimen12sp" />

View File

@ -17,7 +17,7 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="12dp" android:layout_marginTop="@dimen/dimen12dp"
android:orientation="vertical" android:orientation="vertical"
tools:ignore="UselessParent"> tools:ignore="UselessParent">
@ -35,7 +35,7 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:contentDescription="@string/appName" android:contentDescription="@string/appName"
android:src="@mipmap/app_logo"/> android:src="@mipmap/app_logo" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
@ -49,29 +49,43 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp" android:layout_marginTop="@dimen/dimen6dp"
android:text="@string/appName" android:text="@string/appName"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="24sp" android:textSize="@dimen/dimen24sp"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <com.google.android.material.card.MaterialCardView
android:id="@+id/appVersionBuild" style="?attr/materialCardViewFilledStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp" android:layout_marginTop="@dimen/dimen6dp"
android:text="@string/appVersionBuild" app:cardBackgroundColor="@color/colorWhite"
android:textColor="?attr/primaryTextColor" app:cardCornerRadius="@dimen/dimen36dp">
android:textIsSelectable="true"
android:textSize="14sp"/> <TextView
android:id="@+id/appVersionBuild"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/appVersionBuild"
android:textColor="@color/iconPrMergedColor"
android:textIsSelectable="true"
android:paddingTop="@dimen/dimen8dp"
android:paddingBottom="@dimen/dimen8dp"
android:paddingStart="@dimen/dimen10dp"
android:paddingEnd="@dimen/dimen10dp"
android:textSize="@dimen/dimen14sp" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="15dp" android:layout_marginTop="@dimen/dimen16dp"
android:orientation="vertical"> android:orientation="vertical">
<!-- user server version --> <!-- user server version -->
@ -79,23 +93,23 @@
android:id="@+id/userServerVersionHeader" android:id="@+id/userServerVersionHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_marginTop="@dimen/dimen24dp"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/commitPage" android:text="@string/commitPage"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" android:textSize="@dimen/dimen16sp"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/userServerVersion" android:id="@+id/userServerVersion"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp"/> android:textSize="@dimen/dimen14sp" />
<!-- user server version --> <!-- user server version -->
<!-- support --> <!-- support -->
@ -103,37 +117,37 @@
android:id="@+id/supportHeader" android:id="@+id/supportHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_marginTop="@dimen/dimen24dp"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/supportText" android:text="@string/supportText"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" android:textSize="@dimen/dimen16sp"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/donationLinkPatreon" android:id="@+id/donationLinkPatreon"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/supportTextPatreon" android:text="@string/supportTextPatreon"
android:textColor="@color/lightBlue" android:textColor="@color/lightBlue"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textSize="14sp"/> android:textSize="@dimen/dimen14sp" />
<TextView <TextView
android:id="@+id/donationLinkBuyMeaCoffee" android:id="@+id/donationLinkBuyMeaCoffee"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/supportTextBuyMeaCoffee" android:text="@string/supportTextBuyMeaCoffee"
android:textColor="@color/lightBlue" android:textColor="@color/lightBlue"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textSize="14sp"/> android:textSize="@dimen/dimen14sp" />
<!-- support --> <!-- support -->
<!-- translate --> <!-- translate -->
@ -141,13 +155,13 @@
android:id="@+id/translateHeader" android:id="@+id/translateHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_marginTop="@dimen/dimen24dp"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/translateText" android:text="@string/translateText"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" android:textSize="@dimen/dimen16sp"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/translateLink" android:id="@+id/translateLink"
@ -155,13 +169,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:gravity="start" android:gravity="start"
android:paddingStart="28dp" android:paddingStart="@dimen/dimen28dp"
android:paddingEnd="28dp" android:paddingEnd="@dimen/dimen28dp"
android:text="@string/translateWithCrowdin" android:text="@string/translateWithCrowdin"
android:textColor="@color/lightBlue" android:textColor="@color/lightBlue"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textSize="14sp" android:textSize="@dimen/dimen14sp"
android:visibility="visible"/> android:visibility="visible" />
<!-- translate --> <!-- translate -->
</LinearLayout> </LinearLayout>
@ -174,8 +188,8 @@
android:layout_margin="@dimen/dimen24dp" android:layout_margin="@dimen/dimen24dp"
android:text="@string/websiteText" android:text="@string/websiteText"
android:textColor="@color/btnTextColor" android:textColor="@color/btnTextColor"
android:textSize="16sp" android:textSize="@dimen/dimen16sp"
android:textStyle="bold"/> android:textStyle="bold" />
</LinearLayout> </LinearLayout>

View File

@ -64,7 +64,7 @@
android:paddingBottom="@dimen/dimen10dp" android:paddingBottom="@dimen/dimen10dp"
android:paddingStart="@dimen/dimen0dp" android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen0dp" android:paddingEnd="@dimen/dimen0dp"
android:textColor="@color/lightGray"/> android:textColor="?attr/hintColor"/>
<ImageView <ImageView
android:id="@+id/repoMetaDataExpandCollapse" android:id="@+id/repoMetaDataExpandCollapse"
@ -456,7 +456,7 @@
android:paddingEnd="@dimen/dimen0dp" android:paddingEnd="@dimen/dimen0dp"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textColor="@color/lightGray"/> android:textColor="?attr/hintColor"/>
<ImageView <ImageView
android:id="@+id/repoFilenameExpandCollapse" android:id="@+id/repoFilenameExpandCollapse"

View File

@ -1,7 +1,7 @@
<resources> <resources>
<style name="AppThemeSystem" parent="AppTheme"/> <style name="AppThemeSystem" parent="AppTheme"/>
<style name="AppThemeSystemPitchBlack" parent="AppThemePitchBlack"/> <style name="AppThemeSystemPitchBlack" parent="AppThemePitchBlack"/>
<style name="AppThemeDynamicSystem" parent="AppThemeDarkDynamicColors"/>
</resources> </resources>

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppThemeDarkDynamicColors" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:statusBarColor">@android:color/system_neutral1_900</item>
<item name="android:typeface">monospace</item>
<item name="colorAccent">@android:color/system_neutral1_800</item>
<item name="android:textColorSecondary">@android:color/system_accent1_0</item>
<item name="android:textColorPrimary">@android:color/system_accent1_0</item>
<item name="colorPrimary">@android:color/system_accent1_300</item>
<item name="colorSecondary">@android:color/system_accent1_0</item>
<item name="colorOnSurfaceVariant">@android:color/system_accent1_0</item>
<item name="colorSecondaryContainer">@android:color/system_neutral1_800</item>
<item name="materialCardBackgroundColor">@android:color/system_neutral1_800</item>
<item name="diffAddedColor">@color/diffAddedColor</item>
<item name="diffRemovedColor">@color/diffRemovedColor</item>
<item name="diffSelectedColor">@color/diffSelectedColor</item>
<item name="primaryTextColor">@android:color/system_accent1_0</item>
<item name="primaryBackgroundColor">@android:color/system_neutral1_900</item>
<item name="inputBackgroundColor">@android:color/system_neutral1_800</item>
<item name="inputSelectedColor">@android:color/system_accent1_300</item>
<item name="inputTextColor">@android:color/system_accent1_0</item>
<item name="checkboxStyle">@style/AppThemeCheckBoxStyle</item>
<item name="selectedTextColor">@android:color/system_accent1_300</item>
<item name="alertDialogTheme">@style/AppThemeConfirmDialog</item>
<item name="popupMenuStyle">@style/AppThemePopupMenuStyle</item>
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
<item name="autoCompleteTextViewStyle">@style/AppThemeDarkSearchAutoCompleteTextView</item>
<item name="hintColor">@android:color/system_accent1_10</item>
<item name="colorControlActivated">@android:color/system_accent1_300</item>
<item name="dividerColor">@android:color/system_accent2_600</item>
<item name="bottomSheetDialogTheme">@style/AppThemeDarkBottomSheetDialog</item>
<item name="searchViewStyle">@style/AppSearchViewStyle</item>
<item name="progressIndicatorColor">@android:color/system_accent1_300</item>
<item name="fabColor">@android:color/system_accent1_300</item>
<item name="iconsColor">@android:color/system_accent1_300</item>
<item name="pagerTabIndicatorColor">@android:color/system_accent1_300</item>
<item name="android:actionOverflowButtonStyle">@style/customOverflowButtonStyle</item>
<item name="actionOverflowMenuStyle">@style/customOverflowMenuStyle</item>
<item name="colorSurface">@android:color/system_neutral1_800</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="materialSwitchStyle">@style/materialSwitchStyle</item>
<item name="isDark">1</item>
</style>
<style name="AppThemeLightDynamicColors" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:statusBarColor">@android:color/system_neutral1_10</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:typeface">monospace</item>
<item name="materialCardBackgroundColor">@android:color/system_accent2_50</item>
<item name="colorOnSurfaceVariant">@android:color/system_accent2_900</item>
<item name="colorSecondaryContainer">@android:color/system_accent1_200</item>
<item name="colorPrimary">@android:color/system_accent1_300</item>
<item name="colorAccent">@android:color/system_neutral1_800</item>
<item name="android:textColorSecondary">@android:color/system_neutral1_800</item>
<item name="android:textColorPrimary">@android:color/system_neutral1_800</item>
<item name="colorSecondary">@android:color/system_accent1_200</item>
<item name="colorOnSurface">@android:color/system_accent2_900</item>
<item name="diffAddedColor">@color/diffAddedColor</item>
<item name="diffRemovedColor">@color/diffRemovedColor</item>
<item name="diffSelectedColor">@color/diffSelectedColor</item>
<item name="primaryTextColor">@android:color/system_accent2_900</item>
<item name="primaryBackgroundColor">@android:color/system_neutral1_10</item>
<item name="hintColor">@android:color/system_accent1_800</item>
<item name="dividerColor">@android:color/system_accent2_600</item>
<item name="colorSurface">@android:color/system_neutral1_10</item>
<item name="checkboxStyle">@style/AppThemeLightCheckBoxStyle</item>
<item name="alertDialogTheme">@style/AppThemeLightConfirmDialog</item>
<item name="popupMenuStyle">@style/AppThemeLightPopupMenuStyle</item>
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
<item name="autoCompleteTextViewStyle">@style/AppThemeLightSearchAutoCompleteTextView</item>
<item name="bottomSheetDialogTheme">@style/AppThemeLightBottomSheetDialog</item>
<item name="searchViewStyle">@style/AppSearchViewStyle</item>
<item name="android:actionOverflowButtonStyle">@style/customOverflowButtonStyle</item>
<item name="actionOverflowMenuStyle">@style/customOverflowMenuStyle</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="progressIndicatorColor">@android:color/system_accent1_300</item>
<item name="fabColor">@android:color/system_accent1_300</item>
<item name="iconsColor">@android:color/system_accent1_300</item>
<item name="pagerTabIndicatorColor">@android:color/system_accent1_300</item>
<item name="selectedTextColor">@android:color/system_accent1_300</item>
<item name="colorControlActivated">@android:color/system_accent1_300</item>
<item name="inputBackgroundColor">@android:color/system_neutral1_50</item>
<item name="inputSelectedColor">@android:color/system_accent1_300</item>
<item name="inputTextColor">@android:color/system_accent2_900</item>
<item name="materialSwitchStyle">@style/materialSwitchStyle</item>
<item name="isDark">0</item>
</style>
<style name="AppThemeLightCheckBoxStyle" parent="Widget.Material3.CompoundButton.CheckBox">
<item name="buttonTint">@android:color/system_accent1_300</item>
</style>
<style name="materialSwitchStyle" parent="Widget.Material3.CompoundButton.MaterialSwitch">
<item name="thumbTint">@android:color/system_accent1_0</item>
</style>
</resources>

View File

@ -39,6 +39,18 @@
<item>@string/followSystemBlack</item> <item>@string/followSystemBlack</item>
</string-array> </string-array>
<string-array name="themesAndroid12">
<item>Dark</item>
<item>Light</item>
<item>Auto (Light/Dark)</item>
<item>Retro</item>
<item>Auto (Retro/Dark)</item>
<item>Pitch Black</item>
<item>@string/followSystem</item>
<item>@string/followSystemBlack</item>
<item>@string/dynamicColorsFollowSystem</item>
</string-array>
<string-array name="appDefaultHomeScreen"> <string-array name="appDefaultHomeScreen">
<item>@string/navMyRepos</item> <item>@string/navMyRepos</item>
<item>@string/pageTitleStarredRepos</item> <item>@string/pageTitleStarredRepos</item>

View File

@ -766,6 +766,7 @@
<string name="notLoggedIn">%s \u25CF not logged in</string> <string name="notLoggedIn">%s \u25CF not logged in</string>
<string name="followSystem">Follow system (Light/Dark)</string> <string name="followSystem">Follow system (Light/Dark)</string>
<string name="followSystemBlack">Follow system (Light/Pitch Black)</string> <string name="followSystemBlack">Follow system (Light/Pitch Black)</string>
<string name="dynamicColorsFollowSystem">Dynamic colors - Follow system (Light/Dark)</string>
<string name="repoForkOf">Fork of: %s</string> <string name="repoForkOf">Fork of: %s</string>
<string name="adoptRepo">Adopt</string> <string name="adoptRepo">Adopt</string>
<string name="repoAdopted">Adopted repository %s</string> <string name="repoAdopted">Adopted repository %s</string>

View File

@ -42,6 +42,7 @@
<item name="colorSurface">@color/inputBackground</item> <item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="materialSwitchStyle">@style/m3SwitchStyle</item>
<item name="isDark">1</item> <item name="isDark">1</item>
</style> </style>
<!-- Dark theme - default --> <!-- Dark theme - default -->
@ -176,10 +177,15 @@
<item name="colorSurface">@color/inputBackground</item> <item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="materialSwitchStyle">@style/m3SwitchStyle</item>
<item name="isDark">1</item> <item name="isDark">1</item>
</style> </style>
<!-- Pitch black theme --> <!-- Pitch black theme -->
<style name="m3SwitchStyle" parent="Widget.Material3.CompoundButton.MaterialSwitch">
<item name="thumbTint">@color/colorWhite</item>
</style>
<!-- Custom Material cards --> <!-- Custom Material cards -->
<style name="CustomMaterCardViewStyle" parent="@style/Widget.MaterialComponents.CardView"> <style name="CustomMaterCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.card.custom.corners</item> <item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.card.custom.corners</item>
@ -387,4 +393,5 @@
<style name="AppThemeSystemPitchBlack" parent="AppThemeLight"/> <style name="AppThemeSystemPitchBlack" parent="AppThemeLight"/>
<style name="AppThemeDynamicSystem" parent="AppThemeLightDynamicColors"/>
</resources> </resources>