mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
modified about screen to get rid of extra libs and removed delete permission
This commit is contained in:
parent
ccfa4597cc
commit
ece9ff87fc
@ -122,8 +122,6 @@ dependencies {
|
||||
compile 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2'
|
||||
compile 'com.zzhoujay.markdown:markdown:1.0.4'
|
||||
compile 'com.github.daniel-stoneuk:material-about-library:1.8.1'
|
||||
compile 'com.mikepenz:iconics-core:2.8.2@aar'
|
||||
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
|
||||
compile 'com.mikepenz:community-material-typeface:1.7.22.1@aar'
|
||||
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
|
||||
annotationProcessor "frankiesardo:icepick-processor:${icepickVersion}"
|
||||
|
||||
@ -144,6 +144,11 @@
|
||||
android:name=".ui.modules.repos.extras.milestone.create.MilestoneActivityView"
|
||||
android:theme="@style/WhenLargeTheme"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.modules.about.FastHubAboutActivity"
|
||||
android:parentActivityName=".ui.modules.main.MainView"
|
||||
android:theme="@style/AppTheme.AboutActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.modules.parser.LinksParserActivity"
|
||||
android:configChanges="keyboard|orientation|screenSize"
|
||||
@ -174,15 +179,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.modules.about.FastHubAboutActivity"
|
||||
android:parentActivityName=".ui.modules.main.MainView"
|
||||
android:theme="@style/AppTheme.AboutActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.main.MainView" />
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".provider.tasks.notification.NotificationSchedulerJobTask"
|
||||
android:exported="false">
|
||||
|
||||
@ -1,117 +1,79 @@
|
||||
package com.fastaccess.ui.modules.about;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.danielstone.materialaboutlibrary.ConvenienceBuilder;
|
||||
import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickListener;
|
||||
import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem;
|
||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
|
||||
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
|
||||
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
|
||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||
import com.mikepenz.iconics.IconicsDrawable;
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerView;
|
||||
import com.fastaccess.ui.modules.repos.issues.create.CreateIssueView;
|
||||
import com.fastaccess.ui.modules.user.UserPagerView;
|
||||
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
/**
|
||||
* Created by danielstone on 11/03/2017.
|
||||
* Created by danielstone on 12 Mar 2017, 1:57 AM
|
||||
*/
|
||||
|
||||
public class FastHubAbout extends MaterialAboutActivity {
|
||||
@Override
|
||||
protected MaterialAboutList getMaterialAboutList(Context c) {
|
||||
public class FastHubAboutActivity extends MaterialAboutActivity {
|
||||
@Override protected MaterialAboutList getMaterialAboutList(Context context) {
|
||||
MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();
|
||||
|
||||
// Add items to card
|
||||
|
||||
appCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
|
||||
.text("FastHub")
|
||||
.icon(R.mipmap.ic_launcher)
|
||||
.build());
|
||||
|
||||
try {
|
||||
|
||||
appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
|
||||
new IconicsDrawable(c)
|
||||
.icon(GoogleMaterial.Icon.gmd_info_outline)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18),
|
||||
"Version",
|
||||
false));
|
||||
|
||||
appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_issues),
|
||||
getString(R.string.version), false));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
appCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(c,
|
||||
new IconicsDrawable(c)
|
||||
.icon(CommunityMaterial.Icon.cmd_star)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18),
|
||||
"Rate this app",
|
||||
null
|
||||
));
|
||||
appCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_star_filled),
|
||||
getString(R.string.rate_app), null));
|
||||
|
||||
|
||||
MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
|
||||
authorCardBuilder.title("Author");
|
||||
// authorCardBuilder.titleColor(ContextCompat.getColor(c, R.color.colorAccent));
|
||||
|
||||
authorCardBuilder.title(R.string.author);
|
||||
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
||||
.text("kosh")
|
||||
.text("Kosh")
|
||||
.subText("k0shk0sh")
|
||||
.icon(new IconicsDrawable(c)
|
||||
.icon(GoogleMaterial.Icon.gmd_person)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18))
|
||||
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
|
||||
.setOnClickListener(b -> UserPagerView.startActivity(context, "k0shk0sh"))
|
||||
.build());
|
||||
|
||||
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
|
||||
.text("Fork on GitHub")
|
||||
.icon(new IconicsDrawable(c)
|
||||
.icon(CommunityMaterial.Icon.cmd_github_circle)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18))
|
||||
.setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("https://github.com/daniel-stoneuk")))
|
||||
.text(R.string.fork_github)
|
||||
.icon(ContextCompat.getDrawable(context, R.drawable.ic_github))
|
||||
.setOnClickListener(b -> startActivity(RepoPagerView.createIntent(this, "FastHub", "k0shk0sh")))
|
||||
.build());
|
||||
|
||||
authorCardBuilder.addItem(ConvenienceBuilder.createEmailItem(c,
|
||||
new IconicsDrawable(c)
|
||||
.icon(CommunityMaterial.Icon.cmd_email)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18),
|
||||
"Send an email",
|
||||
true,
|
||||
"kosh20111@gmail.com",
|
||||
"Question concerning FastHub"));
|
||||
authorCardBuilder.addItem(ConvenienceBuilder.createEmailItem(context, ContextCompat.getDrawable(context, R.drawable.ic_email),
|
||||
getString(R.string.send_email), true, getString(R.string.email_address), getString(R.string.question_concerning_fasthub)));
|
||||
|
||||
MaterialAboutCard.Builder supportDevCard = new MaterialAboutCard.Builder();
|
||||
supportDevCard.title("Support Development");
|
||||
|
||||
supportDevCard.title(getString(R.string.feedback));
|
||||
supportDevCard.addItem(new MaterialAboutActionItem.Builder()
|
||||
.text("Report an issue")
|
||||
.subText("Having an issue? Report it here")
|
||||
.icon(new IconicsDrawable(c)
|
||||
.icon(GoogleMaterial.Icon.gmd_bug_report)
|
||||
.color(ContextCompat.getColor(c, R.color.aboutColorIcon))
|
||||
.sizeDp(18))
|
||||
.setOnClickListener(new MaterialAboutItemOnClickListener() {
|
||||
@Override
|
||||
public void onClick(boolean b) {
|
||||
// TODO: Launch feedback activity
|
||||
}
|
||||
})
|
||||
.text(R.string.report_issue)
|
||||
.subText(R.string.report_issue_here)
|
||||
.icon(ContextCompat.getDrawable(context, R.drawable.ic_bug))
|
||||
.setOnClickListener(b -> CreateIssueView.startForResult(this))
|
||||
.build());
|
||||
|
||||
|
||||
return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(), supportDevCard.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CharSequence getActivityTitle() {
|
||||
return null;
|
||||
@Override protected CharSequence getActivityTitle() {
|
||||
return getString(R.string.app_name);
|
||||
}
|
||||
|
||||
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) {
|
||||
Toasty.success(this, getString(R.string.thank_you_for_feedback), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class LoginPresenter extends BasePresenter<LoginMvp.View> implements LoginMvp.Pr
|
||||
.appendPath("authorize")
|
||||
.appendQueryParameter("client_id", BuildConfig.GITHUB_CLIENT_ID)
|
||||
.appendQueryParameter("redirect_uri", BuildConfig.REDIRECT_URL)
|
||||
.appendQueryParameter("scope", "user,repo,gist,delete_repo,notifications")
|
||||
.appendQueryParameter("scope", "user,repo,gist,notifications")
|
||||
.appendQueryParameter("state", BuildConfig.APPLICATION_ID)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class MainPresenter extends BasePresenter<MainMvp.View> implements MainMvp.Prese
|
||||
@Override public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (getView() != null) {
|
||||
getView().onCloseDrawer();
|
||||
if (item.getItemId() == R.id.feedback) {
|
||||
if (item.getItemId() == R.id.about) {
|
||||
getView().onSubmitFeedback();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.logout) {
|
||||
|
||||
@ -27,11 +27,11 @@ import com.fastaccess.helper.PrefGetter;
|
||||
import com.fastaccess.helper.TypeFaceHelper;
|
||||
import com.fastaccess.helper.ViewHelper;
|
||||
import com.fastaccess.ui.base.BaseActivity;
|
||||
import com.fastaccess.ui.modules.about.FastHubAboutActivity;
|
||||
import com.fastaccess.ui.modules.feeds.FeedsView;
|
||||
import com.fastaccess.ui.modules.gists.create.CreateGistView;
|
||||
import com.fastaccess.ui.modules.notification.NotificationActivityView;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerView;
|
||||
import com.fastaccess.ui.modules.repos.issues.create.CreateIssueView;
|
||||
import com.fastaccess.ui.modules.search.SearchView;
|
||||
import com.fastaccess.ui.modules.settings.SettingsBottomSheetDialog;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
@ -178,7 +178,7 @@ public class MainView extends BaseActivity<MainMvp.View, MainPresenter> implemen
|
||||
}
|
||||
|
||||
@Override public void onSubmitFeedback() {
|
||||
CreateIssueView.startForResult(this);
|
||||
startActivity(new Intent(this, FastHubAboutActivity.class));
|
||||
}
|
||||
|
||||
@Override public void onLogout() {
|
||||
|
||||
@ -309,7 +309,8 @@ public class RepoPagerView extends BaseActivity<RepoPagerMvp.View, RepoPagerPres
|
||||
menuItem.setVisible(true);
|
||||
menuItem.setTitle(repoModel.getParent().getFullName());
|
||||
}
|
||||
menu.findItem(R.id.deleteRepo).setVisible(getPresenter().isRepoOwner());
|
||||
// menu.findItem(R.id.deleteRepo).setVisible(getPresenter().isRepoOwner());
|
||||
menu.findItem(R.id.deleteRepo).setVisible(false);//removing delete permission.
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
@ -28,7 +27,6 @@ import com.prettifier.pretty.helper.PrettifyHelper;
|
||||
|
||||
|
||||
public class PrettifyWebView extends NestedWebView {
|
||||
private String content;
|
||||
private OnContentChangedListener onContentChangedListener;
|
||||
private boolean interceptTouch;
|
||||
|
||||
@ -93,7 +91,6 @@ public class PrettifyWebView extends NestedWebView {
|
||||
settings.setDisplayZoomControls(false);
|
||||
settings.setJavaScriptEnabled(true);
|
||||
if (!InputHelper.isEmpty(source)) {
|
||||
this.content = source;
|
||||
String page = PrettifyHelper.generateContent(source);
|
||||
post(() -> loadDataWithBaseURL("file:///android_asset/highlight/", page, "text/html", "utf-8", null));
|
||||
} else Log.e(getClass().getSimpleName(), "Source can't be null or empty.");
|
||||
@ -104,17 +101,14 @@ public class PrettifyWebView extends NestedWebView {
|
||||
}
|
||||
|
||||
public void setGithubContent(@NonNull String source, @Nullable String baseUrl, boolean wrap) {
|
||||
if (!TextUtils.equals(source, content)) {
|
||||
if (wrap) {
|
||||
setScrollbarFadingEnabled(false);
|
||||
setVerticalScrollBarEnabled(false);
|
||||
}
|
||||
if (!InputHelper.isEmpty(source)) {
|
||||
if (!wrap) addJavascriptInterface(new MarkDownInterceptorInterface(this), "Android");
|
||||
this.content = source;
|
||||
String page = GithubHelper.generateContent(source, baseUrl, wrap);
|
||||
post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null));
|
||||
}
|
||||
if (wrap) {
|
||||
setScrollbarFadingEnabled(false);
|
||||
setVerticalScrollBarEnabled(false);
|
||||
}
|
||||
if (!InputHelper.isEmpty(source)) {
|
||||
if (!wrap) addJavascriptInterface(new MarkDownInterceptorInterface(this), "Android");
|
||||
String page = GithubHelper.generateContent(source, baseUrl, wrap);
|
||||
post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,13 +124,6 @@ public class PrettifyWebView extends NestedWebView {
|
||||
loadData(html, "text/html", null);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
if (content != null) {
|
||||
loadUrl("about:blank");
|
||||
setSource(content);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterceptTouch(boolean interceptTouch) {
|
||||
this.interceptTouch = interceptTouch;
|
||||
}
|
||||
|
||||
9
app/src/main/res/drawable/ic_bug.xml
Normal file
9
app/src/main/res/drawable/ic_bug.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/primary_text"
|
||||
android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"/>
|
||||
</vector>
|
||||
@ -10,9 +10,9 @@
|
||||
android:title="@string/app_name"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/feedback"
|
||||
android:icon="@drawable/ic_announcement"
|
||||
android:title="@string/submit_feedback"/>
|
||||
android:id="@+id/about"
|
||||
android:icon="@drawable/ic_info_outline_white_48dp"
|
||||
android:title="@string/about"/>
|
||||
|
||||
|
||||
<item
|
||||
|
||||
@ -12,4 +12,10 @@
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AboutActivity" parent="Theme.Mal.Light.LightActionBar">
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@ -274,8 +274,4 @@
|
||||
<color name="material_yellow_accent_400">#FFEA00</color>
|
||||
<color name="material_yellow_accent_700">#FFD600</color>
|
||||
|
||||
|
||||
<color name="aboutColorPrimary">#FFFFFF</color>
|
||||
<color name="aboutColorDark">#9E9E9E</color>
|
||||
<color name="aboutColorIcon">#616161</color>
|
||||
</resources>
|
||||
|
||||
@ -156,6 +156,7 @@
|
||||
<string name="logout">Logout</string>
|
||||
<string name="thank_you_for_feedback">Thanks for your feedback.</string>
|
||||
<string name="current_version">Current Version</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="support_development_enable_ads">Support development, enable Ads.</string>
|
||||
<string name="username">Username</string>
|
||||
<string name="password">Password</string>
|
||||
@ -242,4 +243,15 @@
|
||||
<string name="private_repo">Private</string>
|
||||
<string name="rect_avatar_summary">Use rounded rectangle instead of circular avatar.</string>
|
||||
<string name="rect_avatar_title">Rectangle Avatar</string>
|
||||
<string name="rate_app">Rate this app</string>
|
||||
<string name="author">Author</string>
|
||||
<string name="fork_github">Fork on GitHub</string>
|
||||
<string name="send_email">Send an email</string>
|
||||
<string name="email_address">kosh20111@gmail.com</string>
|
||||
<string name="question_concerning_fasthub">Question concerning FastHub</string>
|
||||
<string name="feedback">Feedback</string>
|
||||
<string name="report_issue">Report an issue</string>
|
||||
<string name="report_issue_here">Having an issue? Report it here</string>
|
||||
<string name="about">About</string>
|
||||
<string name="notification_settings">Notification Settings</string>
|
||||
</resources>
|
||||
@ -93,10 +93,13 @@
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AboutActivity" parent="Theme.Mal.Light.LightActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/aboutColorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/aboutColorDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="android:colorEdgeEffect">?colorPrimary</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:windowContentTransitions">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/general_settings">
|
||||
<PreferenceCategory android:title="@string/notification_settings">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@string/thirty_minutes"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user