mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
[UI] Add Pull & Release Counter Badge to TabLable (#350)
fix cp error fix reformat code remove issuesCounter check if API return new objects, make settings option more generic Merge branch 'master' into 218-PR-Tab_OpenNumber add Release Counter Rename Issue Badge and add Pull Badge Upgrade Gradle and delete a useles commend Json Responce: add OpenPullCount and ReleaseCount Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/350 Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
parent
c402046699
commit
1da54e3d35
@ -50,7 +50,9 @@ import android.net.Uri;
|
|||||||
|
|
||||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoFragment.BottomSheetListener {
|
public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoFragment.BottomSheetListener {
|
||||||
|
|
||||||
private TextView textViewBadge;
|
private TextView textViewBadgeIssue;
|
||||||
|
private TextView textViewBadgePull;
|
||||||
|
private TextView textViewBadgeRelease;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResourceId(){
|
protected int getLayoutResourceId(){
|
||||||
@ -129,25 +131,55 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
||||||
|
|
||||||
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
|
if(tinyDb.getBoolean("enableCounterBadges")) {
|
||||||
|
|
||||||
|
@SuppressLint("InflateParams") View tabHeader2 = LayoutInflater.from(this).inflate(R.layout.badge_issue, null);
|
||||||
|
textViewBadgeIssue = tabHeader2.findViewById(R.id.counterBadgeIssue);
|
||||||
|
|
||||||
|
@SuppressLint("InflateParams") View tabHeader4 = LayoutInflater.from(this).inflate(R.layout.badge_pull, null);
|
||||||
|
textViewBadgePull = tabHeader4.findViewById(R.id.counterBadgePull);
|
||||||
|
|
||||||
|
@SuppressLint("InflateParams") View tabHeader6 = LayoutInflater.from(this).inflate(R.layout.badge_release, null);
|
||||||
|
textViewBadgeRelease = tabHeader6.findViewById(R.id.counterBadgeRelease);
|
||||||
|
|
||||||
|
textViewBadgeIssue.setVisibility(View.GONE);
|
||||||
|
textViewBadgePull.setVisibility(View.GONE);
|
||||||
|
textViewBadgeRelease.setVisibility(View.GONE);
|
||||||
|
|
||||||
@SuppressLint("InflateParams") View tabHeader = LayoutInflater.from(this).inflate(R.layout.badge, null);
|
|
||||||
textViewBadge = tabHeader.findViewById(R.id.counterBadge);
|
|
||||||
if(!tinyDb.getString("issuesCounter").isEmpty()) {
|
|
||||||
getRepoInfo(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
getRepoInfo(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||||
}
|
|
||||||
Objects.requireNonNull(tabLayout.getTabAt(2)).setCustomView(tabHeader);
|
|
||||||
|
|
||||||
TabLayout.Tab tabOpenIssues = tabLayout.getTabAt(2);
|
|
||||||
ColorStateList textColor = tabLayout.getTabTextColors();
|
ColorStateList textColor = tabLayout.getTabTextColors();
|
||||||
assert tabOpenIssues != null;
|
|
||||||
TextView openIssueTabView = Objects.requireNonNull(tabOpenIssues.getCustomView()).findViewById(R.id.counterBadgeText);
|
|
||||||
openIssueTabView.setTextColor(textColor);
|
|
||||||
|
|
||||||
|
// issue count
|
||||||
|
if (textViewBadgeIssue.getText() != "") {
|
||||||
|
TabLayout.Tab tabOpenIssues = tabLayout.getTabAt(2);
|
||||||
|
Objects.requireNonNull(tabLayout.getTabAt(2)).setCustomView(tabHeader2);
|
||||||
|
assert tabOpenIssues != null;
|
||||||
|
TextView openIssueTabView = Objects.requireNonNull(tabOpenIssues.getCustomView()).findViewById(R.id.counterBadgeIssueText);
|
||||||
|
openIssueTabView.setTextColor(textColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// pull count
|
||||||
|
if (textViewBadgePull.getText() != "") { // only show if API returned a number
|
||||||
|
Objects.requireNonNull(tabLayout.getTabAt(4)).setCustomView(tabHeader4);
|
||||||
|
TabLayout.Tab tabOpenPulls = tabLayout.getTabAt(4);
|
||||||
|
assert tabOpenPulls != null;
|
||||||
|
TextView openPullTabView = Objects.requireNonNull(tabOpenPulls.getCustomView()).findViewById(R.id.counterBadgePullText);
|
||||||
|
openPullTabView.setTextColor(textColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// release count
|
||||||
|
if (textViewBadgeRelease.getText() != "") { // only show if API returned a number
|
||||||
|
Objects.requireNonNull(tabLayout.getTabAt(6)).setCustomView(tabHeader6);
|
||||||
|
TabLayout.Tab tabOpenRelease = tabLayout.getTabAt(6);
|
||||||
|
assert tabOpenRelease != null;
|
||||||
|
TextView openReleaseTabView = Objects.requireNonNull(tabOpenRelease.getCustomView()).findViewById(R.id.counterBadgeReleaseText);
|
||||||
|
openReleaseTabView.setTextColor(textColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRepositoryStarStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
checkRepositoryStarStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||||
checkRepositoryWatchStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
checkRepositoryWatchStatus(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -166,13 +198,16 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
|
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
|
||||||
getRepoInfo(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
getRepoInfo(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.repo_dotted_menu, menu);
|
inflater.inflate(R.menu.repo_dotted_menu, menu);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -294,6 +329,8 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
private void getRepoInfo(String instanceUrl, String token, final String owner, String repo) {
|
private void getRepoInfo(String instanceUrl, String token, final String owner, String repo) {
|
||||||
|
|
||||||
|
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||||
|
|
||||||
Call<UserRepositories> call = RetrofitClient
|
Call<UserRepositories> call = RetrofitClient
|
||||||
.getInstance(instanceUrl, getApplicationContext())
|
.getInstance(instanceUrl, getApplicationContext())
|
||||||
.getApiInterface()
|
.getApiInterface()
|
||||||
@ -310,8 +347,24 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
if (response.code() == 200) {
|
if (response.code() == 200) {
|
||||||
|
|
||||||
|
if(tinyDb.getBoolean("enableCounterBadges")) {
|
||||||
assert repoInfo != null;
|
assert repoInfo != null;
|
||||||
textViewBadge.setText(repoInfo.getOpen_issues_count());
|
|
||||||
|
if(repoInfo.getOpen_issues_count() != null) {
|
||||||
|
textViewBadgeIssue.setVisibility(View.VISIBLE);
|
||||||
|
textViewBadgeIssue.setText(repoInfo.getOpen_issues_count());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(repoInfo.getOpen_pull_count() != null) {
|
||||||
|
textViewBadgePull.setVisibility(View.VISIBLE);
|
||||||
|
textViewBadgePull.setText(repoInfo.getOpen_pull_count());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(repoInfo.getRelease_count() != null) {
|
||||||
|
textViewBadgeRelease.setVisibility(View.VISIBLE);
|
||||||
|
textViewBadgeRelease.setText(repoInfo.getRelease_count());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,6 +379,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
public void onFailure(@NonNull Call<UserRepositories> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserRepositories> call, @NonNull Throwable t) {
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ public class IssuesOpenFragment extends Fragment {
|
|||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(getContext());
|
TinyDB tinyDb = new TinyDB(getContext());
|
||||||
String repoFullName = tinyDb.getString("repoFullName");
|
String repoFullName = tinyDb.getString("repoFullName");
|
||||||
//Log.i("repoFullName", tinyDb.getString("repoFullName"));
|
|
||||||
String[] parts = repoFullName.split("/");
|
String[] parts = repoFullName.split("/");
|
||||||
final String repoOwner = parts[0];
|
final String repoOwner = parts[0];
|
||||||
final String repoName = parts[1];
|
final String repoName = parts[1];
|
||||||
|
@ -8,7 +8,6 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -71,18 +70,18 @@ public class SettingsFragment extends Fragment {
|
|||||||
LinearLayout themeFrame = v.findViewById(R.id.themeSelectionFrame);
|
LinearLayout themeFrame = v.findViewById(R.id.themeSelectionFrame);
|
||||||
LinearLayout certsFrame = v.findViewById(R.id.certsFrame);
|
LinearLayout certsFrame = v.findViewById(R.id.certsFrame);
|
||||||
|
|
||||||
Switch issuesSwitch = v.findViewById(R.id.switchIssuesBadge);
|
Switch counterBadgesSwitch = v.findViewById(R.id.switchCounterBadge);
|
||||||
Switch pdfModeSwitch = v.findViewById(R.id.switchPdfMode);
|
Switch pdfModeSwitch = v.findViewById(R.id.switchPdfMode);
|
||||||
TextView helpTranslate = v.findViewById(R.id.helpTranslate);
|
TextView helpTranslate = v.findViewById(R.id.helpTranslate);
|
||||||
|
|
||||||
helpTranslate.setOnClickListener(new View.OnClickListener() {
|
helpTranslate.setOnClickListener(v12 -> {
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||||
intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
|
intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!tinyDb.getString("localeStr").isEmpty()) {
|
if(!tinyDb.getString("localeStr").isEmpty()) {
|
||||||
@ -133,11 +132,11 @@ public class SettingsFragment extends Fragment {
|
|||||||
themeSelectedChoice = tinyDb.getInt("themeId");
|
themeSelectedChoice = tinyDb.getInt("themeId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
|
if(tinyDb.getBoolean("enableCounterBadges")) {
|
||||||
issuesSwitch.setChecked(true);
|
counterBadgesSwitch.setChecked(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
issuesSwitch.setChecked(false);
|
counterBadgesSwitch.setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("enablePdfMode")) {
|
if(tinyDb.getBoolean("enablePdfMode")) {
|
||||||
@ -169,40 +168,40 @@ public class SettingsFragment extends Fragment {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// issues badge switcher
|
// counter badge switcher
|
||||||
issuesSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
tinyDb.putBoolean("enableCounterIssueBadge", true);
|
tinyDb.putBoolean("enableCounterBadges", true);
|
||||||
tinyDb.putString("enableCounterIssueBadgeInit", "yes");
|
tinyDb.putString("enableCounterBadgesInit", "yes");
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
|
||||||
} else {
|
|
||||||
tinyDb.putBoolean("enableCounterIssueBadge", false);
|
|
||||||
tinyDb.putString("enableCounterIssueBadgeInit", "yes");
|
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
tinyDb.putBoolean("enableCounterBadges", false);
|
||||||
|
tinyDb.putString("enableCounterBadgesInit", "yes");
|
||||||
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// pdf night mode switcher
|
// pdf night mode switcher
|
||||||
pdfModeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
pdfModeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
tinyDb.putBoolean("enablePdfMode", true);
|
tinyDb.putBoolean("enablePdfMode", true);
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
tinyDb.putString("enablePdfModeInit", "yes");
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
tinyDb.putBoolean("enablePdfMode", false);
|
tinyDb.putBoolean("enablePdfMode", false);
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
tinyDb.putString("enablePdfModeInit", "yes");
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// theme selection dialog
|
// theme selection dialog
|
||||||
themeFrame.setOnClickListener(new View.OnClickListener() {
|
themeFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -214,9 +213,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
tsBuilder.setCancelable(false);
|
tsBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, new DialogInterface.OnClickListener() {
|
tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, (dialogInterfaceTheme, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterfaceTheme, int i) {
|
|
||||||
|
|
||||||
themeSelectedChoice = i;
|
themeSelectedChoice = i;
|
||||||
themeSelected.setText(themeList[i]);
|
themeSelected.setText(themeList[i]);
|
||||||
@ -228,19 +225,15 @@ public class SettingsFragment extends Fragment {
|
|||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = tsBuilder.create();
|
AlertDialog cfDialog = tsBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// custom font dialog
|
// custom font dialog
|
||||||
customFontFrame.setOnClickListener(new View.OnClickListener() {
|
customFontFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder cfBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder cfBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -252,9 +245,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
cfBuilder.setCancelable(false);
|
cfBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, new DialogInterface.OnClickListener() {
|
cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, (dialogInterfaceCustomFont, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterfaceCustomFont, int i) {
|
|
||||||
|
|
||||||
customFontSelectedChoice = i;
|
customFontSelectedChoice = i;
|
||||||
customFontSelected.setText(customFontList[i]);
|
customFontSelected.setText(customFontList[i]);
|
||||||
@ -266,19 +257,15 @@ public class SettingsFragment extends Fragment {
|
|||||||
dialogInterfaceCustomFont.dismiss();
|
dialogInterfaceCustomFont.dismiss();
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = cfBuilder.create();
|
AlertDialog cfDialog = cfBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// home screen dialog
|
// home screen dialog
|
||||||
homeScreenFrame.setOnClickListener(new View.OnClickListener() {
|
homeScreenFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder hsBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder hsBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -290,9 +277,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
hsBuilder.setCancelable(false);
|
hsBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
hsBuilder.setSingleChoiceItems(homeScreenList, homeScreenSelectedChoice, new DialogInterface.OnClickListener() {
|
hsBuilder.setSingleChoiceItems(homeScreenList, homeScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterfaceHomeScreen, int i) {
|
|
||||||
|
|
||||||
homeScreenSelectedChoice = i;
|
homeScreenSelectedChoice = i;
|
||||||
homeScreenSelected.setText(homeScreenList[i]);
|
homeScreenSelected.setText(homeScreenList[i]);
|
||||||
@ -302,19 +287,15 @@ public class SettingsFragment extends Fragment {
|
|||||||
dialogInterfaceHomeScreen.dismiss();
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog hsDialog = hsBuilder.create();
|
AlertDialog hsDialog = hsBuilder.create();
|
||||||
hsDialog.show();
|
hsDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// code block dialog
|
// code block dialog
|
||||||
codeBlockFrame.setOnClickListener(new View.OnClickListener() {
|
codeBlockFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder cBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder cBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -326,9 +307,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
cBuilder.setCancelable(false);
|
cBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
cBuilder.setSingleChoiceItems(codeBlockList, codeBlockSelectedChoice, new DialogInterface.OnClickListener() {
|
cBuilder.setSingleChoiceItems(codeBlockList, codeBlockSelectedChoice, (dialogInterfaceCodeBlock, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterfaceCodeBlock, int i) {
|
|
||||||
|
|
||||||
codeBlockSelectedChoice = i;
|
codeBlockSelectedChoice = i;
|
||||||
codeBlockSelected.setText(codeBlockList[i]);
|
codeBlockSelected.setText(codeBlockList[i]);
|
||||||
@ -361,19 +340,15 @@ public class SettingsFragment extends Fragment {
|
|||||||
dialogInterfaceCodeBlock.dismiss();
|
dialogInterfaceCodeBlock.dismiss();
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cDialog = cBuilder.create();
|
AlertDialog cDialog = cBuilder.create();
|
||||||
cDialog.show();
|
cDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// language dialog
|
// language dialog
|
||||||
langFrame.setOnClickListener(new View.OnClickListener() {
|
langFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder lBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder lBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -385,9 +360,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
lBuilder.setCancelable(false);
|
lBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
lBuilder.setSingleChoiceItems(langList, langSelectedChoice, new DialogInterface.OnClickListener() {
|
lBuilder.setSingleChoiceItems(langList, langSelectedChoice, (dialogInterface, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
|
|
||||||
langSelectedChoice = i;
|
langSelectedChoice = i;
|
||||||
tvLanguageSelected.setText(langList[i]);
|
tvLanguageSelected.setText(langList[i]);
|
||||||
@ -444,25 +417,17 @@ public class SettingsFragment extends Fragment {
|
|||||||
Objects.requireNonNull(getActivity()).recreate();
|
Objects.requireNonNull(getActivity()).recreate();
|
||||||
getActivity().overridePendingTransition(0, 0);
|
getActivity().overridePendingTransition(0, 0);
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
lBuilder.setNegativeButton(getString(R.string.cancelButton), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> dialog.dismiss());
|
||||||
|
|
||||||
AlertDialog lDialog = lBuilder.create();
|
AlertDialog lDialog = lBuilder.create();
|
||||||
lDialog.show();
|
lDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// time n date dialog
|
// time n date dialog
|
||||||
timeFrame.setOnClickListener(new View.OnClickListener() {
|
timeFrame.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder tBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder tBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
@ -474,9 +439,7 @@ public class SettingsFragment extends Fragment {
|
|||||||
tBuilder.setCancelable(false);
|
tBuilder.setCancelable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, new DialogInterface.OnClickListener() {
|
tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, (dialogInterfaceTime, i) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterfaceTime, int i) {
|
|
||||||
|
|
||||||
timeSelectedChoice = i;
|
timeSelectedChoice = i;
|
||||||
tvDateTimeSelected.setText(timeList[i]);
|
tvDateTimeSelected.setText(timeList[i]);
|
||||||
@ -492,22 +455,23 @@ public class SettingsFragment extends Fragment {
|
|||||||
dialogInterfaceTime.dismiss();
|
dialogInterfaceTime.dismiss();
|
||||||
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog tDialog = tBuilder.create();
|
AlertDialog tDialog = tBuilder.create();
|
||||||
tDialog.show();
|
tDialog.show();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
|
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
ctx = context;
|
ctx = context;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,8 @@ public class PullRequests {
|
|||||||
private int forks_count;
|
private int forks_count;
|
||||||
private int id;
|
private int id;
|
||||||
private int open_issues_count;
|
private int open_issues_count;
|
||||||
|
private int open_pr_counter;
|
||||||
|
private int release_counter;
|
||||||
private int size;
|
private int size;
|
||||||
private int stars_count;
|
private int stars_count;
|
||||||
private int watchers_count;
|
private int watchers_count;
|
||||||
@ -256,6 +258,14 @@ public class PullRequests {
|
|||||||
return open_issues_count;
|
return open_issues_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOpen_pull_count() {
|
||||||
|
return open_pr_counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRelease_count() {
|
||||||
|
return release_counter;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ public class UserRepositories {
|
|||||||
private String stars_count;
|
private String stars_count;
|
||||||
private String watchers_count;
|
private String watchers_count;
|
||||||
private String open_issues_count;
|
private String open_issues_count;
|
||||||
|
private String open_pr_counter;
|
||||||
|
private String release_counter;
|
||||||
private String html_url;
|
private String html_url;
|
||||||
private String default_branch;
|
private String default_branch;
|
||||||
private Date created_at;
|
private Date created_at;
|
||||||
@ -54,6 +56,14 @@ public class UserRepositories {
|
|||||||
return stars_count;
|
return stars_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOpen_pull_count() {
|
||||||
|
return open_pr_counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelease_count() {
|
||||||
|
return release_counter;
|
||||||
|
}
|
||||||
|
|
||||||
public String getWatchers_count() {
|
public String getWatchers_count() {
|
||||||
return watchers_count;
|
return watchers_count;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/relativeLayoutTabHeader"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/counterBadgeText"
|
android:id="@+id/counterBadgeIssueText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@ -16,14 +15,14 @@
|
|||||||
android:textColor="@color/lightGray" />
|
android:textColor="@color/lightGray" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/counterBadge"
|
android:id="@+id/counterBadgeIssue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:layout_marginTop="1dp"
|
android:layout_marginTop="1dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_toEndOf="@+id/counterBadgeText"
|
android:layout_toEndOf="@+id/counterBadgeIssueText"
|
||||||
android:background="@drawable/badge_background"
|
android:background="@drawable/badge_background"
|
||||||
android:text="@string/infoTabRepoZero"
|
android:text="@string/infoTabRepoZero"
|
||||||
android:textColor="@color/white" />
|
android:textColor="@color/white" />
|
30
app/src/main/res/layout/badge_pull.xml
Normal file
30
app/src/main/res/layout/badge_pull.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counterBadgePullText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:textAllCaps="true"
|
||||||
|
android:text="@string/tabPullRequests"
|
||||||
|
android:textColor="@color/lightGray" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counterBadgePull"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
android:layout_toEndOf="@id/counterBadgePullText"
|
||||||
|
android:background="@drawable/badge_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/infoTabRepoZero"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
30
app/src/main/res/layout/badge_release.xml
Normal file
30
app/src/main/res/layout/badge_release.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counterBadgeReleaseText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:textAllCaps="true"
|
||||||
|
android:text="@string/tab_text_releases"
|
||||||
|
android:textColor="@color/lightGray" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counterBadgeRelease"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
android:layout_toEndOf="@id/counterBadgeReleaseText"
|
||||||
|
android:background="@drawable/badge_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/infoTabRepoZero"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -109,25 +109,25 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/issueBadgeFrame"
|
android:id="@+id/counterBadgeFrame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvIssueBadgeHeader"
|
android:id="@+id/tvCounterBadgeHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:layout_marginStart="44dp"
|
android:layout_marginStart="44dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:text="@string/settingsIssueBadgeHeaderText"
|
android:text="@string/settingsCounterBadges"
|
||||||
android:textColor="?attr/primaryTextColor"/>
|
android:textColor="?attr/primaryTextColor"/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/switchIssuesBadge"
|
android:id="@+id/switchCounterBadge"
|
||||||
android:layout_toEndOf="@+id/tvIssueBadgeHeader"
|
android:layout_toEndOf="@+id/tvCounterBadgeHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:switchMinWidth="56dp"
|
android:switchMinWidth="56dp"
|
||||||
|
@ -275,6 +275,7 @@
|
|||||||
<string name="themeSelectionSelectedText" translatable="false">Dark</string>
|
<string name="themeSelectionSelectedText" translatable="false">Dark</string>
|
||||||
<string name="settingsPdfModeHeaderText">PDF Night Mode</string>
|
<string name="settingsPdfModeHeaderText">PDF Night Mode</string>
|
||||||
<string name="fileViewerHeader">File Viewer</string>
|
<string name="fileViewerHeader">File Viewer</string>
|
||||||
|
<string name="settingsCounterBadges">Counter Badges</string>
|
||||||
<!-- settings -->
|
<!-- settings -->
|
||||||
|
|
||||||
<string name="noMoreData">No more data available</string>
|
<string name="noMoreData">No more data available</string>
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.6.1'
|
classpath 'com.android.tools.build:gradle:3.6.2'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user