preyearegmi
6 years ago
10 changed files with 329 additions and 21 deletions
-
79app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/adapter/LanguageSelectionRVAdapter.java
-
38app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/model/LanguageModel.java
-
36app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/LanguageSelectionItemViewHolder.java
-
134app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/SplashScreen.java
-
8app/src/main/res/layout/activity_splash_screen_key_1.xml
-
7app/src/main/res/layout/activity_splash_screen_key_2.xml
-
2app/src/main/res/layout/fragment_splash_one.xml
-
2app/src/main/res/layout/fragment_splash_three.xml
-
2app/src/main/res/layout/fragment_splash_two.xml
-
42app/src/main/res/layout/splash_language_selection_item_view.xml
@ -0,0 +1,79 @@ |
|||
package com.gmeremit.online.gmeremittance_native.splash_screen.adapter; |
|||
|
|||
import android.support.annotation.NonNull; |
|||
import android.support.v7.widget.RecyclerView; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import com.bumptech.glide.Glide; |
|||
import com.gmeremit.online.gmeremittance_native.R; |
|||
import com.gmeremit.online.gmeremittance_native.customwidgets.exchangecountrylistingdialog.CountryFlagMapper; |
|||
import com.gmeremit.online.gmeremittance_native.splash_screen.model.LanguageModel; |
|||
import com.gmeremit.online.gmeremittance_native.splash_screen.view.LanguageSelectionItemViewHolder; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class LanguageSelectionRVAdapter extends RecyclerView.Adapter<LanguageSelectionItemViewHolder> { |
|||
|
|||
private List<LanguageModel> languageModels; |
|||
private LanguageSelectionListener languageSelectionListener; |
|||
|
|||
public LanguageSelectionRVAdapter() |
|||
{ |
|||
languageModels=new ArrayList<>(); |
|||
languageSelectionListener=null; |
|||
} |
|||
|
|||
@NonNull |
|||
@Override |
|||
public LanguageSelectionItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
|||
View view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.splash_language_selection_item_view,viewGroup,false); |
|||
return new LanguageSelectionItemViewHolder(view); |
|||
} |
|||
|
|||
@Override |
|||
public void onBindViewHolder(@NonNull LanguageSelectionItemViewHolder holder, int i) { |
|||
|
|||
LanguageModel data=languageModels.get(holder.getAdapterPosition()); |
|||
|
|||
int flagId= CountryFlagMapper.getFlagFromCountryCode(data.getCountryCode()); |
|||
if(flagId!=-1) |
|||
{ |
|||
Glide.with(holder.getImageView().getContext()) |
|||
.load(flagId) |
|||
.into(holder.getImageView()); |
|||
} |
|||
holder.setLanguageName(data.getCountryName()); |
|||
holder.itemView.setOnClickListener(view->{ |
|||
if(languageSelectionListener!=null) |
|||
languageSelectionListener.onLangugageSelected(data); |
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
public int getItemCount() { |
|||
return languageModels.size(); |
|||
} |
|||
|
|||
public void setLanguageSelectionListener(LanguageSelectionListener listener) |
|||
{ |
|||
this.languageSelectionListener=listener; |
|||
} |
|||
|
|||
public void setData(List<LanguageModel> data) |
|||
{ |
|||
if(data!=null&&data.size()>0) |
|||
{ |
|||
this.languageModels=data; |
|||
notifyDataSetChanged(); |
|||
} |
|||
} |
|||
|
|||
public interface LanguageSelectionListener |
|||
{ |
|||
void onLangugageSelected(LanguageModel languageModel); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.gmeremit.online.gmeremittance_native.splash_screen.model; |
|||
|
|||
public class LanguageModel { |
|||
|
|||
String countryCode; |
|||
String localeCode; |
|||
String countryName; |
|||
|
|||
public LanguageModel(String countryCode, String localeCode, String countryName) { |
|||
this.countryCode = countryCode; |
|||
this.localeCode = localeCode; |
|||
this.countryName = countryName; |
|||
} |
|||
|
|||
public String getCountryCode() { |
|||
return countryCode; |
|||
} |
|||
|
|||
public void setCountryCode(String countryCode) { |
|||
this.countryCode = countryCode; |
|||
} |
|||
|
|||
public String getLocaleCode() { |
|||
return localeCode; |
|||
} |
|||
|
|||
public void setLocaleCode(String localeCode) { |
|||
this.localeCode = localeCode; |
|||
} |
|||
|
|||
public String getCountryName() { |
|||
return countryName; |
|||
} |
|||
|
|||
public void setCountryName(String countryName) { |
|||
this.countryName = countryName; |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.gmeremit.online.gmeremittance_native.splash_screen.view; |
|||
|
|||
import android.support.annotation.NonNull; |
|||
import android.support.v7.widget.RecyclerView; |
|||
import android.view.View; |
|||
import android.widget.ImageView; |
|||
import android.widget.TextView; |
|||
|
|||
import com.gmeremit.online.gmeremittance_native.R; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
|
|||
public class LanguageSelectionItemViewHolder extends RecyclerView.ViewHolder { |
|||
|
|||
@BindView(R.id.countryFlagImageView) |
|||
ImageView countryFlag; |
|||
|
|||
@BindView(R.id.countryLanguageText) |
|||
TextView countryName; |
|||
|
|||
public LanguageSelectionItemViewHolder(@NonNull View itemView) { |
|||
super(itemView); |
|||
ButterKnife.bind(this, itemView); |
|||
} |
|||
|
|||
public ImageView getImageView() |
|||
{ |
|||
return countryFlag; |
|||
} |
|||
|
|||
public void setLanguageName(String name) |
|||
{ |
|||
countryName.setText(name); |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
xmlns:tools="http://schemas.android.com/tools" |
|||
android:layout_width="match_parent" |
|||
android:background="@android:color/transparent" |
|||
android:layout_marginBottom="2dp" |
|||
android:layout_height="wrap_content"> |
|||
|
|||
<ImageView |
|||
android:id="@+id/countryFlagImageView" |
|||
android:layout_width="55dp" |
|||
android:layout_height="45dp" |
|||
android:layout_marginBottom="8dp" |
|||
android:layout_marginEnd="8dp" |
|||
android:layout_marginStart="8dp" |
|||
android:layout_marginTop="8dp" |
|||
android:src="@drawable/flag_korean" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.3" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" /> |
|||
|
|||
<com.gmeremit.online.gmeremittance_native.customwidgets.GmeTextView |
|||
android:id="@+id/countryLanguageText" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginBottom="8dp" |
|||
android:layout_marginStart="8dp" |
|||
android:layout_marginTop="8dp" |
|||
android:text="@string/select_language_text" |
|||
|
|||
android:textColor="@color/white" |
|||
android:textSize="18sp" |
|||
app:layout_constraintBottom_toBottomOf="@+id/countryFlagImageView" |
|||
app:layout_constraintStart_toEndOf="@+id/countryFlagImageView" |
|||
app:layout_constraintTop_toTopOf="@+id/countryFlagImageView" |
|||
app:layout_constraintVertical_bias="0.49" |
|||
app:txtfontName="@string/regular" /> |
|||
|
|||
</android.support.constraint.ConstraintLayout> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue