Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Dyslexia Font Selector #10

Merged
merged 8 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: (WIP) Added low vision accessibility feature (font selector)
  • Loading branch information
Dragnalio committed Dec 3, 2020
commit e288066c876d0f2d2dfba60a859dc1b9b37ec1fc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.widget.TextView;

import com.ambinusian.adab.R;
import com.ambinusian.adab.preferences.UserPreferences;
import com.ambinusian.adab.recyclerview.nextorlatestclass.NextOrLatestClassAdapter;
import com.ambinusian.adab.recyclerview.nextorlatestclass.NextOrLatestClassModel;
import com.ambinusian.adab.room.ClassDatabase;
Expand All @@ -30,18 +34,26 @@ public class LatestClassActivity extends AppCompatActivity {
private RecyclerView latestClassRecyclerView;
private ArrayList<NextOrLatestClassModel> latestClassList;
private Date date1, date2;
private TextView latestClass;
private UserPreferences userPreferences;
private ClassDatabase db;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_student_latest_class);

userPreferences = new UserPreferences(this);
toolbar = findViewById(R.id.latest_class_toolbar);
latestClass = findViewById(R.id.tv_latest_class);
latestClassRecyclerView = findViewById(R.id.latest_class_recycler_view);
latestClassList = new ArrayList<>();
db = ClassDatabase.getDatabase(getApplicationContext());

//set text attributes
setTextSize();
setTextTypeface();

db.classDAO().getAllClass().observe(LatestClassActivity.this, new Observer<List<ClassEntity>>() {
@Override
public void onChanged(List<ClassEntity> classEntities) {
Expand Down Expand Up @@ -131,4 +143,18 @@ public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}

private void setTextSize(){
//multiple of text size
float textSize = userPreferences.getTextSize();
//set text size for each text view
latestClass.setTextSize(TypedValue.COMPLEX_UNIT_PX,latestClass.getTextSize()*textSize);
}

private void setTextTypeface(){
//get font type
Typeface textTypeface = userPreferences.getTextTypeface();
//set font type for each text view
latestClass.setTypeface(textTypeface);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_student_latest_class.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
style="@style/Widget.Adab.Toolbar"
android:id="@+id/latest_class_toolbar">
<TextView
android:id="@+id/tv_latest_class"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Thu Dec 03 01:13:32 ICT 2020
#Thu Dec 03 17:56:47 ICT 2020
VERSION_NAME=1.0.1
VERSION_CODE=307
VERSION_CODE=309