├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── agency
│ │ └── techstar
│ │ └── org
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── agency
│ │ │ └── techstar
│ │ │ └── org
│ │ │ ├── AppConfig.java
│ │ │ ├── activity
│ │ │ ├── AboutUsActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── OrgDetailActivity.java
│ │ │ ├── ProjectDetaikActivity.java
│ │ │ ├── SplashActivity.java
│ │ │ └── WebActivity.java
│ │ │ ├── adapter
│ │ │ ├── OrgAdapter.java
│ │ │ └── ProjectAdapter.java
│ │ │ ├── fragments
│ │ │ ├── MapFragment.java
│ │ │ ├── OrgFragment.java
│ │ │ └── ProjectFragment.java
│ │ │ └── utils
│ │ │ ├── FileCache.java
│ │ │ ├── ImageLoader.java
│ │ │ ├── MemoryCache.java
│ │ │ ├── ShakeSensor.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── drawable-v21
│ │ ├── ic_menu_camera.xml
│ │ ├── ic_menu_gallery.xml
│ │ ├── ic_menu_manage.xml
│ │ ├── ic_menu_send.xml
│ │ ├── ic_menu_share.xml
│ │ └── ic_menu_slideshow.xml
│ │ ├── drawable
│ │ ├── corner_radius.xml
│ │ ├── ic_about.xml
│ │ ├── ic_browser.xml
│ │ ├── ic_business.xml
│ │ ├── ic_call.xml
│ │ ├── ic_dashboard_black_24dp.xml
│ │ ├── ic_email.xml
│ │ ├── ic_fb.xml
│ │ ├── ic_home_black_24dp.xml
│ │ ├── ic_image.xml
│ │ ├── ic_like.xml
│ │ ├── ic_news.xml
│ │ ├── ic_notifications_black_24dp.xml
│ │ ├── ic_search.xml
│ │ ├── ic_shake.xml
│ │ ├── ic_share.xml
│ │ ├── large.png
│ │ ├── side_nav_bar.xml
│ │ └── sign.png
│ │ ├── layout
│ │ ├── activity_about_us.xml
│ │ ├── activity_main.xml
│ │ ├── activity_org_detail.xml
│ │ ├── activity_project_detail.xml
│ │ ├── activity_splash.xml
│ │ ├── activity_web.xml
│ │ ├── app_bar_nav.xml
│ │ ├── content_main.xml
│ │ ├── fragment_map.xml
│ │ ├── fragment_organization.xml
│ │ ├── fragment_project.xml
│ │ ├── nav_header_nav.xml
│ │ ├── organization_item.xml
│ │ └── project_item.xml
│ │ ├── menu
│ │ ├── activity_nav_drawer.xml
│ │ ├── nav.xml
│ │ └── navigation.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── searchable.xml
│ └── test
│ └── java
│ └── agency
│ └── techstar
│ └── org
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | ## 1. Purpose
4 |
5 | A primary goal of TechStar Agency is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
6 |
7 | This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
8 |
9 | We invite all those who participate in TechStar Agency to help us create safe and positive experiences for everyone.
10 |
11 | ## 2. Open Source Citizenship
12 |
13 | A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.
14 |
15 | Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.
16 |
17 | If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.
18 |
19 | ## 3. Expected Behavior
20 |
21 | The following behaviors are expected and requested of all community members:
22 |
23 | * Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
24 | * Exercise consideration and respect in your speech and actions.
25 | * Attempt collaboration before conflict.
26 | * Refrain from demeaning, discriminatory, or harassing behavior and speech.
27 | * Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
28 | * Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.
29 |
30 | ## 4. Unacceptable Behavior
31 |
32 | The following behaviors are considered harassment and are unacceptable within our community:
33 |
34 | * Violence, threats of violence or violent language directed against another person.
35 | * Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
36 | * Posting or displaying sexually explicit or violent material.
37 | * Posting or threatening to post other people’s personally identifying information ("doxing").
38 | * Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
39 | * Inappropriate photography or recording.
40 | * Inappropriate physical contact. You should have someone’s consent before touching them.
41 | * Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.
42 | * Deliberate intimidation, stalking or following (online or in person).
43 | * Advocating for, or encouraging, any of the above behavior.
44 | * Sustained disruption of community events, including talks and presentations.
45 |
46 | ## 5. Consequences of Unacceptable Behavior
47 |
48 | Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.
49 |
50 | Anyone asked to stop unacceptable behavior is expected to comply immediately.
51 |
52 | If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).
53 |
54 | ## 6. Reporting Guidelines
55 |
56 | If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. doljko927@gmail.com.
57 |
58 | [Reporting Guidelines](https://github.com/doljko/YellowBook/blob/master/CONTRIBUTING.md)
59 |
60 | Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.
61 |
62 | ## 7. Addressing Grievances
63 |
64 | If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Doljko with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
65 |
66 | [Policy](https://github.com/doljko/YellowBook)
67 |
68 | ## 8. Scope
69 |
70 | We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.
71 |
72 | This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.
73 |
74 | ## 9. Contact info
75 |
76 | doljko927@gmail.com
77 |
78 | ## 10. License and attribution
79 |
80 | This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
81 |
82 | Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
83 |
84 | Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)
85 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Doljinsuren
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Org
2 |
3 | [](https://www.codacy.com/app/tortuvshin/techstar-org?utm_source=github.com&utm_medium=referral&utm_content=techstar-inc/techstar-org&utm_campaign=badger)
4 |
5 | ### Download It
6 |
7 |
8 |
9 |
10 |
11 | ### Screens
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | ### Authors
20 | * [Doljinsuren Enkhbayar](http://github.com/doljko)
21 | * [Turtuvshin Byambaa](http://github.com/tortuvshin)
22 |
23 | ### License
24 |
25 | `MIT License`
26 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion '26.0.2'
6 | defaultConfig {
7 | applicationId "agency.techstar.org"
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | vectorDrawables.useSupportLibrary = true
14 | jackOptions {
15 | enabled true
16 | }
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | compileOptions {
26 | targetCompatibility 1.8
27 | sourceCompatibility 1.8
28 | }
29 | repositories {
30 | maven {
31 | url 'https://maven.google.com'
32 | }
33 | }
34 | }
35 |
36 | dependencies {
37 | compile fileTree(dir: 'libs', include: ['*.jar'])
38 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
39 | exclude group: 'com.android.support', module: 'support-annotations'
40 | })
41 | implementation 'com.android.support:appcompat-v7:26.1.0'
42 | implementation 'com.android.support:design:26.1.0'
43 | implementation 'com.android.support:support-vector-drawable:26.1.0'
44 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
45 | implementation 'com.android.support:support-v4:26.1.0'
46 | implementation 'com.squareup.picasso:picasso:2.5.2'
47 | implementation 'com.nineoldandroids:library:2.4.0'
48 | implementation 'com.daimajia.slider:library:1.1.5@aar'
49 | implementation 'com.android.support:recyclerview-v7:26.1.0'
50 | implementation 'com.android.support:cardview-v7:26.1.0'
51 | implementation 'com.github.clans:fab:1.6.3'
52 | implementation 'com.github.medyo:android-about-page:1.2.1'
53 | implementation 'com.google.android.gms:play-services-maps:11.4.2'
54 | implementation 'com.google.android.gms:play-services-location:11.4.2'
55 | implementation 'com.squareup.okhttp3:okhttp:3.9.0'
56 | implementation 'com.android.support:palette-v7:26.1.0'
57 | testCompile 'junit:junit:4.12'
58 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
59 | }
60 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/agency/techstar/org/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("agency.techstar.yellowbook", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
26 |
30 |
31 |
32 |
33 |
34 |
37 |
38 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
56 |
57 |
60 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/AppConfig.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org;
2 |
3 | /**
4 | * Created by Dolly on 8/1/2017.
5 | */
6 |
7 | public class AppConfig {
8 | public static String AdminPageURL = "https://appbase-api-tortuvshin.c9users.io";
9 | public static String ProjectService = AdminPageURL+"/app/ProjectService.php";
10 | public static String UserService= AdminPageURL+"/app/User.php";
11 | public static String OrgService= AdminPageURL+"/app/OrgService.php";
12 | public static String CategoryService= AdminPageURL+"/app/Category.php";
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/AboutUsActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 | import android.content.res.Configuration;
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.support.v7.app.AppCompatDelegate;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.widget.Toast;
9 | import java.util.Calendar;
10 | import agency.techstar.org.R;
11 | import mehdi.sakout.aboutpage.AboutPage;
12 | import mehdi.sakout.aboutpage.Element;
13 |
14 | public class AboutUsActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | simulateDayNight(/* DAY */ 0);
20 | final String appPackageName = getPackageName();
21 | View aboutPage = new AboutPage(this)
22 | .isRTL(false)
23 | .setImage(R.drawable.ic_image)
24 | .setDescription("Энэхүү Аппликэйшн нь хүүхдийн төлөө үйл ажиллагаа" +
25 | " явуулдаг төрийн болон төрийн бус байгууллагуудтай нэг дороос холбогдоход тусална.")
26 | .addGroup("Холбоо барих")
27 | .addEmail("doljko927@gmail.com","И-мэйл хаяг")
28 | .addWebsite("https://github.com/doljko/YellowBook","Веб хуудас")
29 | .addFacebook("todaybots","Фэйсбүүк холбоос")
30 | .addPlayStore(appPackageName,"Татаж авах")
31 | .addGitHub("doljko","Нээлттэй эх")
32 | .addItem(getCopyRightsElement())
33 | .create();
34 |
35 | setContentView(aboutPage);
36 | }
37 |
38 |
39 | Element getCopyRightsElement() {
40 | Element copyRightsElement = new Element();
41 | final String copyrights = String.format(getString(R.string.copyright), Calendar.getInstance().get(Calendar.YEAR));
42 | copyRightsElement.setTitle(copyrights);
43 | copyRightsElement.setIconDrawable(R.drawable.ic_image);
44 | copyRightsElement.setIconTint(mehdi.sakout.aboutpage.R.color.about_item_icon_color);
45 | copyRightsElement.setIconNightTint(android.R.color.white);
46 | copyRightsElement.setGravity(Gravity.CENTER);
47 | copyRightsElement.setOnClickListener(new View.OnClickListener() {
48 | @Override
49 | public void onClick(View v) {
50 | Toast.makeText(AboutUsActivity.this, copyrights, Toast.LENGTH_SHORT).show();
51 | }
52 | });
53 | return copyRightsElement;
54 | }
55 |
56 | void simulateDayNight(int currentSetting) {
57 | final int DAY = 0;
58 | final int NIGHT = 1;
59 | final int FOLLOW_SYSTEM = 3;
60 |
61 | int currentNightMode = getResources().getConfiguration().uiMode
62 | & Configuration.UI_MODE_NIGHT_MASK;
63 | if (currentSetting == DAY && currentNightMode != Configuration.UI_MODE_NIGHT_NO) {
64 | AppCompatDelegate.setDefaultNightMode(
65 | AppCompatDelegate.MODE_NIGHT_NO);
66 | } else if (currentSetting == NIGHT && currentNightMode != Configuration.UI_MODE_NIGHT_YES) {
67 | AppCompatDelegate.setDefaultNightMode(
68 | AppCompatDelegate.MODE_NIGHT_YES);
69 | } else if (currentSetting == FOLLOW_SYSTEM) {
70 | AppCompatDelegate.setDefaultNightMode(
71 | AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 |
3 | import android.app.FragmentManager;
4 | import android.app.FragmentTransaction;
5 | import android.app.SearchManager;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.graphics.Color;
9 | import android.net.Uri;
10 | import android.os.Bundle;
11 | import android.support.annotation.NonNull;
12 | import android.support.design.widget.BottomNavigationView;
13 | import android.support.v7.widget.SearchView;
14 | import android.support.design.widget.NavigationView;
15 | import android.support.v4.view.GravityCompat;
16 | import android.support.v4.widget.DrawerLayout;
17 | import android.support.v7.app.ActionBarDrawerToggle;
18 | import android.support.v7.app.AppCompatActivity;
19 | import android.support.v7.widget.Toolbar;
20 | import android.util.Log;
21 | import android.view.Menu;
22 | import android.view.MenuItem;
23 |
24 | import java.util.Random;
25 |
26 | import agency.techstar.org.R;
27 | import agency.techstar.org.fragments.MapFragment;
28 | import agency.techstar.org.fragments.OrgFragment;
29 | import agency.techstar.org.fragments.ProjectFragment;
30 | import agency.techstar.org.utils.ShakeSensor;
31 |
32 | public class MainActivity extends AppCompatActivity
33 | implements NavigationView.OnNavigationItemSelectedListener, ShakeSensor.ShakeListener {
34 |
35 | private SearchView searchView;
36 | private MenuItem searchMenuItem;
37 | private Toolbar toolbar;
38 | private ShakeSensor shakeSensor;
39 | private DrawerLayout drawer;
40 | private NavigationView navigationView;
41 | private BottomNavigationView navigation;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_main);
47 | toolbar = (Toolbar) findViewById(R.id.toolbar);
48 | setSupportActionBar(toolbar);
49 |
50 | drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
51 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
52 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
53 | drawer.setDrawerListener(toggle);
54 | toggle.syncState();
55 |
56 | navigationView = (NavigationView) findViewById(R.id.nav_view);
57 | navigationView.setNavigationItemSelectedListener(this);
58 |
59 | navigation = (BottomNavigationView) findViewById(R.id.navigation);
60 | navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
61 |
62 |
63 | FragmentManager manager = getFragmentManager();
64 | FragmentTransaction transaction = manager.beginTransaction();
65 | transaction.replace(R.id.content, ProjectFragment.newInstance()); // newInstance() is a static factory method.
66 | transaction.commit();
67 |
68 | shakeSensor = new ShakeSensor();
69 | shakeSensor.setListener(this);
70 | shakeSensor.init(this);
71 |
72 | }
73 |
74 | @Override
75 | public void onBackPressed() {
76 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
77 | if (drawer.isDrawerOpen(GravityCompat.START)) {
78 | drawer.closeDrawer(GravityCompat.START);
79 | } else {
80 | super.onBackPressed();
81 | }
82 | }
83 |
84 | @Override
85 | public boolean onCreateOptionsMenu(Menu menu) {
86 | // Inflate the menu; this adds items to the action bar if it is present.
87 | getMenuInflater().inflate(R.menu.nav, menu);
88 |
89 | SearchManager searchManager = (SearchManager)
90 | getSystemService(Context.SEARCH_SERVICE);
91 |
92 | searchMenuItem = menu.findItem(R.id.action_search);
93 | searchView = (SearchView) searchMenuItem.getActionView();
94 |
95 | searchView.setSearchableInfo(searchManager.
96 | getSearchableInfo(getComponentName()));
97 | searchView.setSubmitButtonEnabled(true);
98 |
99 | return true;
100 | }
101 |
102 | @Override
103 | public boolean onOptionsItemSelected(MenuItem item) {
104 | // Handle action bar item clicks here. The action bar will
105 | // automatically handle clicks on the Home/Up button, so long
106 | // as you specify a parent activity in AndroidManifest.xml.
107 | int id = item.getItemId();
108 |
109 | //noinspection SimplifiableIfStatement
110 | if (id == R.id.action_search) {
111 | return true;
112 | }
113 |
114 | return super.onOptionsItemSelected(item);
115 | }
116 |
117 | @SuppressWarnings("StatementWithEmptyBody")
118 | @Override
119 | public boolean onNavigationItemSelected(MenuItem item) {
120 | // Handle navigation view item clicks here.
121 | int id = item.getItemId();
122 |
123 | if (id == R.id.shake) {
124 | // Handle the camera action
125 | } else if (id == R.id.about) {
126 | startActivity(new Intent(MainActivity.this, AboutUsActivity.class));
127 |
128 | } else if (id == R.id.like) {
129 | final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
130 | try {
131 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
132 | } catch (android.content.ActivityNotFoundException anfe) {
133 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
134 | }
135 |
136 | } else if (id == R.id.share) {
137 | Intent sendIntent = new Intent();
138 | sendIntent.setAction(Intent.ACTION_SEND);
139 | sendIntent.putExtra(Intent.EXTRA_TEXT,
140 | "Hey check out my app at: https://play.google.com/store/apps/details?id=com.google.android.apps.plus");
141 | sendIntent.setType("text/plain");
142 | startActivity(sendIntent);
143 |
144 | }
145 |
146 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
147 | drawer.closeDrawer(GravityCompat.START);
148 | return true;
149 | }
150 |
151 | private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
152 | = new BottomNavigationView.OnNavigationItemSelectedListener() {
153 |
154 | @Override
155 | public boolean onNavigationItemSelected(@NonNull MenuItem item) {
156 | switch (item.getItemId()) {
157 | case R.id.navigation_home:
158 | FragmentManager manager = getFragmentManager();
159 | FragmentTransaction transaction = manager.beginTransaction();
160 | transaction.replace(R.id.content, ProjectFragment.newInstance()); // newInstance() is a static factory method.
161 | transaction.commit();
162 | return true;
163 | case R.id.navigation_dashboard:
164 | FragmentManager newsManager = getFragmentManager();
165 | FragmentTransaction transaction1 = newsManager.beginTransaction();
166 | transaction1.replace(R.id.content, OrgFragment.newInstance()); // newInstance() is a static factory method.
167 | transaction1.commit();
168 | return true;
169 | case R.id.navigation_notifications:
170 | FragmentManager projectManager = getFragmentManager();
171 | FragmentTransaction transaction2 = projectManager.beginTransaction();
172 | transaction2.replace(R.id.content, MapFragment.newInstance()); // newInstance() is a static factory method.
173 | transaction2.commit();
174 | return true;
175 | }
176 | return false;
177 | }
178 |
179 | };
180 |
181 | @Override
182 | public void onShake() {
183 | Log.e( "shake" ,"hiine");
184 | Random random = new Random();
185 | int r = random.nextInt(256);
186 | int g = random.nextInt(256);
187 | int b = random.nextInt(256);
188 | toolbar.setBackgroundColor(Color.rgb(r,g,b));
189 |
190 | }
191 |
192 | @Override
193 | protected void onResume() {
194 | super.onResume();
195 | shakeSensor.register();
196 | }
197 | @Override
198 | protected void onPause() {
199 | super.onPause();
200 | shakeSensor.deregister();
201 | }
202 | }
203 |
204 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/OrgDetailActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 |
3 | import android.Manifest;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Color;
8 | import android.graphics.drawable.BitmapDrawable;
9 | import android.net.Uri;
10 | import android.os.Bundle;
11 | import android.os.Handler;
12 | import android.os.Looper;
13 | import android.support.design.widget.CollapsingToolbarLayout;
14 | import android.support.design.widget.CoordinatorLayout;
15 | import android.support.design.widget.FloatingActionButton;
16 | import android.support.v4.app.ActivityCompat;
17 | import android.support.v7.app.AppCompatActivity;
18 | import android.support.v7.graphics.Palette;
19 | import android.support.v7.widget.Toolbar;
20 | import android.util.Log;
21 | import android.view.MenuItem;
22 | import android.view.View;
23 | import android.webkit.WebView;
24 | import android.widget.ImageView;
25 | import android.widget.TextView;
26 |
27 | import com.google.android.gms.maps.GoogleMap;
28 | import com.google.android.gms.maps.MapView;
29 | import com.google.android.gms.maps.OnMapReadyCallback;
30 | import com.google.android.gms.maps.SupportMapFragment;
31 | import com.squareup.picasso.Picasso;
32 |
33 | import org.json.JSONArray;
34 |
35 | import java.io.IOException;
36 |
37 | import agency.techstar.org.AppConfig;
38 | import agency.techstar.org.R;
39 | import okhttp3.Call;
40 | import okhttp3.Callback;
41 | import okhttp3.FormBody;
42 | import okhttp3.OkHttpClient;
43 | import okhttp3.Request;
44 | import okhttp3.RequestBody;
45 | import okhttp3.Response;
46 |
47 |
48 | public class OrgDetailActivity extends AppCompatActivity implements OnMapReadyCallback {
49 |
50 | ImageView imgPreview;
51 | TextView txtText, txtSubText;
52 | WebView txtDescription;
53 | TextView txtAlert;
54 | CoordinatorLayout coordinatorLayout;
55 | Handler mHandler;
56 | String Organization_image, Organization_name, Organization_about, Organization_phone, Organization_email, Organization_Web, Organization_Fb, Organization_Location;
57 | MapView mapView;
58 | private GoogleMap googleMap;
59 |
60 | @Override
61 | protected void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | setContentView(R.layout.activity_org_detail);
64 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
65 | setSupportActionBar(toolbar);
66 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
67 | CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
68 | collapsingToolbar.setTitle("");
69 |
70 | imgPreview = (ImageView) findViewById(R.id.imgPreview);
71 | txtText = (TextView) findViewById(R.id.txtText);
72 | txtSubText = (TextView) findViewById(R.id.txtSubText);
73 |
74 | txtDescription = (WebView) findViewById(R.id.txtDescription);
75 | coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content);
76 | mHandler = new Handler(Looper.getMainLooper());
77 |
78 | FloatingActionButton webbutton = (FloatingActionButton) findViewById(R.id.btnWeb);
79 | FloatingActionButton callbutton = (FloatingActionButton) findViewById(R.id.btnCall);
80 | FloatingActionButton emailbutton = (FloatingActionButton) findViewById(R.id.btnEmail);
81 | FloatingActionButton fbbutton = (FloatingActionButton) findViewById(R.id.btnAdd);
82 |
83 | Intent iGet = getIntent();
84 | String org_id = iGet.getStringExtra("org_id");
85 | // Байгууллагын мэдээллийг API аас унших функц
86 | getOrganization();
87 |
88 | webbutton.setOnClickListener(new View.OnClickListener() {
89 |
90 | @Override
91 | public void onClick(View v) {
92 | Intent web = new Intent(OrgDetailActivity.this, WebActivity.class);
93 | web.putExtra("org_web", Organization_Web);
94 | startActivity(web);
95 | }
96 | });
97 |
98 | callbutton.setOnClickListener(new View.OnClickListener() {
99 |
100 | @Override
101 | public void onClick(View v) {
102 | Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Organization_phone));
103 | if (ActivityCompat.checkSelfPermission(OrgDetailActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
104 |
105 | return;
106 | }
107 | startActivity(intent);
108 | }
109 | });
110 | emailbutton.setOnClickListener(new View.OnClickListener() {
111 |
112 | @Override
113 | public void onClick(View v) {
114 | Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
115 | "mailto",Organization_email, null));
116 | emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Гарчиг");
117 | emailIntent.putExtra(Intent.EXTRA_TEXT, "Техт");
118 | startActivity(Intent.createChooser(emailIntent, "Таны и-мэйл илгээгдэж байна..."));
119 | }
120 | });
121 |
122 | fbbutton.setOnClickListener(new View.OnClickListener() {
123 |
124 | @Override
125 | public void onClick(View v) {
126 | Intent web = new Intent(OrgDetailActivity.this, WebActivity.class);
127 | web.putExtra("org_web", Organization_Fb);
128 | startActivity(web);
129 | }
130 | });
131 |
132 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
133 | .findFragmentById(R.id.mapFragment);
134 |
135 | mapFragment.getMapAsync(this);
136 |
137 | }
138 |
139 | @Override
140 | public boolean onOptionsItemSelected(MenuItem item) {
141 | switch (item.getItemId()) {
142 | case android.R.id.home:
143 | finish();
144 | return true;
145 | default:
146 | return super.onOptionsItemSelected(item);
147 | }
148 | }
149 |
150 | public void getOrganization() {
151 |
152 | Intent iGet = getIntent();
153 |
154 | String uri = AppConfig.OrgService;
155 |
156 | RequestBody formBody = new FormBody.Builder()
157 | .add("org_id", iGet.getStringExtra("org_id"))
158 | .build();
159 |
160 | Log.e("Дуудсан холбоос: ", uri);
161 | OkHttpClient client = new OkHttpClient();
162 | Request request = new Request.Builder()
163 | .url(uri)
164 | .post(formBody)
165 | .build();
166 |
167 | Log.e("Request: ", request.toString());
168 |
169 | client.newCall(request).enqueue(new Callback() {
170 | @Override
171 | public void onFailure(Call call, IOException e) {
172 | Log.e("Request Error ", "Алдаа:" + e.getMessage());
173 | }
174 |
175 | @Override
176 | public void onResponse(Call call, final Response response) throws IOException {
177 | final String res = response.body().string();
178 |
179 | Log.e("Res: ", "" + res);
180 | mHandler.post(() -> {
181 | try {
182 | JSONArray data = new JSONArray(res);
183 | for (int i = 0; i < data.length(); i++) {
184 | Organization_image = data.getJSONObject(i).getString("org_image");
185 | Organization_name = data.getJSONObject(i).getString("org_name");
186 | Organization_about = data.getJSONObject(i).getString("org_about");
187 | Organization_phone = data.getJSONObject(i).getString("org_phone");
188 | Organization_email = data.getJSONObject(i).getString("org_email");
189 | Organization_Web = data.getJSONObject(i).getString("org_web");
190 | Organization_Fb = data.getJSONObject(i).getString("org_fb");
191 | Organization_Location = data.getJSONObject(i).getString("org_location");
192 | }
193 | coordinatorLayout.setVisibility(View.VISIBLE);
194 | Picasso.with(getApplicationContext()).load(AppConfig.AdminPageURL + "/"+ Organization_image).placeholder(R.drawable.ic_image).into(imgPreview, new com.squareup.picasso.Callback() {
195 | @Override
196 | public void onSuccess() {
197 | Bitmap bitmap = ((BitmapDrawable) imgPreview.getDrawable()).getBitmap();
198 | Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
199 | @Override
200 | public void onGenerated(Palette palette) {
201 | }
202 | });
203 | }
204 |
205 | @Override
206 | public void onError() {
207 |
208 | }
209 | });
210 |
211 | txtText.setText(Organization_name);
212 | txtDescription.loadDataWithBaseURL("", Organization_about, "text/html", "UTF-8", "");
213 | txtDescription.setBackgroundColor(Color.parseColor("#ffffff"));
214 | txtDescription.getSettings().setDefaultTextEncodingName("UTF-8");
215 |
216 | } catch (Exception ex) {
217 | ex.printStackTrace();
218 | }
219 |
220 | });
221 | }
222 | });
223 | }
224 |
225 | @Override
226 | public void onMapReady(GoogleMap map) {
227 |
228 | googleMap = map;
229 |
230 | setUpMap();
231 |
232 | }
233 |
234 | public void setUpMap() {
235 |
236 | googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
237 | if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
238 |
239 | return;
240 | }
241 | googleMap.setMyLocationEnabled(true);
242 | googleMap.setTrafficEnabled(true);
243 | googleMap.setIndoorEnabled(true);
244 | googleMap.setBuildingsEnabled(true);
245 | googleMap.getUiSettings().setZoomControlsEnabled(true);
246 | }
247 | }
248 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/ProjectDetaikActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 |
3 | import android.Manifest;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Color;
8 | import android.graphics.drawable.BitmapDrawable;
9 | import android.net.Uri;
10 | import android.os.Bundle;
11 | import android.os.Handler;
12 | import android.os.Looper;
13 | import android.support.design.widget.CollapsingToolbarLayout;
14 | import android.support.design.widget.CoordinatorLayout;
15 | import android.support.design.widget.FloatingActionButton;
16 | import android.support.v4.app.ActivityCompat;
17 | import android.support.v7.app.AppCompatActivity;
18 | import android.support.v7.graphics.Palette;
19 | import android.support.v7.widget.Toolbar;
20 | import android.util.Log;
21 | import android.view.MenuItem;
22 | import android.view.View;
23 | import android.webkit.WebView;
24 | import android.widget.ImageView;
25 | import android.widget.TextView;
26 |
27 | import com.google.android.gms.maps.GoogleMap;
28 | import com.google.android.gms.maps.MapView;
29 | import com.google.android.gms.maps.OnMapReadyCallback;
30 | import com.google.android.gms.maps.SupportMapFragment;
31 | import com.squareup.picasso.Picasso;
32 |
33 | import org.json.JSONArray;
34 |
35 | import java.io.IOException;
36 |
37 | import agency.techstar.org.AppConfig;
38 | import agency.techstar.org.R;
39 | import okhttp3.Call;
40 | import okhttp3.Callback;
41 | import okhttp3.FormBody;
42 | import okhttp3.OkHttpClient;
43 | import okhttp3.Request;
44 | import okhttp3.RequestBody;
45 | import okhttp3.Response;
46 |
47 |
48 | public class ProjectDetaikActivity extends AppCompatActivity implements OnMapReadyCallback {
49 |
50 | ImageView imgPreview;
51 | TextView txtText, txtSubText;
52 | WebView txtDescription;
53 | TextView txtAlert;
54 | CoordinatorLayout coordinatorLayout;
55 | Handler mHandler;
56 | String Project_image, Project_name, Project_about, Project_phone, Project_email, Project_Web, Project_fb;
57 | MapView mapView;
58 | private GoogleMap googleMap;
59 |
60 | @Override
61 | protected void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | setContentView(R.layout.activity_project_detail);
64 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
65 | setSupportActionBar(toolbar);
66 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
67 | CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
68 | collapsingToolbar.setTitle("");
69 |
70 | imgPreview = (ImageView) findViewById(R.id.imgPreview);
71 | txtText = (TextView) findViewById(R.id.txtText);
72 | txtSubText = (TextView) findViewById(R.id.txtSubText);
73 |
74 | txtDescription = (WebView) findViewById(R.id.txtDescription);
75 | coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content);
76 | mHandler = new Handler(Looper.getMainLooper());
77 | FloatingActionButton webbutton = (FloatingActionButton) findViewById(R.id.btnWeb);
78 | FloatingActionButton callbutton = (FloatingActionButton) findViewById(R.id.btnCall);
79 | FloatingActionButton emailbutton = (FloatingActionButton) findViewById(R.id.btnEmail);
80 | FloatingActionButton fbbutton = (FloatingActionButton) findViewById(R.id.btnAdd);
81 |
82 | webbutton.setOnClickListener(new View.OnClickListener() {
83 | @Override
84 | public void onClick(View v) {
85 | startActivity(new Intent(ProjectDetaikActivity.this, WebActivity.class));
86 | }
87 | });
88 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
89 | .findFragmentById(R.id.mapFragment);
90 |
91 | mapFragment.getMapAsync(this);
92 |
93 | getProduct();
94 |
95 | webbutton.setOnClickListener(new View.OnClickListener() {
96 |
97 | @Override
98 | public void onClick(View v) {
99 | Intent web = new Intent(ProjectDetaikActivity.this, WebActivity.class);
100 | web.putExtra("org_web", Project_Web);
101 | startActivity(web);
102 | }
103 | });
104 |
105 | callbutton.setOnClickListener(new View.OnClickListener() {
106 |
107 | @Override
108 | public void onClick(View v) {
109 | Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Project_phone));
110 | if (ActivityCompat.checkSelfPermission(ProjectDetaikActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
111 | // TODO: Consider calling
112 | // ActivityCompat#requestPermissions
113 | // here to request the missing permissions, and then overriding
114 | // public void onRequestPermissionsResult(int requestCode, String[] permissions,
115 | // int[] grantResults)
116 | // to handle the case where the user grants the permission. See the documentation
117 | // for ActivityCompat#requestPermissions for more details.
118 | return;
119 | }
120 | startActivity(intent);
121 | }
122 | });
123 | emailbutton.setOnClickListener(new View.OnClickListener() {
124 |
125 | @Override
126 | public void onClick(View v) {
127 | Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
128 | "mailto",Project_email, null));
129 | emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Гарчиг");
130 | emailIntent.putExtra(Intent.EXTRA_TEXT, "Техт");
131 | startActivity(Intent.createChooser(emailIntent, "Таны и-мэйл илгээгдэж байна..."));
132 | }
133 | });
134 |
135 | fbbutton.setOnClickListener(new View.OnClickListener() {
136 |
137 | @Override
138 | public void onClick(View v) {
139 | Intent web = new Intent(ProjectDetaikActivity.this, WebActivity.class);
140 | web.putExtra("org_web", Project_fb);
141 | startActivity(web);
142 | }
143 | });
144 | }
145 |
146 | @Override
147 | public boolean onOptionsItemSelected(MenuItem item) {
148 | switch (item.getItemId()) {
149 | case android.R.id.home:
150 | finish();
151 | return true;
152 | default:
153 | return super.onOptionsItemSelected(item);
154 | }
155 | }
156 |
157 | public void getProduct() {
158 |
159 | Intent iGet = getIntent();
160 |
161 | String uri = AppConfig.ProjectService;
162 |
163 | RequestBody formBody = new FormBody.Builder()
164 | .add("project_id", iGet.getStringExtra("project_id"))
165 | .build();
166 |
167 | Log.e("Дуудсан холбоос: ", uri);
168 | OkHttpClient client = new OkHttpClient();
169 | Request request = new Request.Builder()
170 | .url(uri)
171 | .post(formBody)
172 | .build();
173 |
174 | Log.e("Request: ", request.toString());
175 |
176 | client.newCall(request).enqueue(new Callback() {
177 | @Override
178 | public void onFailure(Call call, IOException e) {
179 | Log.e("Request Error ", "Алдаа:" + e.getMessage());
180 | }
181 |
182 | @Override
183 | public void onResponse(Call call, final Response response) throws IOException {
184 | final String res = response.body().string();
185 |
186 | Log.e("Res: ", "" + res);
187 |
188 | mHandler.post(() -> {
189 | try {
190 | JSONArray data = new JSONArray(res);
191 | for (int i = 0; i < data.length(); i++) {
192 | Project_image = data.getJSONObject(i).getString("project_image");
193 | Project_name = data.getJSONObject(i).getString("project_name");
194 | Project_about = data.getJSONObject(i).getString("project_about");
195 | Project_phone = data.getJSONObject(i).getString("project_phone");
196 | Project_email = data.getJSONObject(i).getString("project_email");
197 | Project_Web = data.getJSONObject(i).getString("project_web");
198 | Project_fb = data.getJSONObject(i).getString("project_fb");
199 | }
200 |
201 | coordinatorLayout.setVisibility(View.VISIBLE);
202 | Picasso.with(getApplicationContext()).load(AppConfig.AdminPageURL + "/" +Project_image).placeholder(R.drawable.ic_image).into(imgPreview, new com.squareup.picasso.Callback() {
203 | @Override
204 | public void onSuccess() {
205 | Bitmap bitmap = ((BitmapDrawable) imgPreview.getDrawable()).getBitmap();
206 | Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
207 | @Override
208 | public void onGenerated(Palette palette) {
209 | }
210 | });
211 | }
212 |
213 | @Override
214 | public void onError() {
215 |
216 | }
217 | });
218 |
219 | txtText.setText(Project_name);
220 | txtDescription.loadDataWithBaseURL("", Project_about, "text/html", "UTF-8", "");
221 | txtDescription.setBackgroundColor(Color.parseColor("#ffffff"));
222 | txtDescription.getSettings().setDefaultTextEncodingName("UTF-8");
223 |
224 | } catch (Exception ex) {
225 | ex.printStackTrace();
226 | }
227 |
228 | });
229 | }
230 | });
231 | }
232 |
233 | @Override
234 | public void onMapReady(GoogleMap map) {
235 |
236 | googleMap = map;
237 |
238 | setUpMap();
239 |
240 | }
241 |
242 | public void setUpMap() {
243 |
244 | googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
245 | if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
246 |
247 | return;
248 | }
249 | googleMap.setMyLocationEnabled(true);
250 | googleMap.setTrafficEnabled(true);
251 | googleMap.setIndoorEnabled(true);
252 | googleMap.setBuildingsEnabled(true);
253 | googleMap.getUiSettings().setZoomControlsEnabled(true);
254 | }
255 | }
256 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import agency.techstar.org.R;
8 |
9 | public class SplashActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_splash);
15 | try {
16 | Thread timerThread = new Thread(){
17 | public void run(){
18 | try{
19 | sleep(2000);
20 | }catch(InterruptedException e){
21 | e.printStackTrace();
22 | }finally{
23 | Intent intent = new Intent(SplashActivity.this,MainActivity.class);
24 | startActivity(intent);
25 | finish();
26 | }
27 | }
28 | };
29 | timerThread.start();
30 | }catch (Exception e){
31 |
32 | }
33 | }
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/activity/WebActivity.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.webkit.WebView;
7 | import android.webkit.WebViewClient;
8 |
9 | import agency.techstar.org.R;
10 |
11 | public class WebActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_web);
17 | Intent iGet = getIntent();
18 | String org_web = iGet.getStringExtra("org_web");
19 | WebView webb = (WebView)findViewById(R.id.web);
20 | webb.setWebViewClient(new WebViewClient());
21 | webb.loadUrl(org_web);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/adapter/OrgAdapter.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.support.v7.widget.AppCompatImageView;
6 | import android.util.Log;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.BaseAdapter;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import org.json.JSONArray;
15 | import org.json.JSONException;
16 |
17 | import agency.techstar.org.AppConfig;
18 | import agency.techstar.org.R;
19 | import agency.techstar.org.activity.OrgDetailActivity;
20 | import agency.techstar.org.utils.ImageLoader;
21 |
22 | /**
23 | * Created by Dolly on 8/1/2017.
24 | */
25 |
26 | public class OrgAdapter extends BaseAdapter {
27 |
28 | final Context context;
29 | final JSONArray organizations;
30 | public ImageLoader imageLoader;
31 |
32 | private LayoutInflater inflater = null;
33 |
34 | public OrgAdapter(Context context, JSONArray organizations) {
35 | this.context = context;
36 | this.organizations = organizations;
37 | imageLoader = new ImageLoader(context);
38 | inflater = (LayoutInflater) context
39 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
40 | }
41 |
42 | @Override
43 | public int getCount() {
44 | return organizations.length();
45 | }
46 |
47 | @Override
48 | public Object getItem(int position) {
49 | try {
50 | return organizations.getJSONObject(position);
51 | } catch (JSONException e){
52 | e.printStackTrace();
53 | }
54 | return null;
55 | }
56 |
57 | @Override
58 | public long getItemId(int position) {
59 | return position;
60 | }
61 |
62 | @Override
63 | public View getView(final int position, View convertView, ViewGroup parent) {
64 | View vi = convertView;
65 | if(vi == null)
66 | vi = inflater.inflate(R.layout.organization_item, null);
67 |
68 | TextView pName = (TextView) vi.findViewById(R.id.textOrg);
69 | AppCompatImageView pImage = (AppCompatImageView) vi.findViewById(R.id.imgOrg);
70 |
71 |
72 | try {
73 | pName.setText(organizations.getJSONObject(position).getString("org_name"));
74 | imageLoader.DisplayImage(AppConfig.AdminPageURL+"/"+organizations.getJSONObject(position).getString("org_image"), pImage);
75 | vi.setOnClickListener(new View.OnClickListener() {
76 | @Override
77 | public void onClick(View view) {
78 | Intent iDetail = new Intent(context, OrgDetailActivity.class);
79 | try {
80 | Toast.makeText(context, organizations.getJSONObject(position).getString("org_name"), Toast.LENGTH_SHORT).show();
81 | iDetail.putExtra("org_id", organizations.getJSONObject(position).getString("org_id"));
82 | } catch (JSONException e) {
83 | e.printStackTrace();
84 | }
85 | context.startActivity(iDetail);
86 | }
87 | });
88 | } catch (JSONException e) {
89 | e.printStackTrace();
90 | Log.e("ERROR", e.getMessage());
91 | }
92 | return vi;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/adapter/ProjectAdapter.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.adapter;
2 | import android.content.Context;
3 | import android.content.Intent;
4 | import android.support.v7.widget.AppCompatImageView;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseAdapter;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import org.json.JSONArray;
14 | import org.json.JSONException;
15 |
16 | import agency.techstar.org.AppConfig;
17 | import agency.techstar.org.R;
18 | import agency.techstar.org.activity.ProjectDetaikActivity;
19 | import agency.techstar.org.utils.ImageLoader;
20 |
21 | public class ProjectAdapter extends BaseAdapter{
22 |
23 | final Context context;
24 | final JSONArray projects;
25 | public ImageLoader imageLoader;
26 |
27 |
28 | LayoutInflater inflater = null;
29 | public ProjectAdapter(Context context, JSONArray projects) {
30 | this.context = context;
31 | this.projects = projects;
32 | imageLoader = new ImageLoader(context);
33 | inflater = (LayoutInflater) context
34 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
35 | }
36 |
37 | @Override
38 | public int getCount() {
39 | return projects.length();
40 | }
41 |
42 | @Override
43 | public Object getItem(int position) {
44 | try {
45 | return projects.getJSONObject(position);
46 | } catch (JSONException e){
47 | e.printStackTrace();
48 | }
49 | return null;
50 | }
51 |
52 | @Override
53 | public long getItemId(int position) {
54 | return position;
55 | }
56 |
57 | @Override
58 | public View getView(final int position, View convertView, ViewGroup parent) {
59 | View vi = convertView;
60 | if(vi == null)
61 | vi = inflater.inflate(R.layout.project_item, null);
62 |
63 | TextView pName = (TextView) vi.findViewById(R.id.textViewG);
64 | AppCompatImageView pImage = (AppCompatImageView) vi.findViewById(R.id.imageViewG);
65 |
66 |
67 | try {
68 | pName.setText(projects.getJSONObject(position).getString("project_name"));
69 | imageLoader.DisplayImage(AppConfig.AdminPageURL+"/"+projects.getJSONObject(position).getString("project_image"), pImage);
70 | vi.setOnClickListener(new View.OnClickListener() {
71 | @Override
72 | public void onClick(View view) {
73 | Intent iDetail = new Intent(context, ProjectDetaikActivity.class);
74 | try {
75 | Toast.makeText(context, projects.getJSONObject(position).getString("project_name"), Toast.LENGTH_SHORT).show();
76 | iDetail.putExtra("project_id", projects.getJSONObject(position).getString("project_id"));
77 | } catch (JSONException e) {
78 | e.printStackTrace();
79 | }
80 | context.startActivity(iDetail);
81 | }
82 | });
83 | } catch (JSONException e) {
84 | e.printStackTrace();
85 | Log.e("ERROR", e.getMessage());
86 | }
87 | return vi;
88 | }
89 |
90 | }
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/fragments/MapFragment.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.google.android.gms.maps.CameraUpdateFactory;
10 | import com.google.android.gms.maps.GoogleMap;
11 | import com.google.android.gms.maps.MapView;
12 | import com.google.android.gms.maps.MapsInitializer;
13 | import com.google.android.gms.maps.OnMapReadyCallback;
14 | import com.google.android.gms.maps.model.CameraPosition;
15 | import com.google.android.gms.maps.model.LatLng;
16 | import com.google.android.gms.maps.model.MarkerOptions;
17 |
18 | import agency.techstar.org.R;
19 |
20 | public class MapFragment extends Fragment {
21 | MapView mMapView;
22 | private GoogleMap googleMap;
23 |
24 | public static MapFragment newInstance() {
25 | MapFragment fragment = new MapFragment();
26 | Bundle args = new Bundle();
27 | fragment.setArguments(args);
28 |
29 | return fragment;
30 | }
31 |
32 | @Override
33 | public void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 |
36 | }
37 |
38 | @Override
39 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
40 | View rootView = inflater.inflate(R.layout.fragment_map, container, false);
41 |
42 | mMapView = (MapView) rootView.findViewById(R.id.mapView);
43 | mMapView.onCreate(savedInstanceState);
44 |
45 | mMapView.onResume(); // needed to get the map to display immediately
46 |
47 | try {
48 | MapsInitializer.initialize(getActivity().getApplicationContext());
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | }
52 |
53 | mMapView.getMapAsync(new OnMapReadyCallback() {
54 | @Override
55 | public void onMapReady(GoogleMap mMap) {
56 | googleMap = mMap;
57 |
58 | // For dropping a marker at a point on the Map
59 | LatLng sydney = new LatLng(-34, 151);
60 | googleMap.addMarker(new MarkerOptions().position(sydney).title("Marker Title").snippet("Marker Description"));
61 |
62 | // For zooming automatically to the location of the marker
63 | CameraPosition cameraPosition = new CameraPosition.Builder().target(sydney).zoom(12).build();
64 | googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
65 | }
66 | });
67 |
68 | return rootView;
69 | }
70 |
71 | @Override
72 | public void onResume() {
73 | super.onResume();
74 | mMapView.onResume();
75 | }
76 |
77 | @Override
78 | public void onPause() {
79 | super.onPause();
80 | mMapView.onPause();
81 | }
82 |
83 | @Override
84 | public void onDestroy() {
85 | super.onDestroy();
86 | mMapView.onDestroy();
87 | }
88 |
89 | @Override
90 | public void onLowMemory() {
91 | super.onLowMemory();
92 | mMapView.onLowMemory();
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/fragments/OrgFragment.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.app.Fragment;
5 | import android.os.Handler;
6 | import android.os.Looper;
7 | import android.util.Log;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.GridView;
12 | import android.widget.ProgressBar;
13 | import android.widget.TextView;
14 |
15 | import java.io.IOException;
16 |
17 | import org.json.JSONArray;
18 | import org.json.JSONException;
19 | import org.json.JSONObject;
20 |
21 | import agency.techstar.org.AppConfig;
22 | import agency.techstar.org.adapter.OrgAdapter;
23 | import agency.techstar.org.R;
24 | import okhttp3.Call;
25 | import okhttp3.Callback;
26 | import okhttp3.OkHttpClient;
27 | import okhttp3.Request;
28 | import okhttp3.Response;
29 | public class OrgFragment extends Fragment {
30 |
31 | private static final String TAG = OrgFragment.class.getSimpleName();
32 | private static View rootView;
33 |
34 | private GridView homeItemList;
35 | private ProgressBar prgLoading;
36 | private TextView txtAlert;
37 | private Handler mHandler;
38 |
39 | public static OrgFragment newInstance() {
40 | OrgFragment fragment = new OrgFragment();
41 | Bundle args = new Bundle();
42 | return fragment;
43 | }
44 |
45 | @Override
46 | public void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | }
49 |
50 | @Override
51 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
52 | Bundle savedInstanceState) {
53 | rootView = inflater.inflate(R.layout.fragment_organization, container, false);
54 | prgLoading = (ProgressBar) rootView.findViewById(R.id.newsLoading);
55 | homeItemList = (GridView) rootView.findViewById(R.id.newsItemList);
56 | txtAlert = (TextView) rootView.findViewById(R.id.newsTxtAlert);
57 |
58 | mHandler = new Handler(Looper.getMainLooper());
59 |
60 | homeItemList.setNumColumns(2);
61 |
62 | homeItemList.setVisibility(View.VISIBLE);
63 |
64 | getNews();
65 |
66 | return rootView;
67 |
68 | }
69 |
70 | public void getNews () {
71 | prgLoading.setVisibility(View.VISIBLE);
72 | String uri = AppConfig.OrgService;
73 |
74 | OkHttpClient client = new OkHttpClient();
75 | Request request = new Request.Builder()
76 | .url(uri)
77 | .build();
78 |
79 | Log.e(TAG , request.toString());
80 |
81 | client.newCall(request).enqueue(new Callback() {
82 | @Override
83 | public void onFailure(Call call, IOException e) {
84 | Log.e(TAG, "Алдаа:" + e.getMessage());
85 | }
86 |
87 | @Override
88 | public void onResponse(Call call, Response response) throws IOException {
89 | final String res = response.body().string();
90 | mHandler.post(() -> {
91 | try {
92 | JSONObject prod = new JSONObject(String.valueOf("{org=" + res+"}"));
93 | JSONArray prodItems = prod.getJSONArray("org");
94 | Log.e(TAG, prodItems + "");
95 | prgLoading.setVisibility(View.GONE);
96 | homeItemList.setAdapter(new OrgAdapter(getActivity(), prodItems));
97 | } catch (JSONException ex){
98 | ex.printStackTrace();
99 | }
100 | });
101 | }
102 | });
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/fragments/ProjectFragment.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.fragments;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.app.Fragment;
6 | import android.os.Handler;
7 | import android.os.Looper;
8 | import android.util.Log;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.GridView;
13 |
14 | import com.daimajia.slider.library.Animations.DescriptionAnimation;
15 | import com.daimajia.slider.library.SliderLayout;
16 | import com.daimajia.slider.library.SliderTypes.BaseSliderView;
17 | import com.daimajia.slider.library.SliderTypes.TextSliderView;
18 |
19 | import org.json.JSONArray;
20 | import org.json.JSONException;
21 | import org.json.JSONObject;
22 |
23 | import java.io.IOException;
24 | import java.util.HashMap;
25 |
26 | import agency.techstar.org.AppConfig;
27 | import agency.techstar.org.adapter.ProjectAdapter;
28 | import agency.techstar.org.R;
29 | import okhttp3.Call;
30 | import okhttp3.Callback;
31 | import okhttp3.OkHttpClient;
32 | import okhttp3.Request;
33 | import okhttp3.Response;
34 |
35 | public class ProjectFragment extends Fragment {
36 |
37 | private SliderLayout mDemoSlider;
38 | Context context;
39 | View view;
40 | private Handler mHandler;
41 |
42 | public static ProjectFragment newInstance() {
43 | ProjectFragment fragment = new ProjectFragment();
44 | Bundle args = new Bundle();
45 | fragment.setArguments(args);
46 | return fragment;
47 | }
48 | GridView simpleList;
49 | @Override
50 | public void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | }
53 |
54 | @Override
55 | public View onCreateView(final LayoutInflater inflater, ViewGroup container,
56 | Bundle savedInstanceState) {
57 | view = inflater.inflate(R.layout.fragment_project, container, false);
58 | // Inflate the layout for this fragment
59 | mDemoSlider = (SliderLayout) view.findViewById(R.id.slider);
60 | simpleList = (GridView) view.findViewById(R.id.simpleGridView);
61 |
62 | mHandler = new Handler(Looper.getMainLooper()); // udaan hurdanii shalgax davtalt
63 |
64 | HashMap url_maps = new HashMap();
65 | url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://www.colourbox.com/preview/1282705-colorful-child-hand-prints-on-white-background.jpg");
66 | url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://image.freepik.com/free-vector/fantastic-background-of-children-playing-together_23-2147608068.jpg");
67 | url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://ak2.picdn.net/shutterstock/videos/14967505/thumb/1.jpg");
68 |
69 | for(String name : url_maps.keySet()){
70 |
71 | TextSliderView textSliderView = new TextSliderView(getActivity());
72 | // initialize a SliderLayout
73 | textSliderView
74 | .description(name)
75 | .image(url_maps.get(name))
76 | .setScaleType(BaseSliderView.ScaleType.Fit);
77 | // .setOnSliderClickListener(getContext());
78 |
79 | //add your extra information
80 | textSliderView.bundle(new Bundle());
81 | textSliderView.getBundle()
82 | .putString("extra",name);
83 |
84 | mDemoSlider.addSlider(textSliderView);
85 |
86 | }
87 | mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
88 | mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
89 | mDemoSlider.setCustomAnimation(new DescriptionAnimation());
90 | mDemoSlider.setDuration(4000);
91 |
92 | simpleList.setNumColumns(2);
93 | simpleList.setVisibility(View.VISIBLE);
94 |
95 | getProject();
96 |
97 | return view;
98 |
99 | }
100 |
101 | private void getProject() {
102 | String uri = AppConfig.ProjectService;
103 |
104 | OkHttpClient client = new OkHttpClient();
105 | Request request = new Request.Builder()
106 | .url(uri)
107 | .build();
108 |
109 | Log.e("" , request.toString());
110 |
111 | client.newCall(request).enqueue(new Callback() {
112 | @Override
113 | public void onFailure(Call call, IOException e) {
114 | Log.e("", "Алдаа:" + e.getMessage());
115 | }
116 |
117 | @Override
118 | public void onResponse(Call call, Response response) throws IOException {
119 | final String res = response.body().string();
120 | mHandler.post(() -> {
121 | try {
122 | JSONObject prod = new JSONObject(String.valueOf("{project=" + res+"}"));
123 | JSONArray prodItems = prod.getJSONArray("project");
124 | Log.e("", prodItems + "");
125 | simpleList.setAdapter(new ProjectAdapter(getActivity(), prodItems));
126 | } catch (JSONException ex){
127 | ex.printStackTrace();
128 | }
129 | });
130 | }
131 | });
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/utils/FileCache.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.utils;
2 | import android.content.Context;
3 |
4 | import java.io.File;
5 |
6 | public class FileCache {
7 |
8 | private File cacheDir;
9 |
10 | public FileCache(Context context){
11 |
12 | if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))
13 | cacheDir=new File(android.os.Environment.getExternalStorageDirectory(),"Cache dgl");
14 | else
15 | cacheDir=context.getCacheDir();
16 | if(!cacheDir.exists())
17 | cacheDir.mkdirs();
18 | }
19 |
20 | public File getFile(String url){
21 | String filename=String.valueOf(url.hashCode());
22 | //String filename = URLEncoder.encode(url);
23 | File f = new File(cacheDir, filename);
24 | return f;
25 |
26 | }
27 |
28 | public void clear(){
29 | File[] files=cacheDir.listFiles();
30 | if(files==null)
31 | return;
32 | for(File f:files)
33 | f.delete();
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/utils/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.utils;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Color;
7 | import android.os.Handler;
8 | import android.widget.ImageView;
9 | import java.io.File;
10 | import java.io.FileInputStream;
11 | import java.io.FileNotFoundException;
12 | import java.io.FileOutputStream;
13 | import java.io.IOException;
14 | import java.io.InputStream;
15 | import java.io.OutputStream;
16 | import java.net.HttpURLConnection;
17 | import java.net.URL;
18 | import java.util.Collections;
19 | import java.util.Map;
20 | import java.util.WeakHashMap;
21 | import java.util.concurrent.ExecutorService;
22 | import java.util.concurrent.Executors;
23 |
24 |
25 | public class ImageLoader {
26 |
27 | MemoryCache memoryCache=new MemoryCache();
28 | FileCache fileCache;
29 | private Map imageViews= Collections.synchronizedMap(new WeakHashMap());
30 | ExecutorService executorService;
31 | Handler handler=new Handler();
32 |
33 | public ImageLoader(Context context){
34 | fileCache=new FileCache(context);
35 | executorService= Executors.newFixedThreadPool(5);
36 | }
37 |
38 |
39 | public void DisplayImage(String url, ImageView imageView)
40 | {
41 | imageViews.put(imageView, url);
42 | Bitmap bitmap=memoryCache.get(url);
43 | if(bitmap!=null)
44 | imageView.setImageBitmap(bitmap);
45 | else
46 | {
47 | queuePhoto(url, imageView);
48 | }
49 | }
50 |
51 | private void queuePhoto(String url, ImageView imageView)
52 | {
53 | PhotoToLoad p=new PhotoToLoad(url, imageView);
54 | executorService.submit(new PhotosLoader(p));
55 | }
56 |
57 | private Bitmap getBitmap(String url)
58 | {
59 | File f=fileCache.getFile(url);
60 |
61 | Bitmap b = decodeFile(f);
62 | if(b!=null)
63 | return b;
64 |
65 | try {
66 | Bitmap bitmap=null;
67 | URL imageUrl = new URL(url);
68 | HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
69 | conn.setConnectTimeout(30000);
70 | conn.setReadTimeout(30000);
71 | conn.setInstanceFollowRedirects(true);
72 | InputStream is=conn.getInputStream();
73 | OutputStream os = new FileOutputStream(f);
74 | Utils.CopyStream(is, os);
75 | os.close();
76 | conn.disconnect();
77 | bitmap = decodeFile(f);
78 | return bitmap;
79 | } catch (Throwable ex){
80 | ex.printStackTrace();
81 | if(ex instanceof OutOfMemoryError)
82 | memoryCache.clear();
83 | return null;
84 | }
85 | }
86 |
87 | private Bitmap decodeFile(File f){
88 | try {
89 | BitmapFactory.Options o = new BitmapFactory.Options();
90 | o.inJustDecodeBounds = true;
91 | FileInputStream stream1=new FileInputStream(f);
92 | BitmapFactory.decodeStream(stream1,null,o);
93 | stream1.close();
94 |
95 | final int REQUIRED_SIZE=140;
96 | int width_tmp=o.outWidth, height_tmp=o.outHeight;
97 | int scale=1;
98 | while(true){
99 | if(width_tmp/2 cache= Collections.synchronizedMap(
19 | new LinkedHashMap(10,1.5f,true));
20 | private long size=0;
21 | private long limit=1000000;
22 |
23 | public MemoryCache(){
24 | setLimit(Runtime.getRuntime().maxMemory()/4);
25 | }
26 |
27 | public void setLimit(long new_limit){
28 | limit=new_limit;
29 | Log.i(TAG, "MemoryCache will use up to "+limit/1024./1024.+"MB");
30 | }
31 |
32 | public Bitmap get(String id){
33 | try{
34 | if(!cache.containsKey(id))
35 | return null;
36 | return cache.get(id);
37 | }catch(NullPointerException ex){
38 | ex.printStackTrace();
39 | return null;
40 | }
41 | }
42 |
43 | public void put(String id, Bitmap bitmap){
44 | try{
45 | if(cache.containsKey(id))
46 | size-=getSizeInBytes(cache.get(id));
47 | cache.put(id, bitmap);
48 | size+=getSizeInBytes(bitmap);
49 | checkSize();
50 | }catch(Throwable th){
51 | th.printStackTrace();
52 | }
53 | }
54 |
55 | private void checkSize() {
56 | Log.i(TAG, "cache size="+size+" length="+cache.size());
57 | if(size>limit){
58 | Iterator> iter=cache.entrySet().iterator();
59 | while(iter.hasNext()){
60 | Map.Entry entry=iter.next();
61 | size-=getSizeInBytes(entry.getValue());
62 | iter.remove();
63 | if(size<=limit)
64 | break;
65 | }
66 | Log.i(TAG, "Clean cache. New size "+cache.size());
67 | }
68 | }
69 |
70 | public void clear() {
71 | try{
72 | cache.clear();
73 | size=0;
74 | }catch(NullPointerException ex){
75 | ex.printStackTrace();
76 | }
77 | }
78 |
79 | long getSizeInBytes(Bitmap bitmap) {
80 | if(bitmap==null)
81 | return 0;
82 | return bitmap.getRowBytes() * bitmap.getHeight();
83 | }
84 | }
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/utils/ShakeSensor.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.utils;
2 |
3 | /**
4 | * Created by Dolly on 8/17/2017.
5 | */
6 |
7 | import android.content.Context;
8 | import android.hardware.Sensor;
9 | import android.hardware.SensorEvent;
10 | import android.hardware.SensorEventListener;
11 | import android.hardware.SensorManager;
12 | import android.util.Log;
13 |
14 | public class ShakeSensor implements SensorEventListener {
15 |
16 | private static final String TAG = "ShakeEventManager===";
17 |
18 | private SensorManager sManager;
19 | private Sensor s;
20 |
21 | private static final int MOV_COUNTS = 5;
22 | private static final int MOV_THRESHOLD = 8;
23 | private static final float ALPHA = 0.8F;
24 | private static final int SHAKE_WINDOW_TIME_INTERVAL = 999; // milliseconds
25 |
26 | // Gravity force on x,y,z axis
27 | private float gravity[] = new float[3];
28 |
29 | private int counter;
30 | private long firstMovTime;
31 | private ShakeListener listener;
32 |
33 | public ShakeSensor() {
34 | }
35 |
36 | public void setListener(ShakeListener listener) {
37 | this.listener = listener;
38 | }
39 |
40 | public void init(Context ctx) {
41 | sManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE);
42 | s = sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
43 | register();
44 | }
45 |
46 | public void register() {
47 | sManager.registerListener(this, s, SensorManager.SENSOR_DELAY_NORMAL);
48 | }
49 |
50 | @Override
51 | public void onSensorChanged(SensorEvent sensorEvent) {
52 | float maxAcc = calcMaxAcceleration(sensorEvent);
53 | //Log.d(TAG, "Max ["+maxAcc+"]");
54 | if (maxAcc >= MOV_THRESHOLD) {
55 | if (counter == 0) {
56 | counter++;
57 | firstMovTime = System.currentTimeMillis();
58 | Log.d(TAG, "Эхний..");
59 | } else {
60 | long now = System.currentTimeMillis();
61 | if ((now - firstMovTime) < SHAKE_WINDOW_TIME_INTERVAL)
62 | counter++;
63 | else {
64 | resetAllData();
65 | counter++;
66 | return;
67 | }
68 | Log.d(TAG, "Стандарт ["+counter+"]");
69 |
70 | if (counter >= MOV_COUNTS)
71 | if (listener != null)
72 | listener.onShake();
73 | }
74 | }
75 |
76 | }
77 |
78 | @Override
79 | public void onAccuracyChanged(Sensor sensor, int i) {}
80 |
81 | public void deregister() {
82 | sManager.unregisterListener(this);
83 | }
84 |
85 |
86 | private float calcMaxAcceleration(SensorEvent event) {
87 | gravity[0] = calcGravityForce(event.values[0], 0);
88 | gravity[1] = calcGravityForce(event.values[1], 1);
89 | gravity[2] = calcGravityForce(event.values[2], 2);
90 |
91 | float accX = event.values[0] - gravity[0];
92 | float accY = event.values[1] - gravity[1];
93 | float accZ = event.values[2] - gravity[2];
94 |
95 | float max1 = Math.max(accX, accY);
96 | return Math.max(max1, accZ);
97 | }
98 |
99 | private float calcGravityForce(float currentVal, int index) {
100 | return ALPHA * gravity[index] + (1 - ALPHA) * currentVal;
101 | }
102 | private void resetAllData() {
103 | Log.d(TAG, "Reset all data");
104 | counter = 0;
105 | firstMovTime = System.currentTimeMillis();
106 | }
107 | public static interface ShakeListener {
108 | public void onShake();
109 | }
110 | }
--------------------------------------------------------------------------------
/app/src/main/java/agency/techstar/org/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org.utils;
2 |
3 | import java.io.InputStream;
4 | import java.io.OutputStream;
5 | /**
6 | * Author: Tortuvshin Byambaa.
7 | * Project: DglBrand
8 | * URL: https://www.github.com/tortuvshin
9 | */
10 | public class Utils {
11 |
12 | public static void CopyStream(InputStream is, OutputStream os)
13 | {
14 | final int buffer_size=1024;
15 | try
16 | {
17 | byte[] bytes=new byte[buffer_size];
18 | for(;;)
19 | {
20 | int count=is.read(bytes, 0, buffer_size);
21 | if(count==-1)
22 | break;
23 | os.write(bytes, 0, count);
24 | }
25 | }
26 | catch(Exception ex){}
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/corner_radius.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_about.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_browser.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_business.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_call.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dashboard_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_email.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_fb.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_image.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_like.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_news.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_shake.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/drawable/large.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/sign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/drawable/sign.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about_us.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_org_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
33 |
34 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
63 |
64 |
71 |
72 |
77 |
78 |
88 |
89 |
98 |
99 |
100 |
106 |
107 |
108 |
109 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
134 |
135 |
143 |
144 |
152 |
153 |
161 |
162 |
163 |
173 |
174 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_project_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
33 |
34 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
63 |
64 |
71 |
72 |
77 |
78 |
88 |
89 |
99 |
100 |
106 |
107 |
108 |
109 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
134 |
135 |
143 |
144 |
152 |
153 |
161 |
162 |
163 |
173 |
174 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
26 |
27 |
36 |
37 |
49 |
61 |
62 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_nav.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_map.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_organization.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
20 |
21 |
22 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_project.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_nav.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
22 |
23 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/organization_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
22 |
23 |
29 |
30 |
35 |
36 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/project_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
22 |
23 |
29 |
30 |
35 |
36 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_nav_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/nav.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #0099ff
4 | #2c719f
5 | #cc3300
6 | #000000
7 | #fdfdfd
8 | #0a090a
9 | #0099ff
10 | #009999
11 | #00cc44
12 | #ff33cc
13 | #ff9933
14 | #cc3300
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 160dp
7 | 16dp
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | YOUTH HEALTH
3 | Нүүр
4 | Байгууллага
5 | Байршил
6 | YOUTH HEALTH
7 | Дэлгэрэнгүй
8 | Вэб
9 |
10 | Open navigation drawer
11 | Close navigation drawer
12 |
13 | Загвар өөрчлөх
14 | Хайлт
15 |
16 |
17 | News fragment
18 | Project fragment
19 | Home fragment
20 | Youth Health
21 | BaiguullagaActivity
22 | AboutUsActivity
23 | AIzaSyDLMoacIBT8x1NjcHKFHO3Oe59ib2eAIz8
24 |
25 | MIT License Copyright(c) 2017
26 | Бидний тухай
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/searchable.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/app/src/test/java/agency/techstar/org/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package agency.techstar.org;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.0.0-rc2'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | google()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techger/org/39818f558e18957036dd553756d7c5a68143a098/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 24 13:17:40 ULAT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------