diff --git a/app/build.gradle b/app/build.gradle index 9d5b2cf7..9fd43c7f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,15 +1,15 @@ plugins { - id "com.diffplug.spotless" version "7.0.3" + id "com.diffplug.spotless" version "7.0.4" } apply plugin: 'com.android.application' android { defaultConfig { applicationId "org.mian.gitnex" - minSdkVersion 23 - targetSdkVersion 35 - versionCode 900 - versionName "9.0.0" + minSdkVersion 26 + targetSdkVersion 36 + versionCode 995 + versionName "10.0.0-dev" multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" compileSdk 35 @@ -67,19 +67,19 @@ dependencies { implementation 'androidx.viewpager2:viewpager2:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:2.2.1' implementation "androidx.legacy:legacy-support-v4:1.0.0" - implementation "androidx.navigation:navigation-fragment:2.9.0" - implementation "androidx.navigation:navigation-ui:2.9.0" + implementation "androidx.navigation:navigation-fragment:2.9.1" + implementation "androidx.navigation:navigation-ui:2.9.1" implementation "androidx.lifecycle:lifecycle-viewmodel:2.9.1" testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' - implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.14' - implementation 'com.google.code.gson:gson:2.11.0' + implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.17' + implementation 'com.google.code.gson:gson:2.13.1' implementation 'com.github.ramseth001:TextDrawable:1.1.3' - implementation 'com.squareup.retrofit2:retrofit:2.11.0' - implementation 'com.squareup.retrofit2:converter-gson:2.11.0' - implementation 'com.squareup.retrofit2:converter-scalars:2.11.0' - implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.14' + implementation 'com.squareup.retrofit2:retrofit:3.0.0' + implementation 'com.squareup.retrofit2:converter-gson:3.0.0' + implementation 'com.squareup.retrofit2:converter-scalars:3.0.0' + implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.17' implementation 'org.ocpsoft.prettytime:prettytime:5.0.7.Final' implementation "com.github.skydoves:colorpickerview:2.3.0" implementation "io.noties.markwon:core:4.6.2" @@ -100,14 +100,14 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0' implementation "com.caverock:androidsvg-aar:1.4" implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.29" - implementation 'com.google.guava:guava:33.3.1-jre' + implementation 'com.google.guava:guava:33.4.8-jre' //noinspection GradleDependency implementation 'commons-io:commons-io:2.5' - implementation 'org.apache.commons:commons-lang3:3.13.0' + implementation 'org.apache.commons:commons-lang3:3.18.0' implementation "com.github.chrisbanes:PhotoView:2.3.0" - implementation 'ch.acra:acra-mail:5.11.3' - implementation 'ch.acra:acra-limiter:5.11.3' - implementation 'ch.acra:acra-notification:5.11.3' + implementation 'ch.acra:acra-mail:5.12.0' + implementation 'ch.acra:acra-limiter:5.12.0' + implementation 'ch.acra:acra-notification:5.12.0' implementation 'androidx.room:room-runtime:2.7.2' annotationProcessor 'androidx.room:room-compiler:2.7.2' implementation "androidx.work:work-runtime:2.10.2" @@ -116,7 +116,8 @@ dependencies { //noinspection GradleDependency coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5" implementation 'androidx.biometric:biometric:1.1.0' - implementation 'com.github.chrisvest:stormpot:2.4.2' + //noinspection GradleDependency + implementation 'com.github.chrisvest:stormpot:3.2' implementation 'androidx.browser:browser:1.8.0' implementation 'com.google.android.flexbox:flexbox:3.0.0' implementation('org.codeberg.gitnex:tea4j-autodeploy:0ad7eaf429') { diff --git a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java index f9a36a67..59f6c5e0 100644 --- a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java @@ -1302,7 +1302,7 @@ public class IssueDetailActivity extends BaseActivity } } - final Locale locale = getResources().getConfiguration().locale; + Locale locale = getResources().getConfiguration().getLocales().get(0); issueCreator = issue.getIssue().getUser().getLogin(); Glide.with(ctx) @@ -1319,12 +1319,16 @@ public class IssueDetailActivity extends BaseActivity + appCtx.getResources().getString(R.string.hash) + issue.getIssue().getNumber() + ""; - viewBinding.issueTitle.setText( + Markdown.render( + ctx, HtmlCompat.fromHtml( - issueNumber_ - + " " - + EmojiParser.parseToUnicode(issue.getIssue().getTitle()), - HtmlCompat.FROM_HTML_MODE_LEGACY)); + issueNumber_ + + " " + + EmojiParser.parseToUnicode(issue.getIssue().getTitle()), + HtmlCompat.FROM_HTML_MODE_LEGACY) + .toString(), + viewBinding.issueTitle); + String cleanIssueDescription = issue.getIssue().getBody().trim(); if (!AppUtil.checkGhostUsers(issue.getIssue().getUser().getLogin())) { @@ -1484,7 +1488,7 @@ public class IssueDetailActivity extends BaseActivity String edited; - if (!issue.getIssue().getUpdatedAt().equals(issue.getIssue().getUpdatedAt())) { + if (!issue.getIssue().getCreatedAt().equals(issue.getIssue().getUpdatedAt())) { edited = getString(R.string.colorfulBulletSpan) + getString(R.string.modifiedText); viewBinding.issueModified.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java index 0a57cf87..1ee1b721 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java @@ -36,6 +36,7 @@ import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.ClickListener; import org.mian.gitnex.helpers.ColorInverter; import org.mian.gitnex.helpers.LabelWidthCalculator; +import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.IssueContext; @@ -175,7 +176,7 @@ public class IssuesAdapter extends RecyclerView.Adapter @SuppressLint("SetTextI18n") void bindData(Issue issue) { - Locale locale = context.getResources().getConfiguration().locale; + Locale locale = context.getResources().getConfiguration().getLocales().get(0); Glide.with(context) .load(issue.getUser().getAvatarUrl()) @@ -192,10 +193,15 @@ public class IssuesAdapter extends RecyclerView.Adapter + context.getResources().getString(R.string.hash) + issue.getNumber() + ""; - issueTitle.setText( + Markdown.render( + context, HtmlCompat.fromHtml( - issueNumber_ + " " + EmojiParser.parseToUnicode(issue.getTitle()), - HtmlCompat.FROM_HTML_MODE_LEGACY)); + issueNumber_ + + " " + + EmojiParser.parseToUnicode(issue.getTitle()), + HtmlCompat.FROM_HTML_MODE_LEGACY) + .toString(), + issueTitle); this.issueObject = issue; this.issueCommentsCount.setText(String.valueOf(issue.getComments())); diff --git a/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java index b7fb52df..60330141 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java @@ -37,6 +37,7 @@ import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.ClickListener; import org.mian.gitnex.helpers.ColorInverter; import org.mian.gitnex.helpers.LabelWidthCalculator; +import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.contexts.IssueContext; @@ -181,7 +182,7 @@ public class PullRequestsAdapter extends RecyclerView.Adapter { + View view = + LayoutInflater.from(ctx) + .inflate( + R.layout + .layout_repo_language_statistics, + null); + LinearLayout layout = + view.findViewById(R.id.lang_color); + layout.removeAllViews(); + for (Map.Entry entry : + response.body().entrySet()) { + Chip chip = new Chip(ctx); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams - .WRAP_CONTENT, + .MATCH_PARENT, LinearLayout.LayoutParams .WRAP_CONTENT); - params.setMargins(0, 32, 32, 0); + params.setMargins(0, 8, 0, 0); + chip.setLayoutParams(params); + chip.setText( + String.format( + "%s - %s%%", + entry.getKey(), + LanguageStatisticsHelper + .calculatePercentage( + entry + .getValue(), + totalSpan))); + int bgColor = + ctx.getResources() + .getColor( + LanguageColor + .languageColor( + entry + .getKey()), + null); + chip.setChipBackgroundColor( + ColorStateList.valueOf(bgColor)); + chip.setTextColor( + isLightColor(bgColor) + ? Color.BLACK + : Color.WHITE); + chip.setShapeAppearanceModel( + new ShapeAppearanceModel() + .toBuilder() + .setAllCorners( + CornerFamily + .ROUNDED, + 48) + .build()); + chip.setEnabled(false); - LinearLayout layout = - view.findViewById(R.id.lang_color); - layout.removeAllViews(); - - for (Map.Entry entry : - response.body().entrySet()) { - - LinearLayout layoutSub = - new LinearLayout(getContext()); - layoutSub.setOrientation( - LinearLayout.HORIZONTAL); - layoutSub.setGravity( - Gravity.START | Gravity.TOP); - layout.addView(layoutSub); - - ImageView colorView = - new ImageView(getContext()); - colorView.setLayoutParams(params); - - String hexColor = - String.format( - "#%06X", - (0xFFFFFF - & languageColor( - entry - .getKey()))); - TextDrawable drawable = - TextDrawable.builder() - .beginConfig() - .width(64) - .height(64) - .endConfig() - .buildRoundRect( - "", - Color - .parseColor( - hexColor), - 8); - drawable.setTint( - getResources() - .getColor( - languageColor( - entry - .getKey()), - null)); - colorView.setImageDrawable(drawable); - layoutSub.addView(colorView); - - TextView langName = - new TextView(getContext()); - langName.setLayoutParams(params); - langName.setText(entry.getKey()); - layoutSub.addView(langName); - - TextView langPercentage = - new TextView(getContext()); - langPercentage.setLayoutParams(params); - langPercentage.setTextSize(12); - langPercentage.setText( - getString( - R.string - .lang_percentage, - calculatePercentage( - entry - .getValue(), - totalSpan))); - layoutSub.addView(langPercentage); - } - - MaterialAlertDialogBuilder - materialAlertDialogBuilder1 = - new MaterialAlertDialogBuilder( - ctx) - .setTitle( - R.string - .lang_statistics) - .setView(view) - .setNeutralButton( - getString( - R - .string - .close), - null); - - materialAlertDialogBuilder1.create().show(); + layout.addView(chip); } + + new MaterialAlertDialogBuilder(ctx) + .setTitle(R.string.lang_statistics) + .setView(view) + .setNeutralButton( + getString(R.string.close), null) + .create() + .show(); }); } @@ -287,7 +236,7 @@ public class RepoInfoFragment extends Fragment { break; case 404: - binding.languagesStatistic.setVisibility(View.GONE); + binding.languageStatsCard.setVisibility(View.GONE); break; } } @@ -301,6 +250,13 @@ public class RepoInfoFragment extends Fragment { }); } + private boolean isLightColor(int color) { + double luminance = + (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) + / 255; + return luminance > 0.5; + } + private void setRepoInfo(Locale locale) { Repository repoInfo = repository.getRepository(); @@ -376,7 +332,7 @@ public class RepoInfoFragment extends Fragment { : repoInfo.getWebsite(); binding.repoMetaWebsite.setText(website); binding.repoMetaWebsite.setLinksClickable(false); - binding.websiteFrame.setOnClickListener( + binding.repoMetaWebsite.setOnClickListener( (v) -> { if (!repoInfo.getWebsite().isEmpty()) { AppUtil.openUrlInBrowser(requireContext(), repoInfo.getWebsite()); diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java index 5370619a..cf93af46 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java @@ -118,10 +118,12 @@ public class DetailFragment extends Fragment { ((ProfileActivity) requireActivity()).viewPager.setCurrentItem(2)); if (username.equals(((BaseActivity) context).getAccount().getAccount().getUserName())) { - binding.metaProfile.setVisibility(View.VISIBLE); + binding.updateAvatar.setVisibility(View.VISIBLE); + binding.updateProfile.setVisibility(View.VISIBLE); itsMe = true; } else { - binding.metaProfile.setVisibility(View.GONE); + binding.updateAvatar.setVisibility(View.GONE); + binding.updateProfile.setVisibility(View.GONE); } binding.updateProfile.setOnClickListener( @@ -475,7 +477,7 @@ public class DetailFragment extends Fragment { String.format( response.body().getStarredReposCount() + " " - + getString(R.string.starredRepos))); + + getString(R.string.navStarredRepos))); String[] userLanguageCodes = response.body().getLanguage().split("-"); @@ -520,14 +522,12 @@ public class DetailFragment extends Fragment { binding.website.setText(response.body().getWebsite()); } else { binding.website.setText(R.string.noDataWebsite); - binding.website.setAlpha(.4F); } if (!response.body().getLocation().isEmpty()) { binding.location.setText(response.body().getLocation()); } else { binding.location.setText(R.string.noDataLocation); - binding.location.setAlpha(.4F); } if (!response.body().getDescription().isEmpty()) { @@ -537,7 +537,6 @@ public class DetailFragment extends Fragment { binding.bio); } else { binding.bio.setText(R.string.noDataBio); - binding.bio.setAlpha(.4F); } break; diff --git a/app/src/main/java/org/mian/gitnex/helpers/Markdown.java b/app/src/main/java/org/mian/gitnex/helpers/Markdown.java index cf690952..c8b50b6d 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/Markdown.java +++ b/app/src/main/java/org/mian/gitnex/helpers/Markdown.java @@ -66,8 +66,6 @@ import org.mian.gitnex.helpers.contexts.IssueContext; import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.markdown.AlertPlugin; import stormpot.Allocator; -import stormpot.BlazePool; -import stormpot.Config; import stormpot.Pool; import stormpot.Poolable; import stormpot.Slot; @@ -75,6 +73,7 @@ import stormpot.Timeout; /** * @author opyale + * @author mmarif */ public class Markdown { @@ -95,44 +94,37 @@ public class Markdown { private static final Pool rvRendererPool; static { - Config config = new Config<>(); + rendererPool = + Pool.from( + new Allocator() { + @Override + public Renderer allocate(Slot slot) { + return new Renderer(slot); + } - config.setBackgroundExpirationEnabled(true); - config.setPreciseLeakDetectionEnabled(true); - config.setSize(MAX_OBJECT_POOL_SIZE); - config.setAllocator( - new Allocator() { + @Override + public void deallocate(Renderer poolable) {} + }) + .setSize(MAX_OBJECT_POOL_SIZE) + .setBackgroundExpirationEnabled(true) + .setPreciseLeakDetectionEnabled(true) + .build(); - @Override - public Renderer allocate(Slot slot) { - return new Renderer(slot); - } + rvRendererPool = + Pool.from( + new Allocator() { + @Override + public RecyclerViewRenderer allocate(Slot slot) { + return new RecyclerViewRenderer(slot); + } - @Override - public void deallocate(Renderer poolable) {} - }); - - rendererPool = new BlazePool<>(config); - - Config configRv = new Config<>(); - - configRv.setBackgroundExpirationEnabled(true); - configRv.setPreciseLeakDetectionEnabled(true); - configRv.setSize(MAX_OBJECT_POOL_SIZE); - configRv.setAllocator( - new Allocator() { - - @Override - public RecyclerViewRenderer allocate(Slot slot) { - - return new RecyclerViewRenderer(slot); - } - - @Override - public void deallocate(RecyclerViewRenderer poolable) {} - }); - - rvRendererPool = new BlazePool<>(configRv); + @Override + public void deallocate(RecyclerViewRenderer poolable) {} + }) + .setSize(MAX_OBJECT_POOL_SIZE) + .setBackgroundExpirationEnabled(true) + .setPreciseLeakDetectionEnabled(true) + .build(); } public static void render(Context context, String markdown, TextView textView) { diff --git a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageColor.java b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageColor.java index fdc4fe2c..86245996 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageColor.java +++ b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageColor.java @@ -5,11 +5,9 @@ import java.util.Map; import org.mian.gitnex.R; /** - * @author M M Arif + * @author mmarif */ public class LanguageColor { - - private static int color = R.color.default_lang_color; private static final Map colors = new HashMap<>(); static { @@ -208,16 +206,14 @@ public class LanguageColor { colors.put("robots.txt", R.color.yaml); colors.put("sed", R.color.sed); colors.put("xBase", R.color.x_base); + colors.put("D", R.color.wiki); } public static int languageColor(String key) { - - for (Map.Entry s : colors.entrySet()) { - if (key.equalsIgnoreCase(s.getKey())) { - color = s.getValue(); - } + if (key == null) { + return R.color.default_lang_color; } - - return color; + Integer color = colors.get(key); + return color != null ? color : R.color.default_lang_color; } } diff --git a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsBar.java b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsBar.java deleted file mode 100644 index ab054735..00000000 --- a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsBar.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mian.gitnex.helpers.languagestatistics; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Rect; -import android.util.AttributeSet; -import java.util.ArrayList; - -/** - * @author M M Arif - */ -public class LanguageStatisticsBar extends androidx.appcompat.widget.AppCompatSeekBar { - - private ArrayList progressItemsList; - - public LanguageStatisticsBar(Context context) { - super(context); - } - - public LanguageStatisticsBar(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public LanguageStatisticsBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public void initData(ArrayList progressItemsListInit) { - this.progressItemsList = progressItemsListInit; - } - - @Override - protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } - - protected void onDraw(Canvas canvas) { - - if (!progressItemsList.isEmpty()) { - - int progressBarWidth = getWidth(); - int progressBarHeight = getHeight(); - int thumbOffSet = getThumbOffset(); - int lastProgressX = 0; - int progressItemWidth, progressItemRight; - - for (int i = 0; i < progressItemsList.size(); i++) { - - SeekbarItem progressItem = progressItemsList.get(i); - @SuppressLint("DrawAllocation") - Paint progressPaint = new Paint(); - progressPaint.setColor(getResources().getColor(progressItem.color, null)); - - progressItemWidth = - (int) (progressItem.progressItemPercentage * progressBarWidth / 100); - - progressItemRight = lastProgressX + progressItemWidth; - - if (i == progressItemsList.size() - 1 && progressItemRight != progressBarWidth) { - progressItemRight = progressBarWidth; - } - - @SuppressLint("DrawAllocation") - Rect progressRect = new Rect(); - progressRect.set( - lastProgressX, - thumbOffSet / 2, - progressItemRight, - progressBarHeight - thumbOffSet / 2); - canvas.drawRect(progressRect, progressPaint); - lastProgressX = progressItemRight; - } - super.onDraw(canvas); - } - } -} diff --git a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsHelper.java b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsHelper.java index 015669b7..205eb7ce 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsHelper.java +++ b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsHelper.java @@ -3,7 +3,7 @@ package org.mian.gitnex.helpers.languagestatistics; import android.annotation.SuppressLint; /** - * @author M M Arif + * @author mmarif */ public class LanguageStatisticsHelper { diff --git a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsView.java b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsView.java new file mode 100644 index 00000000..aaa46e38 --- /dev/null +++ b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/LanguageStatisticsView.java @@ -0,0 +1,80 @@ +package org.mian.gitnex.helpers.languagestatistics; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; +import androidx.annotation.NonNull; +import java.util.ArrayList; + +/** + * @author mmarif + */ +public class LanguageStatisticsView extends View { + + private ArrayList progressItemsList; + private static final float CORNER_RADIUS = 8f; + private final Paint progressPaint = new Paint(); + private final RectF progressRect = new RectF(); + + public LanguageStatisticsView(Context context) { + super(context); + init(); + } + + public LanguageStatisticsView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public LanguageStatisticsView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(); + } + + private void init() { + progressItemsList = new ArrayList<>(); + } + + public void setData(ArrayList progressItemsListInit) { + this.progressItemsList = progressItemsListInit; + invalidate(); + } + + @Override + protected void onDraw(@NonNull Canvas canvas) { + super.onDraw(canvas); + + if (progressItemsList.isEmpty()) return; + + int width = getWidth(); + int height = getHeight(); + float lastX = 0f; + + for (int i = 0; i < progressItemsList.size(); i++) { + SeekbarItem progressItem = progressItemsList.get(i); + progressPaint.setColor(getResources().getColor(progressItem.color, null)); + + float progressItemWidth = (progressItem.progressItemPercentage * width) / 100f; + float progressItemRight = lastX + progressItemWidth; + + if (i == progressItemsList.size() - 1 && progressItemRight < width) { + progressItemRight = width; + } + + progressRect.set(lastX, 0f, progressItemRight, height); + canvas.drawRoundRect(progressRect, CORNER_RADIUS, CORNER_RADIUS, progressPaint); + + lastX = progressItemRight; + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + setMeasuredDimension( + MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec)); + } +} diff --git a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/SeekbarItem.java b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/SeekbarItem.java index c92826f6..5130aa13 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/SeekbarItem.java +++ b/app/src/main/java/org/mian/gitnex/helpers/languagestatistics/SeekbarItem.java @@ -1,7 +1,7 @@ package org.mian.gitnex.helpers.languagestatistics; /** - * @author M M Arif + * @author mmarif */ public class SeekbarItem { diff --git a/app/src/main/res/layout/bottom_sheet_settings_general.xml b/app/src/main/res/layout/bottom_sheet_settings_general.xml index 4a4b415f..a3e225ba 100644 --- a/app/src/main/res/layout/bottom_sheet_settings_general.xml +++ b/app/src/main/res/layout/bottom_sheet_settings_general.xml @@ -168,7 +168,7 @@ style="@style/CustomChipFilter" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/starredRepos" /> + android:text="@string/navStarredRepos" /> diff --git a/app/src/main/res/layout/custom_branches_dialog.xml b/app/src/main/res/layout/custom_branches_dialog.xml index 1f6d9950..07ea022f 100644 --- a/app/src/main/res/layout/custom_branches_dialog.xml +++ b/app/src/main/res/layout/custom_branches_dialog.xml @@ -11,8 +11,10 @@ android:layout_height="wrap_content" android:text="@string/pageTitleChooseBranch" android:textAppearance="?attr/textAppearanceHeadline5" - android:layout_marginBottom="@dimen/dimen8dp" - android:padding="@dimen/dimen16dp" /> + android:layout_marginBottom="@dimen/dimen16dp" + android:layout_marginStart="@dimen/dimen8dp" + android:layout_marginEnd="@dimen/dimen8dp" + android:layout_marginTop="@dimen/dimen8dp" /> - - - - - - + android:orientation="horizontal"> - + + + + + + + + + + + + + + + android:text="@string/editSettings" + android:layout_gravity="end" + android:textColor="?attr/materialCardBackgroundColor" + android:textSize="@dimen/dimen14sp" /> + + + + - + android:layout_marginTop="@dimen/dimen4dp" + android:layout_marginBottom="@dimen/dimen12dp" + android:textColor="?attr/primaryTextColor" + android:textIsSelectable="true" + android:textSize="@dimen/dimen20sp" /> -