This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from vase4kin/dev
Release 1.2.4
- Loading branch information
Showing
54 changed files
with
1,167 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
app/src/main/java/com/github/vase4kin/teamcityapp/about/AboutFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* Copyright 2016 Andrey Tolpeev | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.github.vase4kin.teamcityapp.about; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
|
||
import com.danielstone.materialaboutlibrary.ConvenienceBuilder; | ||
import com.danielstone.materialaboutlibrary.MaterialAboutFragment; | ||
import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem; | ||
import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction; | ||
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; | ||
import com.danielstone.materialaboutlibrary.model.MaterialAboutList; | ||
import com.github.vase4kin.teamcityapp.BuildConfig; | ||
import com.github.vase4kin.teamcityapp.R; | ||
import com.joanzapata.iconify.IconDrawable; | ||
import com.joanzapata.iconify.fonts.MaterialCommunityIcons; | ||
import com.joanzapata.iconify.fonts.MaterialIcons; | ||
|
||
public class AboutFragment extends MaterialAboutFragment { | ||
|
||
@Override | ||
protected MaterialAboutList getMaterialAboutList(final Context context) { | ||
MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder(); | ||
appCardBuilder.addItem(new MaterialAboutActionItem.Builder() | ||
.text(getString(R.string.version)) | ||
.icon(new IconDrawable(context, MaterialIcons.md_info_outline).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.subText(BuildConfig.VERSION_NAME) | ||
.build()) | ||
.addItem(ConvenienceBuilder.createRateActionItem(context, new IconDrawable(context, MaterialIcons.md_star_border).colorRes(R.color.sub_text_color).sizeDp(24), | ||
getString(R.string.about_app_text_rate_app), null)) | ||
.addItem(new MaterialAboutActionItem.Builder() | ||
.text(R.string.about_app_text_found_issue) | ||
.subText(R.string.about_app_subtext_found_issue) | ||
.icon(new IconDrawable(context, MaterialIcons.md_question_answer).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.setOnClickAction(new MaterialAboutItemOnClickAction() { | ||
@Override | ||
public void onClick() { | ||
Intent intent = new Intent(Intent.ACTION_VIEW); | ||
intent.setData(Uri.parse(getString(R.string.about_app_url_found_issue))); | ||
getActivity().startActivity(intent); | ||
|
||
} | ||
}) | ||
.build()); | ||
|
||
MaterialAboutCard.Builder miscCardBuilder = new MaterialAboutCard.Builder(); | ||
miscCardBuilder | ||
.addItem(new MaterialAboutActionItem.Builder() | ||
.text(R.string.about_app_text_source_code) | ||
.icon(new IconDrawable(context, MaterialCommunityIcons.mdi_github_circle).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.setOnClickAction(new MaterialAboutItemOnClickAction() { | ||
@Override | ||
public void onClick() { | ||
Intent intent = new Intent(Intent.ACTION_VIEW); | ||
intent.setData(Uri.parse(getString(R.string.about_app_url_source_code))); | ||
getActivity().startActivity(intent); | ||
} | ||
}) | ||
.build()) | ||
.addItem(new MaterialAboutActionItem.Builder() | ||
.text(R.string.about_app_text_libraries) | ||
.icon(new IconDrawable(context, MaterialCommunityIcons.mdi_github_circle).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.setOnClickAction(new MaterialAboutItemOnClickAction() { | ||
@Override | ||
public void onClick() { | ||
AboutLibrariesActivity.start(getActivity()); | ||
} | ||
}) | ||
.build()); | ||
|
||
MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder(); | ||
authorCardBuilder.title(R.string.about_app_text_contacts); | ||
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() | ||
.text(R.string.about_app_text_github) | ||
.icon(new IconDrawable(context, MaterialCommunityIcons.mdi_github_circle).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.setOnClickAction(new MaterialAboutItemOnClickAction() { | ||
@Override | ||
public void onClick() { | ||
Intent intent = new Intent(Intent.ACTION_VIEW); | ||
intent.setData(Uri.parse(getString(R.string.about_app_url_github))); | ||
getActivity().startActivity(intent); | ||
|
||
} | ||
}) | ||
.build()) | ||
.addItem(new MaterialAboutActionItem.Builder() | ||
.text(R.string.about_app_text_telegram) | ||
.icon(new IconDrawable(context, MaterialCommunityIcons.mdi_telegram).colorRes(R.color.sub_text_color).sizeDp(24)) | ||
.setOnClickAction(new MaterialAboutItemOnClickAction() { | ||
@Override | ||
public void onClick() { | ||
Intent intent = new Intent(Intent.ACTION_VIEW); | ||
intent.setData(Uri.parse(getString(R.string.about_app_url_telegram))); | ||
getActivity().startActivity(intent); | ||
} | ||
}) | ||
.build()) | ||
.addItem(ConvenienceBuilder.createEmailItem(context, new IconDrawable(context, MaterialIcons.md_email).colorRes(R.color.sub_text_color).sizeDp(24), | ||
getText(R.string.about_app_text_email), true, getString(R.string.about_app_email), getString(R.string.about_app_email_title))); | ||
|
||
return new MaterialAboutList(appCardBuilder.build(), miscCardBuilder.build(), authorCardBuilder.build()); | ||
} | ||
|
||
@Override | ||
protected int getTheme() { | ||
return R.style.AppTheme_MaterialAboutActivity_Fragment; | ||
} | ||
|
||
} |
86 changes: 86 additions & 0 deletions
86
app/src/main/java/com/github/vase4kin/teamcityapp/about/AboutLibrariesActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright 2016 Andrey Tolpeev | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.github.vase4kin.teamcityapp.about; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import com.github.vase4kin.teamcityapp.R; | ||
import com.github.vase4kin.teamcityapp.TeamCityApplication; | ||
import com.github.vase4kin.teamcityapp.about.dagger.DaggerAboutPageComponent; | ||
import com.github.vase4kin.teamcityapp.drawer.dagger.DrawerModule; | ||
import com.github.vase4kin.teamcityapp.drawer.data.DrawerDataManager; | ||
import com.github.vase4kin.teamcityapp.drawer.presenter.DrawerPresenterImpl; | ||
import com.github.vase4kin.teamcityapp.drawer.router.DrawerRouter; | ||
import com.github.vase4kin.teamcityapp.drawer.tracker.DrawerTracker; | ||
import com.github.vase4kin.teamcityapp.drawer.utils.DrawerActivityStartUtils; | ||
import com.github.vase4kin.teamcityapp.drawer.view.DrawerView; | ||
import com.mikepenz.aboutlibraries.LibsBuilder; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* About libraries screen activity | ||
*/ | ||
public class AboutLibrariesActivity extends AppCompatActivity { | ||
|
||
@Inject | ||
DrawerPresenterImpl<DrawerView, DrawerDataManager, DrawerRouter, DrawerTracker> mDrawerPresenter; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_about); | ||
|
||
// Injecting DrawerPresenterImpl to activity | ||
DaggerAboutPageComponent.builder() | ||
.drawerModule(new DrawerModule(this, true, DrawerView.ABOUT)) | ||
.restApiComponent(((TeamCityApplication) getApplication()).getRestApiInjector()) | ||
.build() | ||
.inject(this); | ||
|
||
mDrawerPresenter.onCreate(); | ||
|
||
// About library fragment | ||
Fragment aboutLibrary = new LibsBuilder() | ||
.supportFragment(); | ||
|
||
// Commit fragment to container | ||
getSupportFragmentManager() | ||
.beginTransaction() | ||
.add(R.id.about_library_container, aboutLibrary) | ||
.addToBackStack(null) | ||
.commit(); | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
mDrawerPresenter.onBackButtonPressed(); | ||
} | ||
|
||
/** | ||
* Start About activity with Flag {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} | ||
*/ | ||
public static void start(Activity activity) { | ||
Intent launchIntent = new Intent(activity, AboutLibrariesActivity.class) | ||
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); | ||
DrawerActivityStartUtils.startActivity(launchIntent, activity); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.