GitNaija: Finding developers using Github REST api(UPDATE: Share Developer's profile-link Functionality and Skill-set selection Functionality)

in #utopian-io7 years ago (edited)

Github repository: https://github.com/Bethel-Eyo/GitNaija 


 The aim of this Native Android app is to help Developers find and contact other developers on github with specific set of skills in specific regions in Nigeria to enhance one on one software development mentorships, to and building of tech teams. 

History

GitNaija: Finding developers using Github REST api in different regions of Nigeria based on their Skillset

New Update

* Share Developer's profile-link


The share feature was added to make the application more engaging. This feature helps the users of GitNaija to recommend developers by sending them the profile-link of the developers that are experienced enough to mentor upcoming developers that might need help on other platforms. So the user is able to share the link of the professional developer directly from the app to  upcoming developers on other platforms after searching for the developer based on the required skill-set and location.



This is how it was implemented

  • Firstly i added the FloatActionButton tag to the  developer_profile_detail.xml file. This fab button helps the user trigger the native android share action functionality
<android.support.design.widget.FloatingActionButton
   android:id="@+id/fab"
   android:layout_width="wrap_content"
   android:layout_height="46dp"
   app:layout_anchor="@id/layout_header"
   app:fabSize="normal"
   android:layout_margin="16dp"
   app:layout_anchorGravity="right|bottom|end"
   android:clickable="true"
   app:elevation="5dp"
   app:srcCompat="@android:drawable/ic_menu_share"/>



  • Then i instantiated the FAB in my developerProfileDetailActivity.java class and i set an onclicklistener on the FAB (Floating Action Button) so that when it is clicked, it triggers a sharingIntent to enable the user share the developer's profile link to users on other platforms with some other attributes such as the header and body
mFab = (FloatingActionButton) findViewById(R.id.fab);
mFab.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
       Intent parsedIntent = new Intent(android.content.Intent.ACTION_SEND);
       parsedIntent.setType("text/plain");
       String parsedUsername = mNaijaDevelopers.getDeveloperUsername();
       String parsedProfileUrl = mNaijaDevelopers.getProfileUrl();
       String theHeader = "A Developer from Uyo, Akwa-ibom State Nigeria.";
       String theBody = "<@" + parsedUsername  + ">" + "," + "<" + parsedProfileUrl + ">";
       parsedIntent.putExtra(android.content.Intent.EXTRA_TEXT, theHeader  + theBody);
       startActivity(Intent.createChooser(parsedIntent, "Share via"));
   }
});


* Skill-set preference Functionality

  • Firstly i created a preferences.xml file in my xml resource folder to serve as the user interface for the preferences and to also provide the SettingsFragment.java class with an array of labels and values which is gotten from the arrays.xml file


<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
   xmlns:android="http://schemas.android.com/apk/res/android">

   <PreferenceCategory
       android:title="Select a skill-set">
       <ListPreference
           android:defaultValue="@string/pref_skill_value_jav"
           android:entries="@array/pref_skill_option_labels"
           android:entryValues="@array/pref_skill_option_values"
           android:key="@string/pref_skill_key"
           android:title="@string/pref_skill_label"/>
   </PreferenceCategory>

</PreferenceScreen>


  • Then i inflated the xml in the onCreatePreferences method of my SettingsFragment.java class, i implemented an OnSharedPreferencesChangeListener in both the Settings fragment and my developerFragment, where i used the new skill-set preference chosen by the user to make a new request based on the selected skill-set
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
   // Add visualizer preferences, defined in the XML file in res->xml->preferences
   addPreferencesFromResource(R.xml.preferences);

   SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
   PreferenceScreen prefScreen = getPreferenceScreen();
   int count = prefScreen.getPreferenceCount();

   // Go through all of the preferences if more than one, and set up their preference summary.
   for (int i = 0; i < count; i++) {
       Preference p = prefScreen.getPreference(i);

       String value = sharedPreferences.getString(p.getKey(), "");
       setPreferenceSummary(p, value);
   }
}


and in my developerFragment.java class, i called the skill-set that has been set by the user this way

// this method helps to configure our sharedPreference
private void setUpSharedPreferences(){
   SharedPreferences sharedPreferences = android.support.v7.preference.PreferenceManager.getDefaultSharedPreferences(getActivity());
   loadSkillsetFromSharedPreferences(sharedPreferences);
   sharedPreferences.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   if (key.equals(getString(R.string.pref_skill_key))){
       loadedDevelopers.clear();
       loadSkillsetFromSharedPreferences(sharedPreferences);
   }
}


@Override
public void onResume() {
   super.onResume();
   if (loadedDevelopers.isEmpty()){
       setUpSharedPreferences();
   } else {
       setUpSharedPreferences();
   }
}

// this method helps load the skill-set value from the settingsActivity dynamically
private void loadSkillsetFromSharedPreferences(SharedPreferences sharedPreferences){
   String skillSet = sharedPreferences.getString(getString(R.string.pref_skill_key),
           getString(R.string.pref_skill_value_jav));
   searchParams = "language:"+ skillSet+ " location:uyo";
   String statement = "Showing " + skillSet + " developers in Uyo, AKS, Nigeria";
   contextTxt.setText(statement);
   //Toast.makeText(getContext(), searchParams, Toast.LENGTH_SHORT).show();
   updateDeveloperList(searchParams);
}

Screen-shot of the skill-set functionality


Resources

* Github Repo - here

* Apk for download - here


RoadMap

  Some of the updates that will be added to this app are stated below.  


  • Providing the user with options to pick the skill set of their choice and the region of their choice of Github developers to be displayed.
  • Searching for developers in the region stated above. 
  • Providing different themes for the user.
  • Providing persistent data (offline capabilities).
  •  Sharing developers’ details to friends on other social media platforms.
  • Creating a list (team) the user can add selected developers to.
Sort: