aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/layout
diff options
context:
space:
mode:
authorLibravatar Renard 2016-04-11 17:50:06 -0300
committerLibravatar Renard 2016-04-11 17:50:06 -0300
commit90ee611af8ba4c38e70f27eb0df55e9134ad625c (patch)
treeb5ed275f543b592cdb5658e732b75c98b3cae593 /app/src/main/java/layout
parentf90f14e5de8effc68a40029066754de1954cb65d (diff)
downloadBaiApp-90ee611af8ba4c38e70f27eb0df55e9134ad625c.tar.gz
BaiApp-90ee611af8ba4c38e70f27eb0df55e9134ad625c.tar.xz
BaiApp-90ee611af8ba4c38e70f27eb0df55e9134ad625c.zip
New ViewActivity, ThemeManager
Diffstat (limited to 'app/src/main/java/layout')
-rw-r--r--app/src/main/java/layout/FragmentBoardItemList.java10
-rw-r--r--app/src/main/java/layout/FragmentImage.java18
2 files changed, 23 insertions, 5 deletions
diff --git a/app/src/main/java/layout/FragmentBoardItemList.java b/app/src/main/java/layout/FragmentBoardItemList.java
index 38e4819..149def3 100644
--- a/app/src/main/java/layout/FragmentBoardItemList.java
+++ b/app/src/main/java/layout/FragmentBoardItemList.java
@@ -38,6 +38,7 @@ import org.bienvenidoainternet.baiparser.MainActivity;
import org.bienvenidoainternet.baiparser.R;
import org.bienvenidoainternet.baiparser.RecentPostAdapter;
import org.bienvenidoainternet.baiparser.ResponseActivity;
+import org.bienvenidoainternet.baiparser.ThemeManager;
import org.bienvenidoainternet.baiparser.ThreadListAdapter;
import org.bienvenidoainternet.baiparser.structure.Board;
import org.bienvenidoainternet.baiparser.structure.BoardItem;
@@ -80,6 +81,8 @@ public class FragmentBoardItemList extends Fragment {
LinearLayout layoutThreadProcess;
TextView txtThreadProcess;
+ ThemeManager tm;
+
public FragmentBoardItemList() {
// Required empty public constructor
@@ -104,6 +107,7 @@ public class FragmentBoardItemList extends Fragment {
this.currentThread = getArguments().getParcelable(ARG_CURRENT_THREAD);
this.imMainFragment = getArguments().getBoolean(ARG_MAIN_FRAGMENT);
}
+ tm = new ThemeManager(getActivity());
}
@Override
@@ -130,7 +134,7 @@ public class FragmentBoardItemList extends Fragment {
// Aplicación del Tema
settings = PreferenceManager.getDefaultSharedPreferences(this.getContext());
- int themeResId = ((MainActivity)getActivity()).getCurrentThemeId();
+ int themeResId = tm.getCurrentThemeId();
Context context = new ContextThemeWrapper(getActivity(), themeResId);
LayoutInflater localInflater = inflater.cloneInContext(context);
View v = localInflater.inflate(R.layout.fragment_fragment_thread_list, container, false);
@@ -145,14 +149,14 @@ public class FragmentBoardItemList extends Fragment {
this.loadingBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
// Agregamos color al divider del listview
- ColorDrawable cd = new ColorDrawable((((MainActivity) getActivity()).themeManager).getMarginColor());
+ ColorDrawable cd = new ColorDrawable(tm.getMarginColor());
listViewBoardItems.setDivider(cd);
listViewBoardItems.setDividerHeight(1);
// registramos los menus del listview
registerForContextMenu(listViewBoardItems);
// Creamos los dos adaptadores y los seteamos dependiendo del modo del fragmento
- listViewAdapter = new ThreadListAdapter(v.getContext(), boardItems, (((MainActivity) getActivity()).themeManager));
+ listViewAdapter = new ThreadListAdapter(v.getContext(), boardItems, tm);
recentPostAdapter = new RecentPostAdapter(v.getContext(), boardItems);
if (recentPostMode){
listViewBoardItems.setAdapter(recentPostAdapter);
diff --git a/app/src/main/java/layout/FragmentImage.java b/app/src/main/java/layout/FragmentImage.java
index 399e9f3..f337e5f 100644
--- a/app/src/main/java/layout/FragmentImage.java
+++ b/app/src/main/java/layout/FragmentImage.java
@@ -2,6 +2,7 @@ package layout;
import android.content.Context;
import android.content.ContextWrapper;
+import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -9,8 +10,9 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.ProgressBar;
-import android.widget.TextView;
+import android.widget.RelativeLayout;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
@@ -19,7 +21,6 @@ import com.koushikdutta.ion.Ion;
import org.bienvenidoainternet.baiparser.R;
import org.bienvenidoainternet.baiparser.ViewerActivity;
-import org.bienvenidoainternet.baiparser.structure.BoardItem;
import org.bienvenidoainternet.baiparser.structure.BoardItemFile;
import java.io.File;
@@ -80,11 +81,24 @@ public class FragmentImage extends Fragment {
gifView = (GifImageView) view.findViewById(R.id.gifView);
imageView.setVisibility(View.GONE);
gifView.setVisibility(View.GONE);
+ RelativeLayout layoutOpenBrowser = (RelativeLayout) view.findViewById(R.id.layoutOpenBrowser);
if (boardItemFile.file != null) {
if (!boardItemFile.file.endsWith(".webm") && !boardItemFile.file.endsWith(".swf")) {
+ layoutOpenBrowser.setVisibility(View.GONE);
downloadFile();
+ }else{
+ layoutOpenBrowser.setVisibility(View.VISIBLE);
}
}
+ Button btnOpenBrowser = (Button) view.findViewById(R.id.btnLaunchBrowser);
+ btnOpenBrowser.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(boardItemFile.fileURL));
+ in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ v.getContext().startActivity(in);
+ }
+ });
return view;
}