Commit b720b2d3 authored by M M Arif's avatar M M Arif

Merge branch '28-store-nav-userinfo' into 'master'

Resolve "[Improve] Store user name, email etc in the app data"

Closes #28

See merge request mmarif4u/gitnex!37
parents 026b1386 5fe4852f
...@@ -6,8 +6,8 @@ android { ...@@ -6,8 +6,8 @@ android {
applicationId "org.mian.gitnex" applicationId "org.mian.gitnex"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 11 versionCode 12
versionName "pre-alpha9" versionName "1.0-rc1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
......
...@@ -16,6 +16,7 @@ import android.view.ViewGroup; ...@@ -16,6 +16,7 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
...@@ -79,6 +80,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -79,6 +80,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
drawer = findViewById(R.id.drawer_layout); drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view); NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
final View hView = navigationView.getHeaderView(0);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
R.string.navigation_drawer_open, R.string.navigation_drawer_close); R.string.navigation_drawer_open, R.string.navigation_drawer_close);
...@@ -99,6 +101,25 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -99,6 +101,25 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Toasty.info(getApplicationContext(), getString(R.string.checkNetConnection)); Toasty.info(getApplicationContext(), getString(R.string.checkNetConnection));
String userEmailNav = tinyDb.getString("userEmail");
String userFullNameNav = tinyDb.getString("userFullname");
String userAvatarNav = tinyDb.getString("userAvatar");
userEmail = hView.findViewById(R.id.userEmail);
if (!userEmailNav.equals("")) {
userEmail.setText(userEmailNav);
}
userFullName = hView.findViewById(R.id.userFullname);
if (!userFullNameNav.equals("")) {
userFullName.setText(userFullNameNav);
}
userAvatar = hView.findViewById(R.id.userAvatar);
if (!userAvatarNav.equals("")) {
Picasso.get().load(userAvatarNav).networkPolicy(NetworkPolicy.OFFLINE).transform(new RoundedTransformation(100, 0)).resize(180, 180).centerCrop().into(userAvatar);
}
} else { } else {
displayUserInfo(instanceUrl, instanceToken); displayUserInfo(instanceUrl, instanceToken);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment