Theme and Icons #260

Merged
mmarif merged 15 commits from light-theme into master 2020-03-08 13:52:34 +00:00
5 changed files with 59 additions and 49 deletions
Showing only changes of commit a8cc4c00b8 - Show all commits

View File

@ -10,10 +10,10 @@ import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import com.github.barteksc.pdfviewer.PDFView; import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.util.FitPolicy; import com.github.barteksc.pdfviewer.util.FitPolicy;
@ -37,23 +37,29 @@ import retrofit2.Callback;
* Author M M Arif * Author M M Arif
*/ */
public class FileViewActivity extends AppCompatActivity { public class FileViewActivity extends BaseActivity {
private View.OnClickListener onClickListener; private View.OnClickListener onClickListener;
private TextView singleFileContents; private TextView singleFileContents;
private LinearLayout singleFileContentsFrame;
private HighlightJsView singleCodeContents; private HighlightJsView singleCodeContents;
private PhotoView imageView; private PhotoView imageView;
final Context ctx = this; final Context ctx = this;
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
private byte[] imageData; private byte[] imageData;
private PDFView pdfView; private PDFView pdfView;
private LinearLayout pdfViewFrame;
private byte[] decodedPdf; private byte[] decodedPdf;
Outdated
Review

why this variable start with $ ?

why this variable start with `$` ?

Good catch. I was into PHP mode. :)

Good catch. I was into PHP mode. :)
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected int getLayoutResourceId(){
return R.layout.activity_file_view;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_view);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@ -70,9 +76,10 @@ public class FileViewActivity extends AppCompatActivity {
singleFileContents = findViewById(R.id.singleFileContents); singleFileContents = findViewById(R.id.singleFileContents);
singleCodeContents = findViewById(R.id.singleCodeContents); singleCodeContents = findViewById(R.id.singleCodeContents);
imageView = findViewById(R.id.imageView); imageView = findViewById(R.id.imageView);
singleFileContents.setVisibility(View.GONE);
mProgressBar = findViewById(R.id.progress_bar); mProgressBar = findViewById(R.id.progress_bar);
pdfView = findViewById(R.id.pdfView); pdfView = findViewById(R.id.pdfView);
pdfViewFrame = findViewById(R.id.pdfViewFrame);
singleFileContentsFrame = findViewById(R.id.singleFileContentsFrame);
String singleFileName = getIntent().getStringExtra("singleFileName"); String singleFileName = getIntent().getStringExtra("singleFileName");
@ -126,8 +133,9 @@ public class FileViewActivity extends AppCompatActivity {
if(appUtil.imageExtension(fileExtension)) { // file is image if(appUtil.imageExtension(fileExtension)) { // file is image
singleFileContents.setVisibility(View.GONE); singleFileContentsFrame.setVisibility(View.GONE);
singleCodeContents.setVisibility(View.GONE); singleCodeContents.setVisibility(View.GONE);
pdfViewFrame.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE); imageView.setVisibility(View.VISIBLE);
imageData = Base64.decode(response.body().getContent(), Base64.DEFAULT); imageData = Base64.decode(response.body().getContent(), Base64.DEFAULT);
@ -138,7 +146,8 @@ public class FileViewActivity extends AppCompatActivity {
else if (appUtil.sourceCodeExtension(fileExtension)) { // file is sourcecode else if (appUtil.sourceCodeExtension(fileExtension)) { // file is sourcecode
imageView.setVisibility(View.GONE); imageView.setVisibility(View.GONE);
singleFileContents.setVisibility(View.GONE); singleFileContentsFrame.setVisibility(View.GONE);
pdfViewFrame.setVisibility(View.GONE);
singleCodeContents.setVisibility(View.VISIBLE); singleCodeContents.setVisibility(View.VISIBLE);
singleCodeContents.setTheme(Theme.GRUVBOX_DARK); singleCodeContents.setTheme(Theme.GRUVBOX_DARK);
@ -149,9 +158,9 @@ public class FileViewActivity extends AppCompatActivity {
else if (appUtil.pdfExtension(fileExtension)) { // file is pdf else if (appUtil.pdfExtension(fileExtension)) { // file is pdf
imageView.setVisibility(View.GONE); imageView.setVisibility(View.GONE);
singleFileContents.setVisibility(View.GONE); singleFileContentsFrame.setVisibility(View.GONE);
singleCodeContents.setVisibility(View.GONE); singleCodeContents.setVisibility(View.GONE);
pdfView.setVisibility(View.VISIBLE); pdfViewFrame.setVisibility(View.VISIBLE);
decodedPdf = Base64.decode(response.body().getContent(), Base64.DEFAULT); decodedPdf = Base64.decode(response.body().getContent(), Base64.DEFAULT);
pdfView.fromBytes(decodedPdf) pdfView.fromBytes(decodedPdf)
@ -169,7 +178,7 @@ public class FileViewActivity extends AppCompatActivity {
.fitEachPage(true) .fitEachPage(true)
.pageSnap(false) .pageSnap(false)
.pageFling(true) .pageFling(true)
.nightMode(true) .nightMode(false)
.load(); .load();
} }
@ -177,7 +186,8 @@ public class FileViewActivity extends AppCompatActivity {
imageView.setVisibility(View.GONE); imageView.setVisibility(View.GONE);
singleCodeContents.setVisibility(View.GONE); singleCodeContents.setVisibility(View.GONE);
singleFileContents.setVisibility(View.VISIBLE); pdfViewFrame.setVisibility(View.GONE);
singleFileContentsFrame.setVisibility(View.VISIBLE);
singleFileContents.setText(appUtil.decodeBase64(response.body().getContent())); singleFileContents.setText(appUtil.decodeBase64(response.body().getContent()));

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/colorPrimary"> android:background="?attr/primaryBackgroundColor">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -15,7 +15,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary" android:background="?attr/primaryBackgroundColor"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<ImageView <ImageView
@ -34,7 +34,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/defaultFilename" android:text="@string/defaultFilename"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:ellipsize="none" android:ellipsize="none"
android:scrollbars="horizontal" android:scrollbars="horizontal"
android:singleLine="true" android:singleLine="true"
@ -46,10 +46,11 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<LinearLayout <LinearLayout
android:id="@+id/singleFileContentsFrame"
android:layout_marginTop="50dp" android:layout_marginTop="50dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"> android:orientation="vertical">
<ScrollView <ScrollView
@ -61,7 +62,7 @@
android:id="@+id/singleFileContents" android:id="@+id/singleFileContents"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/colorWhite" android:textColor="?attr/primaryTextColor"
android:textSize="14sp" android:textSize="14sp"
android:padding="15dp" android:padding="15dp"
android:textIsSelectable="true" android:textIsSelectable="true"
@ -72,18 +73,18 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/pdfViewFrame"
android:layout_marginTop="55dp" android:layout_marginTop="55dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"> android:orientation="vertical">
<com.github.barteksc.pdfviewer.PDFView <com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView" android:id="@+id/pdfView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="?attr/primaryBackgroundColor" />
android:visibility="visible" />
</LinearLayout> </LinearLayout>

View File

@ -9,8 +9,7 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:orientation="vertical" android:orientation="vertical"
android:layout_margin="10dp" android:layout_margin="10dp"
android:theme="@style/AppTheme" android:background="?attr/primaryBackgroundColor"
android:background="@color/backgroundColor"
tools:context=".activities.MainActivity"> tools:context=".activities.MainActivity">
<TextView <TextView
@ -41,7 +40,7 @@
android:layout_weight=".80" android:layout_weight=".80"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:text="@string/defaultFilename" android:text="@string/defaultFilename"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" /> android:textSize="16sp" />
<ImageView <ImageView

View File

@ -26,7 +26,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:CustomTextSize="16sp" app:CustomTextSize="16sp"
app:SelectedTextColor="@color/colorAccent" app:SelectedTextColor="?attr/primaryTextColor"
app:UnSelectedTextColor="@color/lightGray" app:UnSelectedTextColor="@color/lightGray"
android:text="@string/filesBreadcrumbRoot"/> android:text="@string/filesBreadcrumbRoot"/>
@ -34,7 +34,7 @@
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:background="?attr/primaryBackgroundColor"
android:padding="4dp" android:padding="4dp"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
@ -45,7 +45,7 @@
android:layout_margin="15dp" android:layout_margin="15dp"
android:gravity="center" android:gravity="center"
android:text="@string/noDataFilesTab" android:text="@string/noDataFilesTab"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -6,7 +6,7 @@
<ScrollView <ScrollView
android:orientation="vertical" android:orientation="vertical"
android:background="@color/backgroundColor" android:background="?attr/primaryBackgroundColor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -61,7 +61,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoName1" android:text="@string/infoTabRepoName1"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:id="@+id/repoNameInfo" android:id="@+id/repoNameInfo"
@ -71,14 +71,14 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoOwner1" android:text="@string/infoTabRepoOwner1"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -89,14 +89,14 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoDesc" android:text="@string/infoTabRepoDesc"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -108,14 +108,14 @@
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:autoLink="web" android:autoLink="web"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoWebsite" android:text="@string/infoTabRepoWebsite"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -128,14 +128,14 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoSize" android:text="@string/infoTabRepoSize"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -146,14 +146,14 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoDefaultBranch" android:text="@string/infoTabRepoDefaultBranch"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -164,14 +164,14 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoSshUrl" android:text="@string/infoTabRepoSshUrl"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -184,14 +184,14 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoCloneUrl" android:text="@string/infoTabRepoCloneUrl"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -204,14 +204,14 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoRepoUrl" android:text="@string/infoTabRepoRepoUrl"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -224,14 +224,14 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoForksCount" android:text="@string/infoTabRepoForksCount"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -242,14 +242,14 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/infoTabRepoCreatedAt" android:text="@string/infoTabRepoCreatedAt"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/white" android:textColor="?attr/primaryTextColor"
android:layout_marginTop="15dp"/> android:layout_marginTop="15dp"/>
<TextView <TextView
@ -259,7 +259,7 @@
android:text="@string/infoTabRepoDummyTime" android:text="@string/infoTabRepoDummyTime"
android:textSize="14sp" android:textSize="14sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
</LinearLayout> </LinearLayout>
@ -310,7 +310,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textIsSelectable="true" android:textIsSelectable="true"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/colorWhite"/> android:textColor="?attr/primaryTextColor"/>
</LinearLayout> </LinearLayout>